Re: Finding a file
Re: Finding a file
- Subject: Re: Finding a file
- From: Brett Conlon/HU/AU/SonyDADC <email@hidden>
- Date: Fri, 31 Mar 2006 11:30:14 +1000
BRILLIANT!!! Just BRILLIANT!!!
Many thanks, Stan. It truly is a painless
solution.
I have other plans also for this script
now. 8-}
Cheers,
Coj
Stan Cleveland <email@hidden>
Sent by: applescript-users-bounces+brett.conlon=email@hidden
31/03/06 11:15 AM
|
To
| "email@hidden"
<email@hidden>
|
cc
|
|
Subject
| 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
_______________________________________________
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