Forgetting Variables?

This is an odd situation. I can’t say I’ve ever run into this one before.

on clicked theObject
	if name of theObject is "devbrowse" then
		tell application "Finder"
			set devloc to (choose folder with prompt "Please choose your Devhook Folder")
		end tell
		tell window "Devhook Installer" to set the contents of text field "devloc" to devloc
	else
		if name of theObject is "pspbrowse" then
			set disklist to list disks
			set pspstick to (choose from list disklist as list with prompt "Choose your PSP Memory Stick")
			tell window "Devhook Installer" to set the contents of text field "psploc" to pspstick as string
		else
			if name of theObject is "instbut" then
				tell window "Devhook Installer" to set the title of button "instbut" to "Installing..."
				tell application "Finder"
					set gameloc to ((pspstick as string) & ":PSP:GAME:") as alias
					set psploc to (pspstick as string) as alias
					set dhloc to ((devloc as string) & "dh") as alias
					set dhg to ((devloc as string) & ":PSP:GAME:") as alias
					duplicate every item of folder dhg to gameloc
					duplicate folder dhloc to psploc
				end tell
			end if
		end if
	end if
end clicked

What happens is upon clicking “instbut”, I get an error saying that the variable pspstick is not defined, when I just defined it earlier. Am I forgetting something, by any chance? (Sorry, I am still new to AS studio, so this might be a pretty beginner question :P)

And, of course, any suggutions on improvements to my code are welcome.

Thanks,
-Parrot

Is pspstick a property? Otherwise, the value is not stored between different events.

Aha, that did it. Thanks mate :slight_smile: