Page 1 of 1

FileRequester Cancelled

Posted: Mon Feb 24, 2014 10:25 pm
by NubeCheCorre
i use this code (here is only a part) to know if the user press the cancel button and end the program, but i get an error:

Code: Select all

pattern$ = "jpg|jpeg|bmp|tif|gif|png"

title$ = "Scegli i files da unire orizzontalmente"

f$ = FileRequest(title$,pattern$,#REQ_MULTISELECT)
If f$ = ""
	Print("Requester annullato!")
	End()
Else
	NPrint("Path:", PathPart(f$[0]))
	NPrint("Files selezionati:", ListItems(f$) - 1)
EndIf
The error is:

"Wrong operator for this type"

What does it mean? As far as I understand I have to use another operator, but what to use instead of "=" to check if f$ is empty?

Re: FileRequester Cancelled

Posted: Tue Feb 25, 2014 10:24 pm
by JurassicC
Your using REQ_MULTISELECT so you'll need a table defined to put your multirequest into.

change it to

f = FileRequest(title$,pattern$,#REQ_MULTISELECT)
if f[0] = ""
DebugPrint("Requester annullato!")
End()
Else
DebugPrint("Path:", PathPart(f[0]))
DebugPrint("Files selezionati:", ListItems(f) - 1)
EndIf

Re: FileRequester Cancelled

Posted: Wed Feb 26, 2014 11:05 pm
by NubeCheCorre
Thanks it works! :)

Re: FileRequester Cancelled

Posted: Sat Mar 29, 2014 2:09 pm
by Juan Carlos
I have a doubt how give the defdir$ because I have this problem in this case:
filetxt$=FileRequest("Choose txt file:" , ".txt", "Idiomas/")

where "Idiomas/" in theory is the defdir$ but the requester no do nothing.

Re: FileRequester Cancelled

Posted: Sat Mar 29, 2014 7:20 pm
by airsoftsoftwair
Read the documentation. You're passing arguments in the wrong order (defdir$ is the fourth argument, not the third)