Get path to applescript stored on iCloud

0

I wrote a shell script which calls an applescript to do some work. The applescript is in iCloud, so I'm manually writing the path to the document storage location...

 osascript ~/Library/Mobile\\ Documents/com~apple~ScriptEditor2/Documents/safari_get_tab_url.scpt

This is pretty ugly and looks fragile. I'm wonder if there is a cleaner way to get the path to this applescript file?

Dan Poltawski

Posted 2013-11-26T14:35:27.780

Reputation: 101

You can use quotes to cleanup the path for both bash and zsh shells. Depending on version, this will allow the ability to remove the \ before spaces in the path. – Jahhein – 2017-10-13T19:40:48.617

Answers

0

I'm not sure if I understand your question correctly, but how about this:


path to me                                                                      
return POSIX path of the result

Capitainos

Posted 2013-11-26T14:35:27.780

Reputation: 11

0

It's not really that fragile, providing the following is true:

  • The document will always be called the same and won't be renamed.
  • The Bundle ID (com~apple~ScriptEditor2) will not change thus changing the path to the file.
  • iCloud must remain enabled on the account.

Since it's only the first one you'd have to worry about, it seems perfectly fine to do just what you're saying, since a normal path would have the same problem anyway (normal = without any form of linking).

grg

Posted 2013-11-26T14:35:27.780

Reputation: 1 499