I am building a save panel for one of my applications, and what I want this save panel to to do is get a path I can send to the unix command line.
So, I searched the forums and found this.
Then, I borrowed the save panel code and “on panel ended code” to build something like this:
on panel ended theObject with result withResult
if theObject is the save panel then
if withResult is 1 then
set saveOut to (path name of save panel)
end if
end if
set savepanelfinished to true
end panel ended
on askForSave()
tell save panel
set title to "Download file as..."
set can choose directories to false
set can choose files to true
set prompt to "Download"
set treat packages as directories to false
end tell
display save panel attached to window "fileWin"
end askForSave
Then, I have another part of the code that looks like this:
else if theObject is button "beginBtn" of window "fileWin" then
askForSave()
if savepanelfinished is true then
display dialog saveOut
end if
end if
The goal? To wait for the panel to finish it’s save “getting path” stuff, and then I display the result. But at the end of choosing where to save, I get nothing. Not even an error…
What’s going on?