Outliner with drag/drop reordering - part 2
@ccc thanks for the advice
@cvp There still seems to be the problem where the end of the second line of an item becomes part of the beginning of the next item when I view any of the dates. I can send screenshots if that helps.
Version V01.29 - correction of bug "when an outline date is displayed, the height of multiple lines rows is still incorrectly computed"
Feed back hoped
Thanks! That fixed the problem. I was wondering if there was a way that I could write a shortcut which added an item to an outline much the way the share sheet can. The shortcut could put something in the clipboard but in order from the current script to add that, it looks to see if the script is running from the share sheet (appex). Is there a way to signal that the script is running from a shortcut (perhaps an additional parm)?
- the name of The outline file
- something identifying that the program is started by a shortcut having stored the text in the clipboard.
Remember that the 2nd (optional) argument is the folder where to find the outline if not in the default one...
We could use an optional special character in front of 1st argument, like @ToDo specifying that comes from a shortcut, or put a special character alone as 2nd argument
Version V01.30 - correction of bug "when we add a new row by passing its text via the share sheet, this new row did not have a creation date"
Please read also previous post and decide how you prefer to warn the script that it has to add a row with the text in the clipboard.
It could be with
1st argument = outline name
2nd argument = CLIPBOARD word in place of a folder
1st argument = ©outline name
Don't forget that when you go via the share sheet, the program can close it-self and disappear.
But when you open Pythonista via an url, I could close the outline file, but do you want I also abort Pythonista to fall in the iDevice home screen?
@cvp I can’t think of a strong reason to pick between options one and two but I would lean slightly toward one because it seems a bit more intuitive.
You mentioned a good point, the shortcut would need to be able to add to the outline “quietly“. As with the Share sheet and Run Pythonista Script, the script runs without showing anything on the screen. Given that the Share sheet method can take 20 sec to run, I wonder if the Shortcut will timeout.
the shortcut would need to be able to add to the outline “quietly“. As with the Share sheet and Run Pythonista Script, the script runs without showing anything on the screen. Given that the Share sheet method can take 20 sec to run, I wonder if the Shortcut will timeout.
If a script runs Pythonista through its url scheme, Pythonista will appear, run and, I could call Shortcuts afterwards but with which shortcut?
@cvp I may be mistaken but if you return to Shortcuts (no particular shortcut specified) the shortcut that was running or just continue from there.
Version V01.31 - support run mode to add a row with text pasted from Clipboard by Pythonista url scheme with arguments outline_name CLIPBOARD. Short run without opening full View and ending with opening Shortcuts app
Please try different modes
- normal run
- share sheet mode with shared text
- shortcut mode passing text via clipboard and calling Pythonista url scheme with
1st argument = outline name
2nd argument = CLIPBOARD word
Share sheet and clipboard mode should be short quick modes, without displaying an ui.View
And surely feed back hoped because last mode is not so easy (for me)
This post is deleted!last edited by
@cvp I tested all 3 modes and they work fine. However, the Shortcut will not work from the watch. It says “could not open app for them URL scheme “Pythonista” because the app is not installed on this device “.
Shortcut will not work from the watch. It says “could not open app for them URL scheme “Pythonista” because the app is not installed on this device
Normal, Shortcuts app is very limited on the watch. Anyway, you don't have any clipboard on the watch, so...what could you hope to do on the watch even if shortcut was authorized?
Édit: Perhaps you know Pyto shortcuts action "run Pyto code"? Doc says
Run Code will execute the given code with the given arguments. Can be executed in app or without leaving Shortcuts.
I've tried a little shortcut with only this action and a very short script:
path = '/var/mobile/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents/a.txt' with open(path, mode='at') as fil: fil.write('test')
And I have executed this shortcut on my Apple Watch and it works...
Thus, you could execute a short Python code on your Apple Watch without opening Pyto on your iPhone. I did not try all but I think that you can only access a file in the ICloud Drive/Shortcuts folder, not in the Pythonista ICloud folder. I also tried to write on a private folder in iCloud Drive: ok on my iPad, not authorized on my watch.
Thus, assume that your outlines are stored in the Shortcuts folder (why not?), with a more complex script (converted from Pythonista to Pyto), you could (perhaps, to be tested ) append a line to an outline file.
Of course, the text could not be added to the clipboard by the watch. But you can imagine you type/say the text into your watch. Your watch could even ask you which outline you want to append.
The script will check in the dir if the file exists, open it in append and write the wanted text.
Not sure it could be useful.
@cvp i dont think it matters since the pythonista url will fail on the watch but I’m not sure what you mean when you say there is no clipboard on the watch. The Shortcut I execute from the Watch asks for input and sets the clipboard and then opens the Pythonista URL with that clipboard as an arg. If I could tell it to run the URL on the phone, then maybe it would work.
Anyway, your pyto idea is good
if I could tell it to run the URL on the phone,
your pyto idea is good
But you would have to store your outlines in the iCloudDrive/Shortcuts/your folder/ folder.
If you don't like it, I will not develop the shortcut and its Pyto script
@cvp That is where I store them (in order to have access from all my iDevices).
@ihf I thought that you stored them in Pythonista iCloud
Can I have the exact folder of your outlines?
@cvp My error. Yes, they are in the Pythonista 3/Outlines (iCloud) folder
@ihf In this case, unfortunately, a shortcut running on an Apple Watch will not access the outlines.
But if you decide to use iCloudDrive/Shortcuts/Oulines as base folder for your outlines, an Apple Watch shortcut could be done for appending a text in an outline, without disturbing the other tasks (I think, not tested)
@ihf I have written a shortcut and its included Pyto code to:
- display a list of outlines in iCloudDrive/Shortcuts/Outlines folder
- ask the user to select one
- ask the user the text to add at end of outline
- add a row to the outline
- save the outline with same name
I keep the same name because the script would not be authorized to modify the outline.prm file with an eventual modified file name because this .prm file is local to Pythonista folder.
Thé script does not update the 2022 event's notes with the new content (used by Apple Watch shortcut to display an outline).
As is, the shortcut works on my iPad, but not on my Apple Watch, without any explanation as usual, during execution of Pyto code. I guess that something of the Pyto code is not authorized in the Watch.
Édit: on my watch, I get an error "impossible to listen to the last recorded vocal message", very helpful 😂
@ihf I don't understand how but the last action of my shortcut was "listen to last recorded vocal message". I guess I added it but not voluntarily.
OF COURSE, I removed this action but the shortcut does not work yet...on my watch
On my watch, the action "get folder content" returns nothing in place of the list of files as it does on iPad.