Re: Detecting Launched Applet
Re: Detecting Launched Applet
- Subject: Re: Detecting Launched Applet
- From: Matthew Smith <email@hidden>
- Date: Tue, 11 Dec 2001 00:57:06 +1100
on 11/12/2001 00:42, email@hidden at email@hidden wrote:
>
I have an intersting problem that I've encountered. I have an applet that is
>
in the Startup Items folder (OS 8.6 and 9.1). It runs everytime the system
>
boots. On occassion, I need to run it manually. For reasons that aren't
>
important to this problem, I need to detect whether the script has been
>
launched on startup of the computer or manually by the user.
>
>
Currently, I do this by checking to see if the applet is the current Finder
>
selection (i.e. it was double-clicked, so it was launched by the user). That
>
works fine, except it will fail if the script is run from an alias or from
>
the recent apps menu in the Apple Menu, for example.
Split it into two parts, the applet which does all the work, and an applet
that runs it. The latter applet would be put in the startup items folder.
You would then create another applet which runs the first applet. This one
would be used when you want to run it on demand. To detect which one
initiates the main script you could pass a parameter to it. The value would
be different from each initiating script.
You may also want your script to remove the alias placed in the recent
applications folder.
--
Matthew Smith