VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxShell/vboxinfo.vbs@ 26502

Last change on this file since 26502 was 26502, checked in by vboxsync, 15 years ago

Frontends: whitespace cleanup.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1'
2' Copyright (C) 2009 Sun Microsystems, Inc.
3'
4' This file is part of VirtualBox Open Source Edition (OSE), as
5' available from http://www.virtualbox.org. This file is free software;
6' you can redistribute it and/or modify it under the terms of the GNU
7' General Public License (GPL) as published by the Free Software
8' Foundation, in version 2 as it comes in the "COPYING" file of the
9' VirtualBox OSE distribution. VirtualBox OSE is distributed in the
10' hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
11'
12' Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
13' Clara, CA 95054 USA or visit http://www.sun.com if you need
14' additional information or have any questions.
15'
16
17Sub Print(str)
18 Wscript.Echo str
19End Sub
20
21Sub StartVm(vb, mach)
22 Dim session, progress
23
24 Set session = CreateObject("VirtualBox.Session")
25 Set progress = vb.openRemoteSession(session, mach.id, "gui", "")
26 progress.waitForCompletion(-1)
27 session.close()
28End Sub
29
30
31Sub StopVm(vb, mach)
32 Dim session, progress
33
34 Set session = CreateObject("VirtualBox.Session")
35 vb.openExistingSession session, mach.id
36 session.console.powerDown().waitForCompletion(-1)
37 session.close()
38End Sub
39
40
41Sub Main
42 Dim vb, mach
43
44 set vb = CreateObject("VirtualBox.VirtualBox")
45 Print "VirtualBox version " & vb.version
46
47 ' Safe arrays not fully functional from Visual Basic Script, as we
48 ' return real safe arrays, not ones wrapped to VARIANT and VBS engine
49 ' gets confused. Until then, explicitly find VM by name.
50 ' May wish to use hack like one described in
51 ' http://www.tech-archive.net/Archive/Excel/microsoft.public.excel.programming/2006-05/msg02796.html to handle safearrays
52 ' if desperate
53
54 Set mach = vb.findMachine("Win")
55 Print "Machine: " & mach.name & " ID: " & mach.id
56
57 StartVm vb, mach
58End Sub
59
60Main
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette