Fusion

 View Only
  • 1.  How to close virtual machine window automatically in Fusion

    Posted Feb 28, 2011 02:10 AM

    I think I posted this last week, but I can't find it now, and still not anwsered yet, so I post again:

    I'm using Fusion 3.1.2 on Mac OS X 10.6.5 Host ; after I run VMRUN STOP  to stop a virtual machine,

    the virtual machine windows is still there; so each time I stop and start another virtual machine, there will be

    more and more virtual machine windows.

    Is there a command or API call to close the stopped virtual machine window? Thanks very much!



  • 2.  RE: How to close virtual machine window automatically in Fusion

    Posted Feb 28, 2011 06:21 AM

    I'd start by looking into using applescript to close windows.



  • 3.  RE: How to close virtual machine window automatically in Fusion

    Posted Feb 28, 2011 06:25 AM
    I think I posted this last week, but I can't find it now, and still not anwsered yet, so I post again:

    If you've already asked the question then you should not post the question again, rather bump the original and if you can't find it you can always look under your VMware Profile (zhiyuanzhou) and more specifically: zhiyuanzhou's Stuff

    Was this the original?: Stop Virtual Machine problem with Fusion

    I don't have an explicit answer for your issue, sorry, however even though VMware Fusion doesn't yet officially support AppleScript nonetheless it does have an AppleScript Dictionary and you might be able to script it or even use Automator and or a combination of bash scripting, AppleScript and Automator.



  • 4.  RE: How to close virtual machine window automatically in Fusion

    Posted Feb 28, 2011 07:37 AM

    Hello,

    As WoodyZ correctly points out it would have been best to have bumped the original question, but as you are new I can understand that trying to navigate the forum is a bit overwhelming.

    In reply to "I think I posted this last week"  in particular. You posted the article which Woody located and also another one with nearly identical text which didn't have the follow up post that seemed to suggest you had found an answer.

    As the text of that question was pretty much the same as the first post I removed that post to keep the clutter down a bit.

    Here's the text of that particular post.

    zhiyuanzhou wrote:

    I'm using vmrun stop command to stop virtual machine, however, although the virtual machine running window turned into  "Stopped" state window,the stopped windows is always there. So if I then start and stop more virtual machine, there will be a lot of "Stopped" virtual machine windows there.


    Is there a  command or API call to close the stopped virtual machine window?


    I'm using Fusion 3.1.2 on Mac OS X 10.6.5 host machine.

    Like Eric Tung points out the way to approach this if you can't use the nogui option is to use applescript to close the window.

    I'm sorry that I can't be of much help here as I'm new to applescript. I just tried the following in a script and it didn't work for me :smileysad:

    "MySQL" is the title in the window that I started and stopped using vmrun. I must be doing something wrong, but don't know what.

    tell application "VMware Fusion"
        close window named "MySQL"
    end tell

    I forgot to mention that I first tried to approach this using a bash script, but the window is part of Fusion, so there is no particular process ID to kill and it seems you have to go through Fusion to do this. The Fusion dictionary itself doesn't show anything beyond the standard commands you can use via vmrun, but if you select it in Script Editor you also get it to show the dictionary for the "Standard Suite" so it seems to be supported, but I don't know to be honest.

    --

    Wil

    edit: added text about trying this via a bash script.



  • 5.  RE: How to close virtual machine window automatically in Fusion

    Posted Feb 28, 2011 08:04 AM

    but if you select it in Script Editor you also get it to show the dictionary for the "Standard Suite" so it seems to be supported, but I don't know to be honest.

    As I have previously said "... even though VMware Fusion doesn't yet officially support AppleScript nonetheless it does have an AppleScript Dictionary ..." and what this means is, it is a work in progress and may or may not work and will not be officially supported until the developers fix what's wrong with it and this comes from one of the developers. :smileywink:



  • 6.  RE: How to close virtual machine window automatically in Fusion

    Posted Feb 28, 2011 09:18 AM

    My mistake, I had posted without actually having tried it. I assumed close would just work since it seemed so basic I expected Applescript to provide this functionality for free, but that does not appear to be the case.



  • 7.  RE: How to close virtual machine window automatically in Fusion

    Posted Feb 28, 2011 09:25 AM
      |   view attached

    Here is an example of closing a VMware Fusion Virtual Machine window using AppleScript without using the VMware Fusion AppleScript Dictionary.

    Attachment(s)



  • 8.  RE: How to close virtual machine window automatically in Fusion

    Posted Mar 01, 2011 01:48 AM

    Thanks very much everyone :smileyhappy:, really appreciate your helps. I might experiment the apple script solution.

    I found out a sloution , althoug not so gracefull. I described here:

    The virtual machine windows and virtual machine library window are all managed by /Applications/VMware Fusion.app/Contents/MacOS/vmware ,

    So I kill the /Applications/VMware Fusion.app/Contents/MacOS/vmware process, then start it again, closed virtual machine window will not come out; while the running virtual machines will still come out with a running window.

    In summary, kill the /Applications/VMware Fusion.app/Contents/MacOS/vmware process will bring the virtual machines to nogui mode; start /Applications/VMware Fusion.app/Contents/MacOS/vmware will bring back to gui mode, but the machines in power-off state will not have gui window. So kill and start solved my problem.