Replies: 14 comments 17 replies
-
Make sure your Shortcut is returning data. On iOS by default, it always returns whatever is at the end of your Shortcut. However, on the Mac you need to use the "Stop and Output" action to return data. |
Beta Was this translation helpful? Give feedback.
-
First, I guess I didn't even realize the BTW, you can run a shortcut with Also, you can get the contents of the clipboard into a variable with:
Which would smooth out your workaround in case you can't actually get data back through the command line utility. |
Beta Was this translation helpful? Give feedback.
-
So according to the |
Beta Was this translation helpful? Give feedback.
-
The $ ~ TEST=$(shortcuts run "TestAppleScript")
$ ~ echo $TEST
Hi |
Beta Was this translation helpful? Give feedback.
-
Oh that's so weird that it will populate a variable but not actually output to STDOUT. (Seriously, try running |
Beta Was this translation helpful? Give feedback.
-
Ok, I was able to get a response within Bunch, so the new syntax will allow:
I'll have a new beta (151) out with this addition in a little bit. |
Beta Was this translation helpful? Give feedback.
-
You're not on the beta. All of this is only available in beta 151.
…-Brett
________________________________
From: Younghart ***@***.***>
Sent: Sunday, August 7, 2022 12:45:40 PM
To: ttscoff/bunch ***@***.***>
Cc: Brett Terpstra ***@***.***>; Comment ***@***.***>
Subject: Re: [ttscoff/bunch] Getting results back from Shortcuts (Discussion #241)
In any event, all this is by no means urgent. I'm just over the moon that you consider a feature request by me as valid. Have a great Sunday, and most of all: Thanks 4 Bunch!
—
Reply to this email directly, view it on GitHub<#241 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAALVWO5VZNV6BX7ABYLSRLVX7Y4JANCNFSM552QL5BQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Does running the command without the variable assignment work? Just the:
(shortcut bunchtest)
part? Realizing that no other commands return values and I probably haven't set the regexes up to recognize this yet.
…-Brett
________________________________
From: Younghart ***@***.***>
Sent: Sunday, August 7, 2022 2:06:54 PM
To: ttscoff/bunch ***@***.***>
Cc: Brett Terpstra ***@***.***>; Comment ***@***.***>
Subject: Re: [ttscoff/bunch] Getting results back from Shortcuts (Discussion #241)
In between my many posts today, I did actually switch to Bunch beta, updated it and ran with it. This first try is with 1.4.10 (151). Apologies for not making that clear.
—
Reply to this email directly, view it on GitHub<#241 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAALVWPFPZFYF4S32UJWXTTVYACM5ANCNFSM552QL5BQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Beta 154 fixes the variable assignment with command issue.
…On 7 Aug 2022, at 14:36, Younghart wrote:
Aha, different results! It works, though not in the right order. My
Bunch:
projectname = test9876
(shortcut bunchtest)
projectadjusted = ?"What's the result? (Hint: ${projectname})"
Result: Pop-up window for text entry (appears twice) with "Hint:
test9876"
Afterwards, the shortcut is executed, and a result appears in the log
(and the clipboard). Log:
2022-08-07 21:30:20: ⚪[shortcuts-test] Open
>>>>>>>>>>>>>>>>>>>>>
2022-08-07 21:30:49: ⚪[shortcuts-test] Processing command
"shortcut bunchtest"
2022-08-07 21:30:49: ⚪[shortcuts-test] Running shortcut
bunchtest
2022-08-07 21:30:49: ⚪[shortcuts-test] Shortcut response:
2022-08-07T21:30:49+02:00
Hope this helps …
--
Reply to this email directly or view it on GitHub:
#241 (reply in thread)
You are receiving this because you commented.
Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Yeah, dialogs will always execute before commands, a consequence of the
way I parse the Bunch. Queries are parsed first, so that optional
snippets they cause to be included can be parsed at the same time as
everything else. I may look into that again at some point.
When you say the "folder" has a question mark, do you mean the return
value of the shortcut? Where are you seeing it, specifically?
…On 8 Aug 2022, at 7:09, Younghart wrote:
Awesome!
Here's what I did to test it with ß155:
I made a shortcut to create a folder from text it has received via
quick action. It adds the folder's name to the clipboard, stops and
returns the folder name:
![beta155_shortcut](https://user-images.githubusercontent.com/2934471/183411590-a64d0023-8157-401b-a8dc-9b4ed8cb32dc.png)
The accompanying Bunch looks like this:
---
title: Test Shortcuts
toggles: false
---
projectdraft = "0123"
projectname = (shortcut new Project folder
"test_folder_${projectdraft}")
pboardcontent = $ pbpaste
TextEdit ~5
- /Users/immo/Documents/Bunches/bunchtestlog.txt
projectadjusted = ?"What's the result? (Hint: ${projectname} or
${pboardcontent})"
Result:
The interactive part always gets precedence, so it can't receive
content from the shortcut. Actually, whatever I do, the shortcut
always finishes last. This is an interesting caveat and might be worth
mentioning in the Docs. But maybe this is just my Mac, another
localization issue, or humidity-related.
The shortcut itself works and even receives the text sent to it,
including a previously defined variable.
One small **bug**: The folder name ends with an additional question
mark – relic of a non-standard character that got somehow sent to
the shortcut?
Log:
2022-08-08 13:55:39: ⚪[shortcuts-test] Open
>>>>>>>>>>>>>>>>>>>>>
2022-08-08 13:55:43: ⚪[shortcuts-test] Running shortcut new
Project folder
2022-08-08 13:55:44: ⚪[shortcuts-test] Adding 5s delay to
(TextEdit)
2022-08-08 13:55:49: ⚪[shortcuts-test] Opening file
/Users/immo/Documents/Bunches/bunchtestlog.txt with app TextEdit
tl;dr: **Getting data to and from shortcuts works in ß155**
--
Reply to this email directly or view it on GitHub:
#241 (reply in thread)
You are receiving this because you commented.
Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Fixed, try beta 160. Also, if you're updating from 158 or later the autoupdater should be working again. |
Beta Was this translation helpful? Give feedback.
-
Awesome, glad it's working!
…-Brett
On 8 Aug 2022, at 15:19, Younghart wrote:
Wow. Just … wow.
This opens so many opportunities!
Bunch can feed data into shortcuts, even interactively, and get
results back.
I tested a data round trip with this Bunch:
---
title: Test Shortcuts
toggles: false
---
# $ /usr/bin/shortcuts run "new Project folder"
projectdraft = ?"What's the project's name?"
projectname = (shortcut new Project folder
"test_folder_${projectdraft}")
TextEdit ~5
- /Users/immo/Documents/Bunches/bunchtestlog.txt
Finder ~7
- /Users/immo/Documents/${projectname
The Shortcut looked like this:
![CleanShot 2022-08-08 at 22 11
13](https://user-images.githubusercontent.com/2934471/183505610-f15887e2-8152-4c16-9660-b4db30684049.png)
}
The whole thing works flawlessly, the folder is interactively named,
the folder name makes the trip back to finally visit the newly created
folder via Bunch.
Thank you, this will prove to be amazing!
--
Reply to this email directly or view it on GitHub:
#241 (reply in thread)
You are receiving this because you commented.
Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
The only thing I can think of is that in order to close the STDIN pipe
that passes the input, I have to add a newline at the end. It's possible
this is being interpreted as a garbage character by Shortcuts, though in
my testing I was able to pass in a string and pass it right back out,
and what I got back was trimmed. Though, now that I say that out loud, I
think Bunch might be doing the trimming...
I'll experiment a little further with it.
…On 8 Aug 2022, at 10:58, Younghart wrote:
Ah, very well. That's something I can get behind.
The "?" appears at the end of the folder name, so it's getting passed
into the shortcut – or is interpreted from the shortcut as such:
![CleanShot 2022-08-08 at 17 57
30](https://user-images.githubusercontent.com/2934471/183461095-57a20aae-0577-4e44-abad-d3da4d31df48.png)
.
--
Reply to this email directly or view it on GitHub:
#241 (reply in thread)
You are receiving this because you commented.
Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Yep, it was the newline. Found a workaround, new build will be out
shortly.
…On 8 Aug 2022, at 10:58, Younghart wrote:
Ah, very well. That's something I can get behind.
The "?" appears at the end of the folder name, so it's getting passed
into the shortcut – or is interpreted from the shortcut as such:
![CleanShot 2022-08-08 at 17 57
30](https://user-images.githubusercontent.com/2934471/183461095-57a20aae-0577-4e44-abad-d3da4d31df48.png)
.
--
Reply to this email directly or view it on GitHub:
#241 (reply in thread)
You are receiving this because you commented.
Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
is there a way to run a shortcut and get the result back, e.g. to define a variable?
What I'd wish for would be something like
or something similar involving one or more less-than, greater-than, or pipe symbols.
My workaround right now is to add a "copy to clipboard" action to my shortcut and finagle it into the Bunch process the following way:
Has anybody found a more elegant solution?
Beta Was this translation helpful? Give feedback.
All reactions