Changeset 35929 in vbox
- Timestamp:
- Feb 10, 2011 2:22:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/SDKRef.xml
r35296 r35929 1438 1438 following code will a start virtual machine by name or ID:</para> 1439 1439 1440 <screen>vbox = virtualBoxManager.vbox 1441 mgr = virtualBoxManager.mgr 1442 print "Version is",vbox.version 1443 1444 def machById(id): 1445 mach = None 1446 for m in virtualBoxManager.getArray(vbox, 'machines'): 1447 if m.name == id or mach.id == id: 1448 mach = m 1449 break 1450 return mach 1451 1440 <screen>from vboxapi import VirtualBoxManager 1441 mgr = VirtualBoxManager(None, None) 1442 vbox = mgr.vbox 1452 1443 name = "Linux" 1453 mach = machById(name) 1454 if mach is None: 1455 print "cannot find machine",name 1456 else: 1457 session = mgr.getSessionObject(vbox) 1458 # one can also start headless session with "headless" instead of "gui" 1459 progress = vb.openRemoteSession(session, mach.id, "gui", "") 1460 progress.waitForCompletion(-1) 1461 session.close() 1444 mach = vbox.findMachine(name) 1445 session = mgr.mgr.getSessionObject(vbox) 1446 progress = mach.launchVMProcess(session, "gui", "") 1447 progress.waitForCompletion(-1) 1448 mgr.closeMachineSession(session) 1462 1449 </screen> 1463 1450
Note:
See TracChangeset
for help on using the changeset viewer.