Re: New user
Re: New user
- Subject: Re: New user
- From: Nigel Garvey <email@hidden>
- Date: Thu, 30 Aug 2001 20:17:44 +0100
John McDonald wrote on Thu, 30 Aug 2001 08:25:20 -0700:
>
Applescript users
>
>
As a new Applescript user, I am trying to learn the language. I tried to
>
install the guidebook downloaded from the web site. It does not
>
install. Instead there is a message "<<script>> doesn't understand the
>
<<event earsffdr>> message". Apple was no help at all. I would
>
appreciate any assistance one of you may give.
<<event earsffdr>> is the raw event code for the Standard Additions
command 'path to'.
The installer that comes with the Guidebook modules is an AppleScript
saved as an application. If you open it in Script Editor, you'll be able
to read the AppleScript instructions that control the installation.
About a quarter of the way down, there's the line:
set error_log to ((path to desktop) as text) & ((day of (current date))
as string) & ,
((time of (current date)) as string)
The problem is the '((path to desktop) as text) bit'. The line occurs
within a 'tell' block directed at the Finder, and the 'path to' command
often causes problems in that situation - especially when its parameter
is also one of the Finder's "special folders". One cure is to replace
'path to' with its Finder equivalent. The whole line would then read:
set error_log to (desktop as text) & ((day of (current date)) as
string) & ,
((time of (current date)) as string)
(If you see a comma, replace it with the line-continuation character:
Option-L.)
Recompile the script and save it. It should now work.
Besides ignoring the known problem with the Finder and 'path to', the
original line makes 'path to' return an alias which is then coerced to
string, instead of letting 'path to' return the string directly. It also
does three explicit string coercions when (by the rules of concatenation)
only the first is necessary, and it makes two calls to 'current date'
when the required information could (and should) be extracted from one.
tell application "Finder"
set error_log to (desktop as text) & (get {day, time} of (current
date))
end tell
-- don't tell application "Finder"
set error_log to (path to desktop as text) & (get {day, time} of
(current date))
-- end don't tell
NG