Hi,
I am modifying the script that comes with OS X that finds the temperature by your zip code so that it dosnt have the popup that asks for the zipcode (always uses the same one) and then puts the temperature as your ichat status. I have gotten that to work fine, however I would like the script to stay open (save as->stay open) and every some amount of time for it to refresh the message to a more current one. How would I do this? I tried using 'on idle' and kept getting syntax errors. Im very new to applescript so any help would be appreciated..
Here is the script:
property SOAP_Endpoint_URL : "http://services.xmethods.net:80/soap/servlet"
property SOAP_app : "rpcrouter"
property method_name : "getTemp"
property method_namespace_URI : "urn:xmethods-Temperature"
property SOAP_action : ""
set this_zipcode to "90210"
set the method_parameters to {zipcode:this_zipcode}
copy my SOAP_call(SOAP_Endpoint_URL, SOAP_app, method_name, method_namespace_URI, method_parameters, SOAP_action) to {call_indicator, call_result}
if the call_indicator is false then
beep
display dialog "An error occurred." & return & return & call_result buttons {"Cancel"} default button 1
else
-- CONVERT THE RESPONSE TO FAHRENHEIT AND CELSIUS
set this_temp to the call_result as number
if this_temp is -999 then
tell application "iChat"
set status message to "Weather Unknown"
end tell
else
set temp_F to this_temp as degrees Fahrenheit
set temp_C to (round ((temp_F as degrees Celsius) as number)) as string
set temp_F to (round (temp_F as number)) as string
tell application "iChat"
set status message to "Weather: " & temp_F & "°"
end tell
end if
end if
on SOAP_call(SOAP_Endpoint_URL, SOAP_app, method_name, method_namespace_URI, method_parameters, SOAP_action)
try
using terms from application "http://www.apple.com/placebo"
tell application SOAP_app of machine SOAP_Endpoint_URL
set this_result to call soap ¬
{method name:method_name ¬
, method namespace uri:method_namespace_URI ¬
, parameters:method_parameters ¬
, SOAPAction:SOAP_action}
end tell
end using terms from
return {true, this_result}
end try
end SOAP_call
Thanks
I am modifying the script that comes with OS X that finds the temperature by your zip code so that it dosnt have the popup that asks for the zipcode (always uses the same one) and then puts the temperature as your ichat status. I have gotten that to work fine, however I would like the script to stay open (save as->stay open) and every some amount of time for it to refresh the message to a more current one. How would I do this? I tried using 'on idle' and kept getting syntax errors. Im very new to applescript so any help would be appreciated..
Here is the script:
property SOAP_Endpoint_URL : "http://services.xmethods.net:80/soap/servlet"
property SOAP_app : "rpcrouter"
property method_name : "getTemp"
property method_namespace_URI : "urn:xmethods-Temperature"
property SOAP_action : ""
set this_zipcode to "90210"
set the method_parameters to {zipcode:this_zipcode}
copy my SOAP_call(SOAP_Endpoint_URL, SOAP_app, method_name, method_namespace_URI, method_parameters, SOAP_action) to {call_indicator, call_result}
if the call_indicator is false then
beep
display dialog "An error occurred." & return & return & call_result buttons {"Cancel"} default button 1
else
-- CONVERT THE RESPONSE TO FAHRENHEIT AND CELSIUS
set this_temp to the call_result as number
if this_temp is -999 then
tell application "iChat"
set status message to "Weather Unknown"
end tell
else
set temp_F to this_temp as degrees Fahrenheit
set temp_C to (round ((temp_F as degrees Celsius) as number)) as string
set temp_F to (round (temp_F as number)) as string
tell application "iChat"
set status message to "Weather: " & temp_F & "°"
end tell
end if
end if
on SOAP_call(SOAP_Endpoint_URL, SOAP_app, method_name, method_namespace_URI, method_parameters, SOAP_action)
try
using terms from application "http://www.apple.com/placebo"
tell application SOAP_app of machine SOAP_Endpoint_URL
set this_result to call soap ¬
{method name:method_name ¬
, method namespace uri:method_namespace_URI ¬
, parameters:method_parameters ¬
, SOAPAction:SOAP_action}
end tell
end using terms from
return {true, this_result}
end try
end SOAP_call
Thanks