how to put a virtual machine launcher icon in the dock?
how to put a virtual machine launcher icon in the dock?
how to make a two step process (first launch VBox, then run VM) into one (just click on VM icon in dock)?
in linux it can be done if you check process list, find running virtual machine process and then create a separate shortcut with that entire string. but how do I do something similar in OS X?
at least I am not the only one
http://forums.virtualbox.org/viewtopic. ... light=dock
in linux it can be done if you check process list, find running virtual machine process and then create a separate shortcut with that entire string. but how do I do something similar in OS X?
at least I am not the only one
http://forums.virtualbox.org/viewtopic. ... light=dock
... Well you could wrap a shell script up in a AppleScript application and plop it in your dock...
Code: Select all
do shell script "vboxmanage startvm NAMEOFYOURVIRTUALMACHINE"
Last edited by amagine on 14. Sep 2008, 17:06, edited 1 time in total.
-
- Posts: 30
- Joined: 14. Sep 2008, 02:56
Re: how to put a virtual machine launcher icon in the dock?
i did this.shpokas wrote:how to make a two step process (first launch VBox, then run VM) into one (just click on VM icon in dock)?
in linux it can be done if you check process list, find running virtual machine process and then create a separate shortcut with that entire string. but how do I do something similar in OS X?
at least I am not the only one
http://forums.virtualbox.org/viewtopic. ... light=dock
after installing virtual box double click on Mac. HD, choose application, scroll down and find the virtualbox icon, click on it and drag on the Dock.
now you see the icon on the Dock and when you click on it it hops and starts.
And this will launch Virtual box. Then you have to select which VM you want to launch. This is not what were are asking. Anyone who uses a Mac knows you can put an alias of an app in the dock!
What we are asking is how to put an alias of each VM in the dock so we can easily launch whichever one we want. Parallels and VM Aware can do this without a problem.
What we are asking is how to put an alias of each VM in the dock so we can easily launch whichever one we want. Parallels and VM Aware can do this without a problem.
-
- Posts: 30
- Joined: 14. Sep 2008, 02:56
Thanks for the idea, never occured to me to do it this way.
I've made a little improvement from that one liner (Although this is for headless mode.)
You just paste the lower code in "Applications -> Apple Script -> Script Editor" and save as Application as described above.
Now you can drag the script to the dock and run an OS in headless mode. After it runs, it gives you a dialog to either 'Hibernate (through VBox feature)', 'Shutdown (as in virtually pressing the power button [you need acpid daemon running for Linux for this to work]) and 'Destroy (which will kill the OS instance immediately)'.
You need to change the first line of the script to write in your VM instance name. (Written as 'Ubuntu Linux' for now.)
If you want to use this for multiple OS, you just need to change the VM instance name and save it as a different application and you might want to actually put the folder in the dock instead.
If you want to enable RDP remote management, then you need to edit the 'VB_RDP' value to a port number instead of "off".
And if you want to look niftier than the default icon, you can google image for '[your OS name] icon' (be sure to pick the one with proper transparency) and grab one and use something like img2icns to turn the file into an icon file then use that as the custom icon.
Looking pretty.
I've made a little improvement from that one liner (Although this is for headless mode.)
You just paste the lower code in "Applications -> Apple Script -> Script Editor" and save as Application as described above.
Now you can drag the script to the dock and run an OS in headless mode. After it runs, it gives you a dialog to either 'Hibernate (through VBox feature)', 'Shutdown (as in virtually pressing the power button [you need acpid daemon running for Linux for this to work]) and 'Destroy (which will kill the OS instance immediately)'.
You need to change the first line of the script to write in your VM instance name. (Written as 'Ubuntu Linux' for now.)
If you want to use this for multiple OS, you just need to change the VM instance name and save it as a different application and you might want to actually put the folder in the dock instead.
If you want to enable RDP remote management, then you need to edit the 'VB_RDP' value to a port number instead of "off".
And if you want to look niftier than the default icon, you can google image for '[your OS name] icon' (be sure to pick the one with proper transparency) and grab one and use something like img2icns to turn the file into an icon file then use that as the custom icon.
Looking pretty.
Code: Select all
set VB_GUEST to "Ubuntu Linux"
set VB_RDP to "off"
set VB_PATH to "/usr/bin/"
set VB_VM to quoted form of VB_GUEST
do shell script VB_PATH & "VBoxHeadless -s " & VB_VM & " -v " & VB_RDP & " >/dev/null 2>&1 &"
display dialog "VirtualBox " & VB_VM buttons {"Hibernate", "Shutdown", "Destroy"} default button 1
set VB_ACT to button returned of result
set VB_CONTROL to VB_PATH & "VBoxManage controlvm " & VB_VM
if VB_ACT is "Hibernate" then
do shell script VB_CONTROL & " savestate"
else if VB_ACT is "Shutdown" then
do shell script VB_CONTROL & " acpipowerbutton"
else if VB_ACT is "Destroy" then
do shell script VB_CONTROL & " poweroff"
end if
-
- Posts: 1
- Joined: 27. Jan 2009, 07:05
I am not very familiar with Apple Script so I am unsure quite how to adapt this. I currently have a Virtual Machine called Internet Explorer 7, which is a Windows XP image that contains IE7. Can anyone tell me how I might make a direct link shortcut? Also, is there a way to default to "save state" when closing?
It is pretty simple.
First try the above mentioned line
for your needs this should be
a little more sophisticated script would be
Copy the provided code, open the AppleScript Editor and paste it into the edit-window, save it as a program, and you can throw the resulting program to the dock.
Further you can obtain yourself an icon, copy it to the clipboard, select the saved script-program, press Apple-I and paste it over the existing icon.
The way the vm acts when closing, is determined by the last used way, that means if you have saved the vm, next time it defaults to "Save state".
But I guess you can change this in the corresponding xml-file that you can find under $HOME/Library/VirtualBox/Machines/(machinename).
Also you can default there to seamlessmode.
First try the above mentioned line
Code: Select all
do shell script "vboxmanage startvm NAMEOFYOURVIRTUALMACHINE"
Code: Select all
do shell script "vboxmanage startvm Internet Explorer 7"
Code: Select all
set VB_GUEST to "Internet Explorer 7"
set VB_PATH to "/usr/bin/"
set VB_VM to quoted form of VB_GUEST
do shell script VB_PATH & "VBoxManage startvm " & VB_VM
Further you can obtain yourself an icon, copy it to the clipboard, select the saved script-program, press Apple-I and paste it over the existing icon.
The way the vm acts when closing, is determined by the last used way, that means if you have saved the vm, next time it defaults to "Save state".
But I guess you can change this in the corresponding xml-file that you can find under $HOME/Library/VirtualBox/Machines/(machinename).
Also you can default there to seamlessmode.
-
- Posts: 2
- Joined: 29. Sep 2009, 06:47
- Primary OS: Mac OS X Leopard
- VBox Version: OSE other
- Guest OSses: Windows XP
Re: how to put a virtual machine launcher icon in the dock?
I made a few changes to the longer applescript posted above by h1d, mainly to check whether the process was already running, and to handle the GUI app VirtualBox, giving the user the option to kill that as well. I also changed the command for starting the VM, but it's easy enough to change that to do what you want it to.
Code: Select all
global VM
set VB_GUEST to "Name of your machine goes here"
set VB_VM to quoted form of VB_GUEST
set GUI to false
tell application "System Events"
if exists process "VirtualBoxVM" then
set VM to true
if exists process "VirtualBox" then set GUI to true
else
set VM to false
end if
end tell
if not VM then
do shell script "VBoxManage startvm " & VB_VM & " >/dev/null 2>&1 &"
else
display dialog "Are you sure?" buttons {"Cancel", "Yes"} default button 2
set ans to button returned of result
if ans = "Cancel" then return
display dialog "VirtualBox " & VB_VM buttons {"Destroy", "Shutdown", "Hibernate"} default button 3
set VB_ACT to button returned of result
if GUI then
display dialog "Shut down the GUI too?" buttons {"No", "Yes"} default button 2
set ans to button returned of result
if ans = "Yes" then
tell application "VirtualBox"
ignoring application responses
quit
end ignoring
end tell
end if
end if
set VB_CONTROL to "VBoxManage controlvm " & VB_VM
if VB_ACT is "Hibernate" then
do shell script VB_CONTROL & " savestate"
else if VB_ACT is "Shutdown" then
do shell script VB_CONTROL & " acpipowerbutton"
else if VB_ACT is "Destroy" then
do shell script VB_CONTROL & " poweroff"
end if
end if
-
- Posts: 3
- Joined: 16. Nov 2010, 09:27
- Primary OS: Mac OS X Leopard
- VBox Version: OSE other
- Guest OSses: Ubuntu
Re: how to put a virtual machine launcher icon in the dock?
finally found this after much searching...
many thanks to all the people above!
many thanks to all the people above!
-
- Posts: 1
- Joined: 24. Jan 2011, 19:10
- Primary OS: Mac OS X other
- VBox Version: OSE other
- Guest OSses: Windows XP, Windows 7
Re: how to put a virtual machine launcher icon in the dock?
Is there a way for the script application to hold the actual virtual machine and not just open the virtual machine? I want it to act more like an application so that the script holds the virtual machine so there are no other icons.
Re: how to put a virtual machine launcher icon in the dock?
Here's my method:
In your home folder, open the VirtualBox VMs folder
Open the folder of the VM you want to add to the dock
Highlight the .vbox file and choose File > Get Info or cmd-i
In the Get Info window, choose vmstarter.app if it's not already chosen
You can click the Change All button if you want this to work for all of your VMs
Now drag the .vbox file into the right side of the dock, to the right of the vertical line
When you click on it, it will open your VM without starting the app
Hope that helps,
Bob
In your home folder, open the VirtualBox VMs folder
Open the folder of the VM you want to add to the dock
Highlight the .vbox file and choose File > Get Info or cmd-i
In the Get Info window, choose vmstarter.app if it's not already chosen
You can click the Change All button if you want this to work for all of your VMs
Now drag the .vbox file into the right side of the dock, to the right of the vertical line
When you click on it, it will open your VM without starting the app
Hope that helps,
Bob