-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to import/export files with shortcuts? #74
Comments
Hi, The long answer is that Shortcuts running "In Extension" and Shortcuts running "In App" are, from Apple's point of view, two different applications, with two different |
Thank you! Got it all sorted out with Importing/Exporting. After I did an import with Shortcuts, I did an “ls $SHORTCUTS” and saw the file. |
Hi @holzschu I am trying to do the following:
Steps 1, 2, and 3 are easy. I am running Step 2 (Execute shell command In the App) as Python does not run otherwise. I am not sure how best to do step 4. One option is to redirect the output of Python to a temporary text file, read the text file via Get File and then display the output in alert/quick look. Other option would be to get stdout directly from the executed path. I don’t have any clue about the latter. Regarding the former, I am getting stuck. I am able to create the temp text file but unable to read it back in shortcuts. The following is an image of the shortcut. The following is the link to the shortcut: https://www.icloud.com/shortcuts/76a296293d3749cf9aab2b647734e437 The following is the content of factrial.py import math
import sys
print(sys.argv)
num = int(sys.argv[1])
print(f"The factorial of {num} is {math.factorial(num)}") My questions:
|
I think you need to add "open shortcuts://" to the list of commands to get back to the Shortcuts app once all commands are executed in the a-Shell app. Once you're there, either "cat temp.txt" executed in extension or get File should work. We get the stdout of all shell commands executed in Extension in shortcuts, but for commands executed in App (as all those that use Python), we need the "open Shortcuts://" to get back to Shortcuts. |
Thanks @holzschu I got it to work :) I wrote about it here: https://nipunbatra.github.io/blog/setup/2021/06/14/setup-ipad.html#shortcuts Is there an easier way? Also, I had to add the delay of 1 second. Otherwise, sometimes it didn’t work for me as “temp.txt” would not be found. |
I don't think there's an easier way. Shortcuts that run "in Extension" don't get access to the files in app main dir, so "open Shortcuts://" is the best way. You could probably wait in the app instead of in the shortcut, with "sleep 0.1" before "open Shortcuts://". |
I use pbcopy and get the result back in the clipboard.
…On Tue, Jun 15, 2021 at 6:13 AM Nicolas Holzschuch ***@***.***> wrote:
I don't think there's an easier way. Shortcuts that run "in Extension"
don't get access to the files in app main dir, so "open Shortcuts://" is
the best way. You could probably wait in the app instead of in the
shortcut, with "sleep 0.1" before "open Shortcuts://".
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLDPSDDFPEM7EHDODJP5STTS4RUBANCNFSM4N4VWU7Q>
.
|
Thanks, this is super useful. I have modified my post to include the pbcopy based version too. Post: https://nipunbatra.github.io/blog/setup/2021/06/14/setup-ipad.html#shortcuts I am pasting the images here as well in case anyone wants to use Using pbcopyUsing files |
… On Tue, Jun 15, 2021 at 7:57 AM Nipun Batra ***@***.***> wrote:
Thanks, this is super useful. I have modified my post to include the
pbcopy based version too.
Post:
https://nipunbatra.github.io/blog/setup/2021/06/14/setup-ipad.html#shortcuts
I am pasting the images here as well in case anyone wants to use
Using pbcopy
[image: Shortcut-2]
<https://user-images.githubusercontent.com/60985/122048299-b4954200-cdfe-11eb-897a-7372806ca5c1.png>
Using files
[image: Shortcut-Working]
<https://user-images.githubusercontent.com/60985/122048341-beb74080-cdfe-11eb-9fd2-ce3174581777.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLDPSBBR5JLDTNRCERTUHTTS4523ANCNFSM4N4VWU7Q>
.
|
I feel as though I've been down this path before but how do I do a Get File from a Shortcut and get back a file that is in the apps directory? |
Is there any chance of getting a shortcut command "wait for a-shell commands to finish"? I'm using a-shell to run scripts that download files that take between seconds and minutes. |
If I understood the question correctly, you can do that by launching a set of commands with Shortcuts: first, your download command, then "open shortcuts://" to go back to Shortcuts and continue the shortcut execution. |
Hi, I’m new to a-Shell and am currently having trouble transferring files in and out of the app using shortcuts.
For exporting a file out I’m using the a-Shell ‘Get File’ action, followed by Apple’s Save File action. However this results in an error saying the file could not be found.
For importing a file into a-shell I’m using the Apple Get File action followed by the a-Shell ‘Put File’ action. This completes without error, however I don’t see the file in a-Shell when doing an ‘ls’.
What am I doing wrong?
Also, I think it would be great if there was some in-depth documentation explaining how to get a-Shell specific tasks completed.
Thanks!
The text was updated successfully, but these errors were encountered: