Re: OSAX within tells(Keyboard Question?)
Re: OSAX within tells(Keyboard Question?)
- Subject: Re: OSAX within tells(Keyboard Question?)
- From: Emmanuel <email@hidden>
- Date: Thu, 18 Jan 2001 12:47:31 +0100
At 4:23 +0100 18/01/01, email@hidden wrote:
>
>IMHO it's a worse idea to try to write scripts with Osax calls outside of
>
tell blocks.
>
>
>
>>>>Umm.... Why?
>
>
Because it clutters up and breaks up perfectly readable and understandable
>
AppleScripts for no good reason.
>
>
And that makes scripting more complex and tedious and harder to learn.
>
>
It also prevents you from using a wide range of compound commands like:
>
>
set the name of myFile to date string for (current date)
>
>
[...]
>
>
Including OSAX commands within application tells is not a "bad habit".
>
It's using the technology the way it was designed. I believe that all the
>
AppleScript books agree and nearly every sample script from Apple that I've
>
seen uses them.
>
>
Now, I'm not saying there is anything wrong with moving commands outside
>
tells if your more comfortable with that and prefer that, but I am saying
>
we should not tell Scripters, particularly new Scripters, that it's a
>
problem when it's not.
We should use the technology the way it was designed, and we should
definitely tell new scripters to do so. OTOH, some [more or less]
experienced scripters may think it sensible to take additional
precautionnary - possibly useless - measures because they have already
experienced conflicts.
So, I suggest we begin listing the conflicts involved by calling Scripting
Additions inside apps' tells, and do what we can to have them eventually
suppressed.
I should be able to provide a first item :-)
-------------------
tell application "Finder"
path to startup disk
end tell
-- alias "Macintosh HD:Desktop Folder:"
-------------------
while:
-------------------
path to startup disk
-- alias "Macintosh HD:"
-------------------
Emmanuel