Applescript and referring to a folder
Applescript and referring to a folder
- Subject: Applescript and referring to a folder
- From: Rowland McDonnell <email@hidden>
- Date: Mon, 25 Jan 2010 09:04:46 +0000
I'm trying to write an Applescript that'll create aliases to all
documents currently open in TeXShop (<http://www.tug.org/mactex/2009/>).
I've managed to cobble together something really horrible that
does the job, but I can't persuade it to make the aliases I want
anywhere but my Desktop folder.
What I'd like it to do is to create the aliases in:
~/TeXShop aliases/
which I've already created for the sake of a simpler script.
(or perhaps in a user-selectable folder)
Here's the script, below - can anyone suggest a way to do what I
want? And maybe a less ugly way of achieving what I've done so far?
------------------------------------------------------------------
tell application "TeXShop"
repeat with this_document in documents
set this_documentX to path of this_document as string
set this_documentM to this_documentX
tell application "Finder"
make new alias to POSIX file this_documentX
end tell
end repeat
end tell
------------------------------------------------------------------
I got some of the code from an Applescript tutorial about using
Unix style paths in Applescript - it works, but it's obviously
not the best way. I just couldn't find out how to work with a
reference to a folder or file using the `normal' Applescript methods.
I've tried reading on-line tutorials and manuals, and I've tried
constructions like this to tell Applescript about the folder I
want to use:
-------------------------------------------------------
set selected_folder to folder "TeXShop_aliases" of home
-------------------------------------------------------
which seems pretty uncontroversial to me - but I get:
Syntax Error
Expected end of line, etc. but found """.
So the code I think ought to do what I want:
-------------------------------------------------------
make new alias at folder_path to POSIX file this_documentX
-------------------------------------------------------
never gets a chance to execute.
Rowland.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden