Re: Saving a property after running a script remotely
Re: Saving a property after running a script remotely
- Subject: Re: Saving a property after running a script remotely
- From: John Delacour <email@hidden>
- Date: Wed, 11 Sep 2002 12:41:02 +0100
At 8:20 pm -0700 10/9/02, Paul Berkowitz wrote:
I have discovered that it's very difficult to save a property in a script
being run by another script. I wonder if anyone knows a good, reliable
method. Here's my set-up: [...]
I have never discovered that and I don't discover it now. If I run
"master" from the Script Menu (having the master/slave pair in my
Scripts folder) then this works as expected. The property is updated
and saved even if the window of "slave" is open in Smile.
Here are two alternative pairs that do the same thing in a different way.
(* ~/Scripts/master *)
set scrpts to "" & (path to scripts folder)
set slavePath to alias (scrpts & "slave")
set d to "" & (current date)
set slave to load script slavePath
set last_run of slave's prefs to d
store script slave in slavePath with replacing
display dialog last_run of slave's prefs
(* ~/Scripts/slave *)
property prefs : {last_run:"empty"}
-----------------
(* ~/Scripts/master *)
set scrpts to "" & (path to scripts folder)
set slavePath to alias (scrpts & "slave")
set d to "" & (current date)
set slave to load script slavePath
tell slave
showLastRun()
set last_run of its prefs to d
end tell
store script slave in slavePath with replacing
(* ~/Scripts/slave *)
property prefs : {last_run:"empty"}
on showLastRun()
display dialog last_run of prefs
end showLastRun
-----------------
So - does anyone know a reliable way for the running Main Script to save its
own lastRun property - preferably from inside itself but stored from the
Trigger script would be OK too if reliable. If I have to, I guess I'll do
this as an applet instead, but it really is more convenient as a compiled
script in Script Menu. Is there a way?
So far as I can tell, nothing has changed. If you're having
problems, log out and back in again.
(* ~/Scripts/master *)
property mainDate : "empty"
display dialog "MAIN:" default answer mainDate
set scrpts to "" & (path to scripts folder)
set slavePath to alias (scrpts & "slave")
set d to "" & (current date)
set slave to load script slavePath
tell slave
showLastRun()
set last_run of its prefs to d
end tell
store script slave in slavePath with replacing
set mainDate to "" & (current date)
(* ~/Scripts/slave *)
property prefs : {last_run:"empty"}
on showLastRun()
display dialog "SLAVE:" default answer last_run of prefs
end showLastRun
-- JD
_______________________________________________
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.