Re: Applescript and referring to a folder
Re: Applescript and referring to a folder
- Subject: Re: Applescript and referring to a folder
- From: Thomas Fischer <email@hidden>
- Date: Tue, 26 Jan 2010 20:00:08 +0100
Mit freundlichen Grüßen
Thomas Fischer
Am 26.01.2010 um 16:36 schrieb Luther Fuller:
> I got a copy of TeXShop so I could test this. Here is a script that seems to do what want, according to your original script (above). (But, I'm not sure.)
>
> set destination to alias "OS_X:Users:lutherfuller:Desktop:TeXShop aliases" -- a file system pointer
> tell application "TeXShop"
> repeat with this_document in documents
> try
> (POSIX file (path of this_document)) as alias -- another file system pointer
> tell application "Finder" to make new alias file to the result at destination
> -- creates an alias file in the destination folder
> end try
> end repeat
> end tell
>
> I had to use a 'try ... end try' block in case there was a new unsaved document window open which, of course, has no path. Now, we can discuss why this works, if there are further questions.
Actually, following Mark's advice, it might be clearer to untangle the tell blocks.
As it is, TeXShop will give the path to a document as a POSIX path, so there are no additonal coercions needed.
tell application "TeXShop" to set all_paths to the path of every document
will give you a list of all path, including "missing values" for yet unsaved documents.
Then you can say
set myFolder to choose folder
tell application "Finder"
repeat with this_path in all_paths
try
if this_path is not msng then make new alias file to POSIX file this_path at myFolder
-- creates an alias file in the destination folder
end try
end repeat
end tell
Here msng is a constant that represents the "missing value" you get for unsaved documents.
Cheers
Thomas
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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