Re: Prevent this double dialog
Re: Prevent this double dialog
- Subject: Re: Prevent this double dialog
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 26 Sep 2004 08:36:32 -0700
On 9/26/04 7:37 AM, "Gnarlodious" <email@hidden> wrote:
> Let's say I use "on idle" but also "on run" in the same script. It then
> executes the handler twice on startup.
> How might I suppress the firstrun dialog when starting the Script
> Application?
>
> --------
> on idle
> beep
> displayDialog()
> return 20
> end idle
>
> on run
> displayDialog()
> end run
>
>
> to displayDialog()
>
> tell application "Finder" to set focus to name of (path to frontmost
> application)
>
> tell application focus to display dialog focus & " is frontmost" giving
> up after 1 with icon note buttons {""}
>
> end displayDialog
Just remove the 'on run' handler. Saved as a stay-open, the app will run the
'on idle' handler immediately upon being launched, and then will run again
every 20 seconds. (BTW, as a user I find the blank button more irritating
than a default "OK" button even though either disappears after 1 second.)
You could also change the Finder line to:
tell application "Finder" to set focus to (path to frontmost
application) as Unicode text
or better yet
tell application "System Events" to set focus to (path to frontmost
application) as Unicode text
That will avoid the possibility that the user has more than one version of
the app. It's true that there should be no problem since the open version
should always be the one used by AppleScript, but just in case the Finder or
the system is having a "bad hair day" the full path to the app is guaranteed
to work. (Just a bit of pedantry here: I'm sure the open app will respond in
this case anyway.)
--
Paul Berkowitz
_______________________________________________
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