How to use Execute Command?

Post Reply
User avatar
TheCaptain
Member
Posts: 86
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

How to use Execute Command?

Post by TheCaptain »

Another day, another part of Switch I know nothing about! :lol:

I have a Script saved down appropriately with the following :

#!/bin/bash
growlnotify -H 192.168.XXX.XX -t "Notice" -m "COMPLETE" -P password


Which runs perfectly if called in Terminal. But how do I get the Switch 'Exectue Command' to set it in motion? I'm failing hard on this one :oops:

Any pointers gratefully recieved :idea:

Name :
Description :
Execution mode :
Command or path :
Arguments :
Output :
Fail if exit code is :
Fail if stdout contains :
Fail if stderr contains :
bens
Advanced member
Posts: 282
Joined: Thu Mar 03, 2011 10:13 am

Re: How to use Execute Command?

Post by bens »

How are you setting up the Execute command, and which error are you getting?

You may need to fix the path to the script, or point Execute command to bash with the script as parameter (I think it's the -c option for bash).
User avatar
TheCaptain
Member
Posts: 86
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Re: How to use Execute Command?

Post by TheCaptain »

I've had the below in the 'Command or path' section :

Code: Select all

/Users/Studio/Documents/Storage/050-HDD Add-on/Switch-SCRIPT/Notify
In the layout as here :
Screen Shot 2016-09-20 at 14.39.43.png
Screen Shot 2016-09-20 at 14.39.43.png (24.01 KiB) Viewed 12245 times
But it doesn't trigger anything to run.
User avatar
TheCaptain
Member
Posts: 86
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Re: How to use Execute Command?

Post by TheCaptain »

Sometimes Switch throws up this error :

Message: Job failed because outcode is nonzero, outcode = [127]
loicaigon
Advanced member
Posts: 633
Joined: Wed Jul 10, 2013 10:22 am

Re: How to use Execute Command?

Post by loicaigon »

If you don't care about the return code, you can choose t simply ignore it. Otherwise you can set the error code to be ≠ from 127 so this code deosn't raise an error.
Loic
Loïc Aigon
Enfocus PitStop Manager
User avatar
TheCaptain
Member
Posts: 86
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Re: How to use Execute Command?

Post by TheCaptain »

I've managed to ignore the error.

But not invoke the Script! :evil:
Chris De Clercq
Newbie
Posts: 1
Joined: Wed Sep 21, 2016 5:02 pm

Re: How to use Execute Command?

Post by Chris De Clercq »

Hi Captain,

Please check the following link:
http://qwephotos.com/2013/10/batch-enco ... -mac-os-x/

Probably adding the path where the application is located, this will resolve the problem.
Let us know if this was helpful! ;)

Greetz

Chris De Clercq
Lab9 - Belgium
User avatar
TheCaptain
Member
Posts: 86
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Re: How to use Execute Command?

Post by TheCaptain »

Thanks for that link. Not entirely sure whether I've done exactly what your guide stated but here's how I found a 'solution'. This is FAR from elegant, and I'm hoping somebody picks it apart and explains why I've had to run one script, to then run another!

However, it does mean that I can use Switch to produce executable .TXT files with Variables on a whim without changing the original 'Action' Script.

The Execute Command has been set up :
Name :
Description :
Execution mode : Concurrent
Command or path : /Users/Studio/Documents/Switch Storage/050-HDD Add-on/Switch-SCRIPT/NotifyV02
Arguments :
Output :
Fail If exit code is : Nonzero
Fail If stdout contains :
Fail If stderr contains :

The contents of NotifyV02 :

Code: Select all

#!/bin/bash 
cd /Users/Studio/Documents/Switch\ Storage/050-HDD\ Add-on/Switch-SCRIPT/
open Notify
The contents of Notify :

Code: Select all

growlnotify -H 192.168.XXX.XX -t "Notice" -m "COMPLETE" -P password
Post Reply