Re: Wind Chill (corrected & full)
Re: Wind Chill (corrected & full)
- Subject: Re: Wind Chill (corrected & full)
- From: Markus Erndl <email@hidden>
- Date: Fri, 1 Mar 2002 10:30:51 -0500
On Friday, March 1, 2002, at 07:24 AM, David Groover wrote:
>
Great question and responses. I appreciate a real world, non computer
>
oriented, practical result from an AS. Helps my learning. But, I pasted
>
the following in my text editor, only to have the formula hang on a coma
>
(the one immediately following "Cancel", "OK"}") when it expected an
>
end
>
of line. I tried moving several things around but without success. My
>
essentials are:
>
>
AppleScript 1.3.7
>
Apple system 8.6
>
Mac 7300 w XLR8 G3/400
>
>
Was the script intended to be ready to go? Or did I presume and miss
>
something I should have taken out?
>
>
Thanks
>
>
Dave Groover
I believe the comma in question should actually be a "B," I am sorry but
I do not know the name of this character, But it worked when I copied
and pasted it into Script editor in OSX. I did find several other places
where I needed to reformat the text in the script after pasting, but as
long as you know the proper format for the stuff you can figure it out.
For instance, "default button" goes on the same line as "display
dialog" so just get rid of the returns after you paste it. Other places
I found problems were with comments (stuff after --) . anything on the
same line as "--" is a comment. After pasting most of the comments
contained returns which cause Applescript to look at those lines as
possible code and it tries to compile.
Try this one
tell application "Finder"
display dialog "Please enter the temp in degrees Fahrenheit: "B,
buttons {"Cancel", "OK"} default button 2 default answer "54"
set TheEntryTemp to the text returned of the result as string
(* don't force the coercion yet*)
display dialog "Please enter the wind speed in miles per hour: "B,
buttons {"Cancel", "OK"} default button 2 default answer "10"
set TheEntryMPH to the text returned of the result as string
(* insert a little error checking to make sure a number
was entered for each and in range here
(-220 to +210 for temp, 0 to 240 for MPH ).
You can write that yourself :)*)
set TheTemp to TheEntryTemp as integer
set TheSpeed to TheEntryMPH as integer
set TheWindChill to (35.74 + (0.6215 * TheTemp) B,
- (35.75 * TheSpeed * 0.16) B,
+ (0.4275 * TheTemp * TheSpeed * 0.16))
display dialog "The temp including wind chill is: " & TheWindChillB,
buttons {"OK"} default button 1
end tell
Good Luck,
Markus
>
>
> tell application "Finder"
>
>
>
> display dialog "Please enter the temp in degrees Fahrenheit: "
>
> buttons {"
>
> Cancel", "OK"} ,
>
> default button 2 default answer "54"
>
> set TheEntryTemp to the text returned of the result as string --
>
> don't
>
> force the coercion yet
>
>
>
> display dialog "Please enter the wind speed in miles per hour: "
>
> buttons
>
> {"Cancel", "OK"} ,
>
> default button 2 default answer "10"
>
> set TheEntryMPH to the text returned of the result as string
>
>
>
> -- insert a little error checking to make sure a number was entered
>
> for
>
> each and in range here (-220 to +210 for temp, 0 to 240 for MPH ). You
>
> can
>
> write that yourself :)
>
>
>
> set TheTemp to TheEntryTemp as integer
>
> set TheSpeed to TheEntryMPH as integer
>
>
>
> set TheWindChill to (35.74 + (0.6215 * TheTemp) - (35.75 *
>
> TheSpeed *
>
> 0.16
>
> ) + (0.4275 * TheTemp * TheSpeed * 0.16))
>
>
>
> display dialog "The temp including wind chill is: " & TheWindChill
>
> buttons {"OK"} default button 1
>
> end tell
>
_______________________________________________
>
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.
>
>
Markus Erndl ____________
Mac Development Specialist | __________ |
Queens College, CUNY || b
b
||
Flushing, NY 11367 || <> ||
email@hidden ||__________||
Ph: 718-997-3022 | ___ |
Fax: 718-997-5678 |____________|
|____________|
_______________________________________________
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.