0

Why does this cancel check not work?

answer file "Bitte Bild auswählen" with type "Images|jpg|jpeg|png" if the result is not "cancel" then put it into tMyImagePath ... end if

It always starts to run code. I also tried "Cancel" and "Abbrechen". I am using MacOSX in German and LiveCode 6.6.2 RC3.

Tate83
  • 274
  • 1
  • 7
  • 21

2 Answers2

1

Just replace "the result" with "it" and it should work.

The user response of an answer dialog is stored in the variable "it".

Btw, pressing "cancel" in an "answer file" dialog does return nothing to the variable "it"

So you could change your script like this

answer file "Bitte Bild auswählen" with type "Images|jpg|jpeg|png" 
if it is not empty then put it into tMyImagePath
...
end if
Matthias Rebbe
  • 116
  • 1
  • 7
  • Thanks, that works as well. But theoretically my approach should be fine as well, right? – Tate83 May 06 '14 at 10:31
  • Yes, it should work, but only when using the "answer file" dialog without the "with type..." part. LC dictionary says for "answer file... with types":If types are specified, the result function will return the tag of the corresponding type selected from the supplied drop-down list. – Matthias Rebbe May 06 '14 at 10:38
  • Just compare the Dictionary entries for "answer file" and "answer file... with type". – Matthias Rebbe May 06 '14 at 10:42
  • the devil is in the details.. reading is a useful skill ;-) thanks – Tate83 May 06 '14 at 11:21
0

If you want to use 'the result' you can also do this:

answer file "Bitte Bild auswählen" with type "Images|jpg|jpeg|png" 
if the result is not empty then 
  put it into tMyImagePath
  ...
end if
Devin
  • 593
  • 1
  • 3
  • 8