Re: detect launch of file?
Re: detect launch of file?
- Subject: Re: detect launch of file?
- From: Jolly Roger <email@hidden>
- Date: Tue, 13 Mar 2001 12:45:42 -0600
- Replyto: email@hidden
on 3/12/01 11:45 AM, Phil Calvert (email@hidden) wrote:
>
Is there any way (via applescript) to detected the launch of a file? I want
>
an applescript to do something only if a certain file type is launched.
Hi Phil,
In the future, it would help avoid confusion if you would use the correct
terminology. You don't "launch" files, you "open" them. Also, you should
refer to applications as "applications" or "application files", not "files".
If you just want to detect when a certain application launches, you will
need to monitor the running "processes", as Bryan <email@hidden> has
already shown:
on idle
tell application "Finder"
if name of processes contains "SimpleText" then
--do your stuff here
tell me to quit
end if
end tell
return 1
end idle
If you want to know when a particular "file" is open (not an application,
but a simple file), then that will be harder to accomplish. You *may* be
able to detect it by checking the opened state of the file periodically; but
I doubt that functionality exists in plain vanilla AppleScript; so you'll
probably need to use a scripting addition.
HTH
JR