Re: Question on a script
Re: Question on a script
- Subject: Re: Question on a script
- From: "Stockly, Ed" <email@hidden>
- Date: Thu, 17 Jan 2008 16:03:26 -0800
- Thread-topic: Question on a script
>> I have this script that I run. I want it to write a log ONLY if there is a
>> change in any of the values.
>>
>> Will this do the job?
>>
Here's how I would do this....
------------
-- read current temperatures
set new_Outside to (value of "Temperature Outside.web") as integer
set new_Upstairs to (value of "Temperature Upstairs.web") as integer
set new_Downstairs to (value of "Temperature Downstairs.web") as integer
set new_Main_Floor to (value of "Temperature Main Floor.web") as integer
-- compare to stored values
set UpdateLog to false
repeat
if (new_Outside is not equal to Temp_Outside) then set UpdateLog to true
if (new_Upstairs is not equal to Temp_Upstairs) then set UpdateLog to
true
if (new_Downstairs is not equal to Temp_Downstairs) then set UpdateLog
to true
if (new_Main_Floor is not equal to Temp_Main_Floor) then set UpdateLog
to true
if UpdateLog then
write (log ("Outside: " & new_Outside & " Upstairs: " &
new_Upstairs & " Downstairs: " & new_Downstairs & " Main floor: " &
new_Main_Floor))
-- update stored values
set Temp_Outside to new_Outside
set Temp_Upstairs to new_Upstairs
set Temp_Downstairs to new_Downstairs
set Temp_Main_Floor to new_Main_Floor
end if
end repeat
-------------
ES
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden