I have hook files that represent projects. Each contains just one hook, linked to the main project folder on my machine.
to archive this folder, I need to access it through AppleScript.
Example:
project name is PROJ1
I have a hook file named PROJ1.hook
which contains a hook of the form:
hook://file/blabla?p=blabla&n=PROJ1
If I copy past this URI in Safari, it opens a folder called PROJ1
somewhere on my hard drive.
So far, so good.
I need to get the path of the folder in AppleScript, in order to move it to my archive repository.
This is what I have (argv contains the path to the hook file itself - i’m passing it from Alfred)
set theHookFile to POSIX file ((item 1 of argv) as string)
tell application "System Events"
set theHook to read theHookFile
end tell
tell application "Hook"
-- get the folder that's referenced by the hook
set theBookmark to the bookmark whose address is theHook
set theHookPath to the posixPath of theBookmark
end tell
which fails telling me:
Can’t get bookmark whose id of it = "hook://file/blabla?p= blabla&n=PROJ1".
Which is weird, because I thought I’d just confirmed that there is indeed a bookmark with that address … I’m probably doing something illegal in AppleScript, but I havent been able to figure out what…
thanks for any help!
Paul