• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question on a script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Question on a script
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: Get only the name of the file, instead of the whole path!
  • Next by Date: Re: Weird reply in Tiger vs. Leopard....is this a bug?
  • Previous by thread: Re: Question on a script
  • Next by thread: Re: Question on a script
  • Index(es):
    • Date
    • Thread