I’m having trouble with what I think is a scope problem. Whenever I run this script, I get an error message telling me that either the variable fromFolder or toFolder isn’t defined. Even though they both get declared as globals in the on awake from nib handler. I know Applescript Studio handles scope differently than plain vanilla Applescripts, but I find it hard to believe it’s impossible to simply declare a global variable
on awake from nib theObject
global fromFolder
global toFolder
set fromFolder to ""
set toFolder to ""
end awake from nib
on clicked theObject
if name of theObject = "fromFolderbutton" then
set fromFolder to choose folder with prompt "Choose Source Folder..."
else if name of theObject = "toFolderbutton" then
set toFolder to choose folder with prompt "Choose Destination Folder..."
end if
if (fromFolder is not "" and toFolder is not "") then
addFoldersToList(fromFolder, toFolder)
set fromFolder to ""
set toFolder to ""
end if
end clicked