VMware Communities
blackpuma
Contributor
Contributor

Scripting

I assume "no" at this point, but is there any kind of scripting ability with Fusion?

If it's not there, AppleScript support is something that probably ought to be on a (future) "to do" list, seeing how it's pretty standard on OS X.

Hey, it's worth asking! :smileygrin:

Reply
0 Kudos
8 Replies
rcardona2k
Immortal
Immortal

I would expect VMware to port VIX 2.0 over to OS X then they can extended AppleScript to bridge to VIX. Of course VMware won't consider doing this unless you request it and especially explain your use case of why[/i] you want to drive Fusion via a scripting interface.

Reply
0 Kudos
blackpuma
Contributor
Contributor

Of course VMware won't consider doing this unless

you request it

Consider it requested, then.

and especially explain your use

case of why you want to drive Fusion via a

scripting interface.

??? ... for the same reason any application (including Workstation) has any kind of support for control via an external evironment... laziness and impatience, two of the Three Great Virtues of a Programmer per the definition listed in the Camel book.

LAZINESS: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer.

IMPATIENCE: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least that pretend to. Hence, the second great virtue of a programmer.

I'm sorry, but the case for external control seems quite obvious from a geeky perspective... though for Fusion I can completely understand that this is a low[/b] priority.

It's a fair question worth asking[/b].

Reply
0 Kudos
HPReg
VMware Employee
VMware Employee

AppleScript shoud work right now though. VMware QA has already used it successfully in-house to automate some UI tasks. Let us know if it does not work for you, or if some functionality is missing.

We don't provide any VIX infrastructure (i.e. libs) right now, but once we do it should just work. Unless there is very strong demand, it is unlikely we will provide a AppleScript bridge to VIX. We consider AppleScript as a toy.

Reply
0 Kudos
admin
Immortal
Immortal

I just powered on a VM with an AppleScript like this:

tell application "VMware Fusion"

open file "Macintosh HD:Users:brice:vms:Windows 2000 Professional:Windows 2000 Professional.vmx"

end tell

But as far as I can tell we don't expose Fusion-specific verbs (like suspend, connect, disconnect, etc.)

However, UI Scripting works just fine. I've used that to do all the various things you'd expect.

Reply
0 Kudos
rcardona2k
Immortal
Immortal

Yes, but the VM will likely be stuck waiting for a response to a prompt such as "You are running VMware Fusion with the DEBUG option" and you can not answer these through AppleScript. Of course you can check all of the "Never show this dialog box again" prompts or you can configure VMware to automatically answer these prompts such as in the discussion in this thread:

Autostart Virtual Machines

Reply
0 Kudos
admin
Immortal
Immortal

I deal with those "You are running VMware Fusion with the DEBUG option" prompts using UI Scripting. Here's an example:

tell application "System Events"

tell application process "vmware"

click button "OK" of sheet 1 of window "Windows 2000 Professional"

end tell

end tell

(Note: persons running builds earlier than 36932 may need to substitute a different process name for "vmware"; check the output of ps auxl.)

Reply
0 Kudos
rcardona2k
Immortal
Immortal

I knew I shouldn't have written "you can not answer these in Applescript" Smiley Wink

1. How do you know the VM is stuck?

2. How do you answer successive prompts?

3. (Per 1) How do you know the VM is successfully running?

\* Hint: we need VIX 2.0 support

Reply
0 Kudos
admin
Immortal
Immortal

Strictly speaking, UI Scripting isn't AppleScript. Well, maybe UI Scripting is AppleScript in the same way that miniature golf is golf.

Anyway, here's the code I use to power through successive warning panels:

tell application "System Events"

tell application process "vmware"

repeat while (exists button "OK" of sheet 1 of window "Windows XP Professional")

click button "OK" of sheet 1 of window "Windows XP Professional"

delay 1

end repeat

end tell

end tell

Notice that the loop exits whenever no more panels appear.

Reply
0 Kudos