Fwd: iCal scripting problem
Fwd: iCal scripting problem
- Subject: Fwd: iCal scripting problem
- From: Paul Robinson <email@hidden>
- Date: Sat, 2 Oct 2004 12:53:26 +0100
Dang! I suddenly seem to be forgetting to post back to the list.
P.
Begin forwarded message:
From: Paul Robinson <email@hidden>
Date: 2 October 2004 12:50:52 BST
To: Christian Boyce <email@hidden>
Cc: Paul Robinson <email@hidden>
Subject: Re: iCal scripting problem
Events can trigger alarms via two applications: iCal and iCal helper.
iCal helper checks to see if iCal is running, and keeps quiet if it
is, but the reverse does not occur i.e iCal does not check to see if
iCal Helper is running.
To see what I mean set an event to trigger the following script with
iCal not initially running, and then when it is. When it is not
running, the script should report that the application running it is
"iCal" and then "iCal helper". "iCal helper runs the first copy of the
script, which launches iCal. As it activates, iCal sees that it must
trigger an alarm for the same event, so it launches a second copy of
the script, which reports that it was launched by "iCal". This script
then terminates, returns control to iCal, which returns control to the
first copy of the script, which reports that it was launched by iCal
helper.
--code begins
tell application "iCal"
activate
display dialog "Name of application executing script is: " & (name of
me) as string
end tell
--code ends
The solution to the problem is along the lines of:
--code begins
tell application "iCal"
activate
if ((name of me) as string = "iCal") then
display dialog "This script will execute twice, but this message is
only displayed when iCal is running it."
end if
end tell
--code ends
This script does not prevent itself from executing twice, but ensures
that the payload of the script will only be executed once, and by
iCal.
P.
On 2 Oct 2004, at 03:08, Christian Boyce wrote:
Any hints? iCal 1.5.2, OS X 10.3.5. Thanks.
-----------------------------------
Mr. P. M. Robinson
37 Beechwood Close, Bowness-on-Windermere, Windermere, Cumbria. LA23
3AB.
Tel.Nr. 0153 944 5661
Fax.Nr. 0153 944 5661
_______________________________________________
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