Re: Finder Tell Blocks
Re: Finder Tell Blocks
- Subject: Re: Finder Tell Blocks
- From: Arthur J Knapp <email@hidden>
- Date: Mon, 04 Mar 2002 16:55:29 -0500
>
From: email@hidden
>
Date: Sun, 3 Mar 2002 22:29:32 EST
>
Subject: RE: Finder Tell Blocks
>
always running. I never realized that AS coding didn't require invoking at
>
least one program to act as the executor of the code.
Technically, it does. When you are in a script-editor, the editor is
the default application that receives all commands, and when you've
saved a script as a script-application, it receives all commands:
1 + 1
is the same as:
tell me --> script-editor or script-application, "script runner".
1 + 1
end tell
>
For others (newbies especially) who also didn't quite get the rant & rave of
>
it:
>
>
set X to 5
>
set Y to 25
>
set Z to 2
>
set A to ((X+Y)/Z)
>
display dialog "The answer is: " & a
>
>
does not have to be within a tell block at all -- it will just run all by
>
it's lonesome without it, even outside the script editor (as a saved
>
application) because it never calls anything unique to any program.
(Darn, I was trying to stay out of this thread...)
One important point to be made here has to do with applications and
interface-elements like the "display dialog" command. When you call
a command that is going to display something, you do need to think
about which application is going to be frontmost:
display dialog "Hello"
All by itself in the script editor, this should display the dialog
with no difficulties, because while you are editing, the editor is
frontmost. However, when you go to save your script, either to
be called from something like OSAMenu, or as it's own application,
it is always good practice to "activate" some application first:
activate --> the script itself, (when it is a script-application)
display dialog "Hello"
You may also have very good *design* reasons for wanting the dialog
to be shown *within* a particular application, (like the Finder, for
instance), so you call the interface within that application's "tell"
block:
tell application "Finder"
activate --> always a good idea before dialogs
display dialog "Hello"
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.lazerware.com/>
on error number -128
end try
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.