I couldn't find any clue why the following would not work, hence I finally made the switch from being a silent reader and signed up…
I'm trying to run the following macro on my iA writer folder within icloud. When using it with a local or dropbox path everything works fine — if I use ~/Library/Mobile Documents/27N4MQEA55~pro~writer/Documents/ I get a "No such file or directory." error even though I can manually cd into the above directory and run the ls command. Do you guys have any hints or workaround?
cd ~/Dropbox/zettelkasten
ls -t | sed -e 's/.[^.]*$//'
which will be inserted into:
[[%Variable%tmp%]]
In case anyone wonders: the macro is needed in conjunction with the archive to provide a typeahead functionality in order to link to notes more easily.
…it must have been the space in Mobile that caused trouble. I could have sworn I had checked it when trying but obviously must haved missed something. Now it works like a charm. Thanks again
If you're running from an Execute a Shell Script action then spaces must either be quoted or escaped.
Quoted:
You can quote just the portion of the path that has spaces in it, but I tend to quote the whole path:
Regular Posix Path:
ls '/Applications/Applications_Chris/Audio Visual Apps'
Tilde-based path:
ls ~/'Library/Mobile Documents/'
ls ~/'Library/Mobile Documents/8HSTZV64A5~com~acqualia~soulver/Documents'
** Note that the ~/ prefix MUST NOT be contained in the quotes! Because the shell will consider it a literal string and NOT expand it to the user's home directory.
Escaped:
ls ~/Library/Mobile\ Documents/
ls ~/Library/Mobile\ Documents/8HSTZV64A5~com~acqualia~soulver/Documents
Strangely, I got this to work yesterday after a lot of trying and even put it into another macro with the same base file path and modifying the ending to go to another folder, and that worked leaving me to think I’d cracked the code.
No such results today. Today I’m back to the /Users folder.
Even stranger, this path:
/Users/bernshanfield/Library/Mobile Documents/com~apple~CloudDocs/Documents/R/Records Yearly/Records 2023/01 Jan Recs
Works from within a macro while
/Users/bernshanfield/Library/Mobile Documents/com~apple~CloudDocs/Documents/E/Existence for Items/Not Now
Does not. The second macro is just a duplicate of the first with the file path edited.
When you paste paths be very careful to not alter them – it's all to easy for your fingers to do the walking and introduce an error that's hard to see.
You can also drop strings into BBEdit and turn on “Show Invisibles” to see if there's anything weird going on.
I modified your macro to pause longer after inserting text into the Go To window and then a type Return as there is no Save button in my Go To dialog.
I then have a Pause until Save button step. Here's where it gets weird.
The sequence stops at the Go To window with the correct path pasted in. I've disabled all the following steps.
When I manually press the return key, the save dialog goes to the correct location BUT then pastes the path from the Insert Text step into the Save As field all by itself without any steps enabled in the macro sequence.
It's like there is some unseen buffer holding something and then activating on its own. There must be something being held that needs to be cleared.
With Monterey and Ventura, I have had strange things like this happen with ⇧⌘G Go To Folder, when pasting the path rather than typing the path.
So, here is my sequence of Actions to do this in Monterey and Ventura with the only real difference from what you are trying, being "typing" text rather than "pasting" text.