Problem with the Cancel function
Posted: Sat Sep 25, 2010 2:58 pm
I have some code that is not working as expected. I have read the dictionary and copied the relevant part below:
From the dictionary entry for answer file:
The absolute file path of the file the user chose is placed in the it variable. If the answer files form is used, a return-delimited list of such paths is placed in the it variable. If the user cancels the dialog, the it variable is set to empty, and the result function returns "Cancel".
So I added the following code with a trap for when the user presses cancel:
I was expecting the result to be set to Cancel when the user selects Cancel but I think that it is being left blank or I am not using the result function correctly. I know I can use the value in "it" as a check but I was wondering where I went wrong.
From the dictionary entry for answer file:
The absolute file path of the file the user chose is placed in the it variable. If the answer files form is used, a return-delimited list of such paths is placed in the it variable. If the user cancels the dialog, the it variable is set to empty, and the result function returns "Cancel".
So I added the following code with a trap for when the user presses cancel:
Code: Select all
-Prompt for input file
answer file "Select the TAB file that describes the" & pListName & " init data" with type "Text|txt"
--? this next line does not work
if the result is "Cancel" then exit LoadDescriptionFile