Relative file paths with Applescript

I am trying to make Applescript that will open a file on a user computer without knowing the hard drive or username, assuming the file is in the same place in the user directory.

tell application "Finder" to open "/Users/jim/Dropbox/Getting Started.pdf" as POSIX file

works great and

tell application "Finder" to open "~/Dropbox/Getting Started.pdf" as POSIX file

not executed.

Is there any way to make this simple?

+4
source share
1 answer

AppleScript , POSIX URL-. URL- , . POSIX - , . , :

tell application "Finder" to open (POSIX path of (path to home folder)) & "Dropbox/Getting Started.pdf" as POSIX file
+11

Source: https://habr.com/ru/post/1544072/


All Articles