using the SDK to showConsoleWindow

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
gjcourt
Posts: 1
Joined: 18. Oct 2010, 22:32
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP

using the SDK to showConsoleWindow

Post by gjcourt »

Hi,

I just started using the VBox SDK (using the vboxshell.py as my template). I'm trying to open up a console window on the Guest OS so that I can execute some console commands, and powerdown the VM, the problem is that the command doesn't seem to work. Here is the function that I'm using:

def testCmd(ctx, args):
mach = argsToMach(ctx,args)
if mach == None:
return 0

vbox = ctx['vb']
session = ctx['mgr'].getSessionObject(vbox)
vbox.openExistingSession(session, mach.id)

if session.state != ctx['ifaces'].SessionState.Open:
print "Session to '%s' in wrong state: %s" %(mach.name, session.state)
return

if mach.canShowConsoleWindow():
print "trying to show the console"
console = mach.showConsoleWindow()
print console
#pdb.set_trace()

session.close()

return 0

When I execute this command, the Guest OS takes focus, but there is no console window. The output of this program being run is as follows:


vbox> list
Machine 'Windows XP' [654b04d9-1c75-41c3-a7af-5a0117a2b406], state=2
Machine 'lucid' [637e7dba-dc7a-48a6-9b11-6a8ea6dee67f], state=1
Machine 'lucid_1' [d1a41406-a127-4ca6-97f5-d08c1208c24b], state=1

vbox> test 654b04d9-1c75-41c3-a7af-5a0117a2b406
trying to show the console
0

vbox>

Is there something that I'm missing? Any help would be greatly appreciated.
Post Reply