an Applescript solution to the sweltering heat (Re: OT: Eskimo words for snow (Re: what's a "froplet"?))
an Applescript solution to the sweltering heat (Re: OT: Eskimo words for snow (Re: what's a "froplet"?))
- Subject: an Applescript solution to the sweltering heat (Re: OT: Eskimo words for snow (Re: what's a "froplet"?))
- From: David Meieran <email@hidden>
- Date: Mon, 5 Aug 2002 00:33:06 -0400
On Sunday, August 4, 2002, at 12:51 PM, Brennan wrote:
Snow
Sleet
Slush
Frost
Ice
Hail
Hoar
Glacier
Snowflake
Floe
Iceberg
Icicle
Rime
Snowdrift
Meltwater
Just a little something to refresh those in the Northern Hemisphere who
may be sweltering in the Summer heat right now.
fine, here's another approach...
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 : ""
-- QUERY USER FOR THE ZIPCODE
set this_text to "15217"
repeat
try
display dialog "Enter your 5-digit zipcode:" default answer this_text
set this_text to the text returned of the result
if this_text is not "" and ,
the length of this_text is 5 and ,
(this_text as number) is greater than 0 and ,
(this_text as number) is less than 100000 then
set this_zipcode to this_text as string
exit repeat
else
error
end if
on error number error_number
if the error_number is -128 then error number -128
beep
end try
end repeat
-- CREATE THE PARAMETER RECORD
set the method_parameters to {zipcode:this_text}
-- CALL THE SOAP SUB-ROUTINE & TRY TO COOL DOWN
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
display dialog "No temperature information is available for
zipcode " & this_zipcode & "." buttons {"OK"} default button 1
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
display dialog "Alas, it is a sweltering " & temp_F & ":
F" & " (" & temp_C & ,
": C)." & return & return buttons {"give up hope now",
"pray for cooler , weather"} default button 1 with icon
caution
if the button returned of the result is "give up hope now" then
return "done"
else
display dialog ("What's your prayer?") default answer
"Please, Steve, give us cooler weather."
copy text returned of result to yourPrayer
set rNum to 0
set charset to ,
"abcdefghijkm nopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 01234
56789.,!?;:)( "
-- above should be all one line, of course
set charsetLength to (length of charset) - 1
set howManyLetters to (length of yourPrayer)
set stevesEar to ""
set tempS to 0
repeat while tempS < howManyLetters
copy (random number charsetLength) + 1 to rNum
copy (tempS + 1) to tempS
copy stevesEar & (character rNum of charset) to stevesEar
end repeat
if yourPrayer is stevesEar then
display dialog "Okay, we'll see what we can do..." with icon note
else
display dialog "Forget it." buttons {"c'est la vie"}
default button 1 with icon note
end if
end if
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}
on error error_message number error_number
if the error_number is -916 then ,
set the error_message to "The script was unable to
establish a connection to the Internet."
return {false, error_message}
end try
end SOAP_call
-- shamelessly appropriated from all sorts of places (e.g., apple)
-- make sure accidently line feeds aren't pasted in to script editor
when copying
***
dm
_______________________________________________
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.