Run Shell Script action exited with error 64

Posted on
Tue Aug 08, 2023 8:37 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Run Shell Script action exited with error 64

I'm trying to run a shell script to run a shortcut and then return the output of that into a variable by running the command:

/usr/bin/Shortcuts run "Get Current Focus" | cat

Now when I run that in terminal I get:

Personal%

or

Work%

Or whatever the current focus mode is set to.

But when I run it within Indigo I'm getting:

Run Shell Script action: script /usr/bin/Shortcuts exited abnormally with a return code of: 64

Now I presume it's something to do with the % that is being added onto the output (Which doesn't appear when run within Shortcuts itself) so I presume I need to parse this out, but I'm drawing a blank on how to do this (or indeed am I barking up the wrong tree?).

Any ideas? :)

Computer says no.

Posted on
Tue Aug 08, 2023 10:25 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Run Shell Script action exited with error 64

Why are you piping it into 'cat'? I don't think you want to do that.

I expect the % is your command prompt. The script is probably not outputting a newline, so the command prompt just ends up right after the output.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 08, 2023 11:27 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Run Shell Script action exited with error 64

I was piping it to cat as that was the only way I could find that’d generate an output for me to feed through to a variable. Without it it just runs the shortcut with no response.

Is there a better way to get the response into a variable without the %? Alas this is not something I have much experience with so just trying to figure out options.


Sent from my iPhone using Tapatalk Pro

Computer says no.

Posted on
Tue Aug 08, 2023 11:41 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Run Shell Script action exited with error 64

Ignore the %, it's not going to show up anywhere other than on the command line in the terminal. If you pipe that shortcut to something else, it won't be there.

HOW are you trying to get this into an Indigo variable?

Show the shortcut, please.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 08, 2023 2:00 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Run Shell Script action exited with error 64

The pipe is likely the problem. You need to add a Stop and output Text action at the end of your shortcut. That should return whatever value the previous shortcut step produced.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Aug 08, 2023 2:19 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Run Shell Script action exited with error 64

jay (support) wrote:
The pipe is likely the problem. You need to add a Stop and output Text action at the end of your shortcut. That should return whatever value the previous shortcut step produced.


That was exactly what I was trying to test, but I'm getting no output.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 08, 2023 6:18 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Run Shell Script action exited with error 64

So it’s a pretty simple affair at present. Here’s the action in Indigo (run shell script command)

Image

And here’s the shortcut:

Image

Naturally at the moment it’ll only return personal but I can flesh it out later once I’ve got the concept working. Ultimately what I want is to get the current focus mode into indigo as a Variable so I can write little python scripts to do different things on triggers based on the current mode.

I’m open to any thoughts on more efficient ways of doing this too.


Sent from my iPhone using Tapatalk Pro

Computer says no.

Posted on
Tue Aug 08, 2023 8:00 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Run Shell Script action exited with error 64

Did you read my post above and try that shortcut modification I recommended?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 09, 2023 4:02 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Run Shell Script action exited with error 64

jay (support) wrote:
Did you read my post above and try that shortcut modification I recommended?
Oops sorry completely missed your reply!

Just tried it and that works. In fact I was able to simplify the shortcut to just get focus and then stop and output to focus name, and now it’s working exactly as I wanted!

Thank you both!


Sent from my iPhone using Tapatalk Pro

Computer says no.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests