Re: VirtualBox changes user privileges - other users can't o
Posted: 12. Oct 2011, 17:46
An applescript would work like this:
1.) Double-click the applescript instead of VirtualBox, it in turn opens VirtualBox
2.) The applescript stays open and running watching for VirtualBox to *not* be running
3.) When it sees VirtualBox is no longer running, it runs your shell script code
4.) The applescript delays an appropriate time to allow the shell script to execute, then quits itself
1.) Copy this code into Script Editor (Apple changed it to Applescript Editor in 10.7), It's either in "Applications" or "Utilities".
2.) Save it anywhere you like as a "Stay Open" application -- I suggest your home folder, but anywhere should work fine.
3.) Name it something you can easily relate to.
4.) Double-click it to open it and VirtualBox
5.) When you quit VirtualBox it should execute your shell script, delay a ten seconds and quit ready for the next launch.
Since I don't have this permissions problem I can't test this applescript myself. But it otherwise functions well on my machine.
Hope this helps.
-Daniel
1.) Double-click the applescript instead of VirtualBox, it in turn opens VirtualBox
2.) The applescript stays open and running watching for VirtualBox to *not* be running
3.) When it sees VirtualBox is no longer running, it runs your shell script code
4.) The applescript delays an appropriate time to allow the shell script to execute, then quits itself
Code: Select all
--open VirtualBox
tell application id "org.virtualbox.app.VirtualBox" to activate
--Check VirtualBox, is it running?
on idle
if application id "org.virtualbox.app.VirtualBox" is not running then
do shell script --shell code goes here
return 20
end if
end idle
(* Below v v change the delay 10 (seconds) to what you think is the longest time required
for your shell code to execute before this applescript quits itself *)
delay 10
if application id "org.virtualbox.app.VirtualBox" is not running then
end if
quit2.) Save it anywhere you like as a "Stay Open" application -- I suggest your home folder, but anywhere should work fine.
3.) Name it something you can easily relate to.
4.) Double-click it to open it and VirtualBox
5.) When you quit VirtualBox it should execute your shell script, delay a ten seconds and quit ready for the next launch.
Since I don't have this permissions problem I can't test this applescript myself. But it otherwise functions well on my machine.
Hope this helps.
-Daniel