Re: Finding a file
Re: Finding a file
- Subject: Re: Finding a file
- From: Stan Cleveland <email@hidden>
- Date: Thu, 30 Mar 2006 16:15:50 -0800
- Thread-topic: Finding a file
Title: Re: Finding a file
On 3/30/06 12:03 AM, email@hidden wrote:
Is there an AppleScript way of finding a file on your hard drive or do you have to do it via shell script?
This comes back to the issue I stated in my last email where FreeHand won't give me the file path of document 1, but I can get the name of document 1. I'd then like to have Finder search for the name (local computer only) then test to see if it is busy/open.
Reconsider, if you will, Freehand’s own DocReport command. Here’s the code that generates the report and extracts the path to document 1 from it:
set fhDocPath to getFreehandDocPath()
on getFreehandDocPath()
tell application "Finder"
set reportPath to ((path to temporary items) as text) & "fhReport.txt"
end tell
tell application "FreeHand MX"
if (exists document 1) then
DocReport in file reportPath
else
return ""
end if
end tell
-- extract document path from the report
tell application "Finder"
return text 12 thru -1 of paragraph 4 of (read file reportPath)
end tell
end getFreehandDocPath
This puts the report file in the temporary items folder, so you can just leave it and it will go away on its own. If you run this multiple times, each new report will just overwrite the existing one. Obviously if no Freehand document is open, the handler returns an empty string.
Unlike searching your local drives for a busy file with the correct name, this is nearly instantaneous and painless.
Stan Cleveland
Color Technology Inc.
Portland, Oregon
"Two's company, three's a crowd."
-- Translation from the Yoda-to-English phrasebook, for "Always two there are, no more, no less: a master and an apprentice."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Finding a file (From: Brett Conlon/HU/AU/SonyDADC <email@hidden>) |