Jump to content

gr4z

Member
  • Posts

    36
  • Joined

  • Last visited

Posts posted by gr4z

  1. Cool thanks works well now :) only thing is the VM always starts up in Windowed mode. I set all my VMs to start in Coherence mode, using this workflow seems to make the VM ignore this. Weird.

     

    Great workflow though!

  2. Thanks for trying. This is a great workflow.

     

    I have tried it again and it still does it. Let me try and explain:

     

    1) Parallels is NOT running

    2) Use the workflow to resume a suspended VM

    3) Parallels starts and the VM resumes

    4) Use the workflow to suspend the VM

    5) The VM is suspended and is removed from the Dock

    6) The Parallels application reappears in the dock

     

    Can you make it if there are no other VMs running when you suspend or shutdown a VM the Parallels application is permanetly closed?

     

    Thanks

  3. Sorry still doesn't work. It lists all my VMs and their status but when you highlight one and press enter, nothing happens. 

     

    *EDIT* sorry ignore me my bad. Tried it again and it does work OK. Although if you use the quick selection i.e. cmd-2 to select VM 2 in the list, nothing happens. You have to highlight the VM and press TAB for it to list the various options available.

     

    Hope that makes sense. 

  4. OK I have now changed the script action to run your action.sh script followed by the prlctl {query}. This works fine. 

     

    I removed the prlcrl $1 from action.sh and reduced the sleep to 1 which seems to work well. Being very pedantic is there anyway I can start the app Parallels Desktop minimised?

     

    Thank you so much for your help.

  5. OK confirmed that prlctl does indeed work when Parallels is not working. It just lists nothing which I assume is correct. However, I have used your script above and now nothing happens at all :) Suspending Parallels and trying to resume a VM all fail to do anything. So I assume the action.sh isn't working. Here is what I have used:

     

    a=`ps aux|grep "Parallels Desktop"

    if [[ -z $a ]]; then

      open "/Applications/Parallels Desktop.app"

      sleep 5

    fi

    prlctl $1

     

    Does this look correct? Is the ` after the a= correct? Sorry I don't know these scripts very well. 

     

    *EDIT* so added another ` after ps aux so have :

     

     

    a=`ps aux`|grep "Parallels Desktop"

    if [[ -z $a ]]; then

      open "/Applications/Parallels Desktop.app"

      sleep 5

    fi

    prlctl $1

     

    And it now starts Parallels but doesn't do anything else. Assume this is because it cannot find prlctl?

  6. OK to prevent the script from launching Parallels every time it executes, can I place the snippet only when you select what outcome you want? I.e. this workflow queries the status of all your VMs and then lists what you can do with them - resume, reboot etc. What would be ideal is the new snippet only be run if I select an outcome, otherwise it is ignored. 

     

    Any suggestions?

    Thanks again

  7. Does anyone have a workflow that can output what is current playing in iTunes into Twitter/Facebook? Done a quick search and cannot find anything...

     

    I have this code I use with NerdTool (for streaming radio) so can I use this to pipe what I want to Tweetbot for example?

     

    # ITUNES CURRENT MUSIC

    # ROBERT WOLTERMAN (xtacocorex)

    # I MODIFIED THIS FROM SOMEWHERE ON THE INTERNETS, BUT CANNOT REMEMBER WHERE

    # THIS CODE WORKS IF YOU ARE LISTENING TO AUDIO FILES OR WEB STREAMS THROUGH ITUNES

     

    # CHECK TO SEE IF ITUNES IS OPEN

    tell application "System Events" to set iTunesIsRunning to (name of processes) contains "iTunes"

    if iTunesIsRunning is false then

    return "iTunes is not open"

    end if

    # DON'T REMEMBER WHAT THIS IS FOR

    tell application "System Events"

    set powerCheck to ((application processes whose (name is equal to "iTunes")) count)

    if powerCheck = 0 then

    return ""

    end if

    end tell

    # GLOBAL VARIABLES

    set newline to "

    " as text

    set header to "Now Playing" as text

    # DO STUFF IF ITUNES IS OPEN

    if iTunesIsRunning is true then

    tell application "iTunes"

    # GET INFORMATION WE NEED

    set theURL to the current stream URL as text

    set theStream to the current stream title as text

    if player state is playing then

    # WE ARE LOOKING AT A MUSIC FILE

    if theURL is "missing value" and theStream is "missing value" then

    # WE HAVE A FILE, SO SET BOOLEAN APPROPRIATELY

    set haveFile to true

    # GET THE TRACK DATA

    set sartist to artist of current track

    set strack to name of current track

    set salbum to album of current track

    else

    # WE ARE LOOKING AT A MUSIC STREAM

    # SET THE haveFile BOOLEAN APPROPRIATELY

    set haveFile to false

    # GET THE TRACK DATA

    set stitle to current stream title as text

    set sname to name of current track

    set scategory to category of current track

    # UNSURE IF scategory HAS VALUE SO CHECK AND SET AS NEEDED

    if scategory is "missing value" then

    set scategory to ""

    end if

    set sdesc to description of current track

    # UNSURE IF sdesc HAS VALUE SO CHECK AND SET AS NEEDED

    if sdesc is "missing value" then

    set sdesc to ""

    end if

    if theStream contains "back soon" then

    set theStream to ""

    end if

    end if

    end if

    # IF WE'RE PAUSED, UPDATE THE FOOTER VARIABLE

    if player state is paused then

    set footer to " / paused" as text

    else if player state is stopped then

    # IF WE'RE STOPPED, UPDATE THE FOOTER VARIABLE

    set footer to " / stopped" as text

    else

    # SET TO NOTHING AS IT'S PLAYING

    set footer to "" as text

    end if

     

    # SET THE INFORMATION TO BE DISPLAYED

    if haveFile then

    # INFO FOR THE FILE

    set info to strack & " " & sartist & " " & salbum & footer as string

    else

    # INFO FOR THE STREAM

    if theStream is "missing value" then

    set info to sname & ": " & sdesc & footer as string

    else

    set info to sname & ": " & theStream as string

    end if

    end if

    # RETURN info TO BE DISPLAYED

    return info

    end tell

    end if

     

    Thanks

  8. Hi

    I am currently using this workflow

    http://www.alfredforum.com/topic/202-parallels-desktop-workflow/

     

    It queries Parallels and can resume, start etc VMs. I am sorry I did download it from this forum but cannot get hold of the original author. Unfortunately unless Parallels is running, resuming a VM does not work. Does anyone know what code I need to change to start Parallels (if not already running) to resume a VM? The PHP code snippet is below:

     

    <?php
     
     
    // Main configuration
    $inQuery = $argv[1] ?: '';
    $reUUID = '(?<uuid>\{[\dA-Fa-f]{8}\-[\dA-Fa-f]{4}\-[\dA-Fa-f]{4}\-[\dA-Fa-f]{4}\-[\dA-Fa-f]{12}\})';
    $reList = '/^\s*'.$reUUID.'\s*(?<status>[^\s]+)\s*(?<ip>[^\s]+)\s*(?<name>.*)$/';
    if (($isUUID = preg_match('/'.$reUUID.'/', $inQuery, $tmpData) ? true : false) === true)
    $inQuery = $tmpData['uuid'];
    $supportedActions = array(
    'start' => array('running', 'suspended'),
    'stop' => array('stopped', 'suspended'),
    'reset' => array('stopped', 'suspended'),
    'suspend' => array('stopped', 'suspended'),
    'resume' => array('running', 'stopped'));
    $foundVM = array();
    $results = array();
     
     
    // Read VM lists
    if (exec('prlctl list -a --no-header '.($isUUID ? $inQuery : ''), $output))
    foreach ($output AS $row)
    if (preg_match($reList, $row, $tmp))
    $foundVM[] = $tmp;
     
     
    if ($isUUID)
    {
    // Action lists per VM
    foreach ($supportedActions AS $action => $currentStatus)
    if (!in_array($foundVM[0]['status'], $currentStatus))
    $results[] = array(
    'uid' => $action,
    'arg' => $action.' '.$inQuery,
    'title' => ucfirst($action),
    'subtitle' => $foundVM[0]['name'],
    'icon' => 'icon.png',
    'valid' => 'yes');
     
    if ($foundVM[0]['status'] == 'running')
    $results[] = array(
    'uid' => 'capture',
    'arg' => 'capture '.$inQuery.' --file ~/Desktop/'.str_replace(array(' ', '/'), array('-', '-'), $foundVM[0]['name']).'-'.@date('Ymd-his').'.jpg',
    'title' => 'Capture a screenshot',
    'subtitle' => $foundVM[0]['name'],
    'icon' => 'icon.png',
    'valid' => 'yes');
    } else
    {
    // List of VM matched
    $reRowQuery = '/'.preg_quote($inQuery).'/i';
    foreach ($foundVM AS $vm)
    if (preg_match($reRowQuery, $vm['name']))
    $results[] = array(
    'uid' => $vm['uuid'],
    'arg' => $vm['uuid'],
    'title' => $vm['name'],
    'subtitle' => 'Status: '.ucfirst($vm['status']),
    'icon' => 'icon.png',
    'valid' => 'no',
    'autocomplete' => $vm['name'].' '.$vm['uuid']);
    }
     
     
    // No VM matched
    if (!count($results))
    $results[] = array(
    'uid' => 'none',
    'arg' => 'none',
    'title' => 'No VM found!',
    'subtitle' => 'There aren\'t any VM...',
    'icon' => 'icon.png',
    'valid' => 'no');
     
     
    // Preparing the XML output file
    $xmlObject = new SimpleXMLElement("<items></items>");
    $xmlAttributes = array('uid', 'arg', 'valid', 'autocomplete');
    foreach($results AS $rows)
    {
    $nodeObject = $xmlObject->addChild('item');
    $nodeKeys = array_keys($rows);
    foreach ($nodeKeys AS $key)
    $nodeObject->{ in_array($key, $xmlAttributes) ? 'addAttribute' : 'addChild' }($key, $rows[$key]);
    }
     
    // Print the XML output
    echo $xmlObject->asXML();  
     
    ?>

     

    Thanks

×
×
  • Create New...