Hey everyone.
I am trying to take the data that I put together in my script in the form of a dialog and either print it or save it to a file in an understandable format.
tell application "Finder"
--set Width in inches
display dialog "What is the Pool's width in:" & return default answer "Feet"
set WFeet to text returned of result
set WFeet to WFeet * 12 as text
display dialog "What is the Pool's width in:" & return default answer "Inches"
set WInches to text returned of result
set Width1 to WFeet + WInches as text
--Ensure that you get a positive number
if Width1 is less than or equal to 0 then
repeat
display dialog "Please enter a Non-Negative, Non-Zero value for Width"
display dialog "What is the Pool's width in:" & return default answer "Feet"
set WFeet to text returned of result
set WFeet to WFeet * 12 as text
display dialog "What is the Pool's width in:" & return default answer "Inches"
set WInches to text returned of result
set Width1 to WFeet + WInches as text
if Width1 is greater than 0 then
exit repeat
end if
end repeat
end if
--set Length in inches
display dialog "What is the Pool's length in:" & return default answer "Feet"
set LFeet to text returned of result
set LFeet to LFeet * 12 as text
display dialog "What is the Pool's length in:" & return default answer "Inches"
set LInches to text returned of result
set Length1 to LFeet + LInches as text
--Ensure you get a positive number
if Length1 is less than or equal to 0 then
repeat
display dialog "Please enter a Non-Negative, Non-Zero value for Length"
display dialog "What is the Pool's length in:" & return default answer "Feet"
set LFeet to text returned of result
set LFeet to LFeet * 12 as text
display dialog "What is the Pool's length in:" & return default answer "Inches"
set LInches to text returned of result
set Length1 to LFeet + LInches as text
if Length1 is greater than 0 then
exit repeat
end if
end repeat
end if
--Set Length and Width to feet for display purposes
set Length2 to Length1 / 12 as text
set Width2 to Width1 / 12 as text
--Ensure that when someone enters the values for length and width backwards that they still get the correct result
if Width2 is greater than Length2 then
set Panels to (round Width1 / 72 rounding up)
else
set Panels to (round Length1 / 72 rounding up)
end if
--sets the spacing between the panels to be panels less one, in inches e.g., 14 panels, spacing equals 13
set Spacing to (Panels - 1)
set Yardage to ((Panels * Length1 + Spacing) / 36) round
set WFeet to (round WFeet / 12) as text
set LFeet to (round LFeet / 12) as text
if Width2 is greater than Length2 then
display dialog LFeet & " ft. " & LInches & " in." & " by " & WFeet & " ft. " & WInches & " in." & return & return & "The area of this pool will be " & ((Width1 * Length1 / 144) round) & " Sq. Ft." & return & return & "The number of panels for this liner will be " & Panels & return & return & "The material usage on this pool will be " & Yardage & " yds"
else
set Yardage to ((Panels * Width1 + Spacing) / 36) round
display dialog WFeet & " ft. " & WInches & " in." & " by " & LFeet & " ft. " & LInches & " in." & return & return & "The area of this pool will be " & ((Width1 * Length1 / 144) round) & " Sq. Ft." & return & return & "The number of panels for this liner will be " & Panels & return & return & "The material usage on this pool will be " & Yardage & " yds"
end if
end tell
(*tell application "TextEdit"
activate
end tell
tell application "System Events"
keystroke "v" using {command down}
end tell*)
--Script written and compiled by Brian Keith Eibert 11/14/08; rev. 11/18/08
Does anyone have any ideas on how to do this? I am not a scripter by trade, so the simplest answers would be the best
Thanks, Brian