8 Replies Latest reply: Feb 1, 2013 2:25 PM by Badunit
Boboonski Level 1 Level 1 (25 points)

I've changed the context of the script for posting here, but the one I have is mostly the same. 

 

The problem is, it is saying that economy2 is not defined.  I don't really see why it wouldn't be.

 

set begin to display dialog "LOAD FILE?" with title "Testing" buttons {"Load", "Cancel"}

if button returned of begin is "Load" then

    set theFile to (choose file with prompt "Load doc" of type {"txt"})

    open for access theFile

    set fileContents to (read theFile)

    close access theFile

    set AppleScript's text item delimiters to {":"}

    set economy1 to text item 1 of fileContents

end if

if economy1 is -9 then set economy2 to 18 / 18 * 100

if economy1 is -8 then set economy2 to 17 / 18 * 100

if economy1 is -7 then set economy2 to 16 / 18 * 100

if economy1 is -6 then set economy2 to 15 / 18 * 100

if economy1 is -5 then set economy2 to 14 / 18 * 100

if economy1 is -4 then set economy2 to 13 / 18 * 100

if economy1 is -3 then set economy2 to 12 / 18 * 100

if economy1 is -2 then set economy2 to 11 / 18 * 100

if economy1 is -1 then set economy2 to 10 / 18 * 100

if economy1 is 0 then set economy2 to 9 / 18 * 100

if economy1 is 1 then set economy2 to 8 / 18 * 100

if economy1 is 2 then set economy2 to 7 / 18 * 100

if economy1 is 3 then set economy2 to 6 / 18 * 100

if economy1 is 4 then set economy2 to 5 / 18 * 100

if economy1 is 5 then set economy2 to 4 / 18 * 100

if economy1 is 6 then set economy2 to 3 / 18 * 100

if economy1 is 7 then set economy2 to 2 / 18 * 100

if economy1 is 8 then set economy2 to 1 / 18 * 100

if economy1 is 9 then set economy2 to 0.5 / 18 * 100

 

display dialog economy2

 

Thanks in advanced!

Boboonski