Page 1 of 1
Why does this not work in 5.x
Posted: 29. Sep 2015, 02:58
by brycesteiner
I've upgraded to 5.0 then .2 and .4
Something I cannot get working for anything is the command to start the command from applescript. Here is what I always used in 4.x
Code: Select all
do shell script "vboxmanage startvm 'XPworklaptop'"
and it worked great when saved as an app. Now I get:
error "sh: vboxmanage: command not found" number 127
It doesn't matter which Mac OS I use. I've tried 10.8 10.10 and 10.11 and they all have the same effect: It works with 4 but not 5.
From what I read in the manual the command hasn't changed.
What am I doing wrong?
Re: Why does this not work in 5.x
Posted: 29. Sep 2015, 10:13
by socratis
Well, I tried with 5.0.4, 4.3.32, 4.3.0, 4.2.26 and 4.1.28 and I got the same error (4.0.20 got me a kernel panic; haven't had one for years). I got the same error as you did, so I don't know how you managed to get it working in the 4.x series.
BUT, if I change the script lightly to:
do shell script "/Applications/VirtualBox.app/Contents/MacOS/VBoxManage startvm FreeDOS"
or
do shell script "/usr/local/bin/VBoxManage startvm FreeDOS"
it works as expected.
That means that from the Applescript it needs the full path to the VBoxManage command. Now, on the other hand, if I do it from the terminal:
osascript -e 'do shell script "VBoxManage startvm FreeDOS"'
it works. Kind of counter-intuitive if you ask me.
N.B.: I don't remember exactly when (I think after 10.9), but the VBoxManage used to reside in /usr/bin, not in /usr/local/bin, so adjust accordingly.
P.S.: Tested on Mac OS X 10.9.5, but I don't think it makes a difference...
Re: Why does this not work in 5.x
Posted: 29. Sep 2015, 12:01
by loukingjr
FWIW, In OSX 10.10 & 10.11, VBoxManage is in /usr/local/bin. I believe everything was moved with VB 5.0 to be SIP compliant.
Re: Why does this not work in 5.x
Posted: 30. Sep 2015, 03:26
by brycesteiner
@socratis
Thanks for the info. That worked perfectly. I didn't think to write in the whole path.
Re: Why does this not work in 5.x
Posted: 30. Sep 2015, 11:10
by socratis
I tried to find more information about this behavior of AppleScript, but I couldn't. Apparently when run from the AppleScript editor or a standalone app, the whole path variable is not passed through to the app's environment.
But, this is an OS X issue, so I don't want to expand on this issue on these forums...