• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Puzzling behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Puzzling behavior


  • Subject: Re: Puzzling behavior
  • From: Axel Luttgens <email@hidden>
  • Date: Mon, 04 Oct 2004 09:43:33 +0200

Michelle Steiner wrote:
The script:

tell application "Finder"
    quit
    log 1
    launch
    log "a"
end tell

First time it's run:

tell application "Finder"
    quit
        current application
    (*1*)
        current application
    (*1*)
    launch
        current application
    (*a*)
end tell

Second time it's run:

tell application "Finder"
    quit
    (*1*)
        current application
        "Finder got an error: Connection is invalid."

Third time duplicates the first, fourth duplicates the second, etc.
Your post is an illustration for cases where the event log is rather difficult to interpret.
It seems that some output is sometimes missing, and/or possibly badly indented.
Would be happy to know if others share such a feeling.
Or have the key to read the log correctly.

Trying your script here, it seems that your "first (third) time run" must be understood as "what happens when the Finder is not running", while your "second (fourth) time run" is "what happens when the Finder is running".
Am I correctly describing the behavior you are encountering?

So, if the Finder is not running when it is told to quit, I think it will first receive a run command (see p. 155 of the ASLG).
Seems logical, as an application has to be running for being able to respond to commands, even if just a quit one; but it would then be nice to see this appear clearly in the event log.
This could partially help to explain why that double execution of "log 1". As if, after the automatic run has been sent, the whole thing began from scratch again.
Moreover, I'm not sure, but it seems that the quit isn't performed (mades me vaguely remind of something).
Still remains globally obscure to me...

There is also an interaction due to the fact that the log statements are within the 'tell app "Finder"' block.
Rewriting your script this way seems to produce seemingly more sensible behavior and log output:
tell application "Finder" to quit
log 1
tell application "Finder" to launch
log "a"
This is the log when the Finder is not running:
tell application "Finder"
    quit
        current application    <-- the result of an "automatic" run?
    (*1*)
    launch
        current application
    (*a*)
end tell
And when the Finder is running:
tell application "Finder"
    quit
    (*1*)
    launch
        current application
    (*a*)
end tell
Axel
 _______________________________________________
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

  • Prev by Date: Re: Screen saver deactivation
  • Next by Date: Re: Screen saver deactivation
  • Previous by thread: Re: GUI programming
  • Next by thread: [ANN] PreFab UI Actions 1.0
  • Index(es):
    • Date
    • Thread