FileRequester Cancelled

Find quick help here to get you started with Hollywood
Post Reply
User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

FileRequester Cancelled

Post 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?
User avatar
JurassicC
Posts: 36
Joined: Fri May 25, 2012 9:48 pm

Re: FileRequester Cancelled

Post 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
AmigaOne X1000 - RadeonHD 7870, 4GB RAM - AmigaOS 4.1ß
AmigaOne X5000 - Radeon R7 250, 2GB RAM - AmigaOS 4.1ß
User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

Re: FileRequester Cancelled

Post by NubeCheCorre »

Thanks it works! :)
User avatar
Juan Carlos
Posts: 887
Joined: Mon Sep 06, 2010 1:02 pm

Re: FileRequester Cancelled

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: FileRequester Cancelled

Post by airsoftsoftwair »

Read the documentation. You're passing arguments in the wrong order (defdir$ is the fourth argument, not the third)
Post Reply