Hello I had some trouble getting through, so I wrote this post before DJ Bazzie Wazzie.
I take a different approach to solving the problem, I coerce the chosen item to text. (I have also tossed in a test for false, so that the script quit’s if the user redecides.
There were just one error and that was that the choose from list, returns a list, and that this list aren’t coerced to text when you compare with the different values.
I also changed your multiple if-tests into one new one, that is nested, so we bail out the second we have had a hit.
set ScriptTime to (choose from list {"3 Hours", "5 Hours", "7 Hours", "10 Hours"})
if ScriptTime is false then error number -128
set ScriptTime to ScriptTime as text
if ScriptTime is "3 Hours" then
set ScriptTime to "10800"
else if ScriptTime is "5 Hours" then
set ScriptTime to "18000"
else if ScriptTime is "7 Hours" then
set ScriptTime to "25200"
else if ScriptTime is "10 Hours" then
set ScriptTime to "36000"
end if
set ScriptStart to current date
delay ScriptTime
set ScriptStop to current date
display dialog "Run Time = " & (ScriptStop - ScriptStart) & " seconds."
Edit
I just want to comment a little bit on the way you coded your if-tests: This is really ok to do, if you do it because a long statement consistsing of ands and other composite logic statements. In this particular case it is better with an if then else if construct. A fine word for this is cyclomacy, and the theory is that the lesser branches you have in a program/handler the easier it is to go back and change it. Now you would object to the way I make your hander brutally quit, but I think that is the exception to the rule, since this is a fatal step. I also think the rule should be bent, when strictly following the rule leads to introducing a more complicated logic and control variables to make the correct thing happen.
Below is a contrived example, that fails anyway, since you can’t have “if clusters” without an endif in Applescript,
but I have shown how such a “if cluster” would have been implemented in C.
set temperature to "hot"
set wind to "only slight"
set working_day to "day off"
# example 1 using and
if temperature is "hot" and wind is "only slight" and working_day is "day_off" then goto_theBeach()
# example 2 which is a failure in Applescript since you can't do it
# without an endif, but it still illustrates my point
#
# In C this would look like:
# if (hot_temp)
# if (only_slight_wind)
# if (day_off)
# goto_theBeach()
#
# This "logic break down" can't be performed in Applescript, so there
# you would end up with something like this.
if temperature is "hot" then
if wind is "only slight" then
if working_day is "day_off" then
goto_theBeach()
end if
end if
end if
on goto_theBeach()
set a to "b"
end goto_theBeach