Page 1 of 1
Ask file question
Posted: Fri Aug 14, 2009 10:18 am
by Chaumaret
Hello (again :lol)
In this code :
Code: Select all
ask file "Export picture as:" with type "JPEG File|jpg|JPEG" or type "GIF File|gif|GIFf"
put it into trep
answer trep
answer trep give only the name of file, not the name with the choice.
ex : foo (only) and not foo.gif if I choose .gif in ask dialog.
Could you help me please ? (I'm sure).
Thanks

Posted: Fri Aug 14, 2009 10:39 am
by bn
Hello Chaumare again,
the type is in the result, you have to provide the .xxx extension yourself in case the user did not do it. You have to test for it.
try
Code: Select all
on mouseUp pMouseBtnNo
ask file "Export picture as:" with type "JPEG File|jpg|JPEG" or type "GIF File|gif|GIFf"
put the result into tType
put it into trep
answer tType & cr & cr & trep
end mouseUp
regards
Bernd
Posted: Fri Aug 14, 2009 12:33 pm
by Mark
Hi Chaumaret,
The problem here is that Revolution's save file dialog doesn't automatically check for the file extension. If the user types "myfile.gif" in the filen name field in the dialog, the result may contain JPEG. You'll have to check both the result and the file name. Personally, I wouldn't warn the user if an inconsistent choice has been made. I'd just let the file name prevail.
Code: Select all
constant dot = "."
on mouseUp pMouseBtnNo
ask file "Export picture as:" with type "JPEG File|jpg,jpeg|JPEG" or type "GIF File|gif|GIFf"
put the result into rslt
set the itemDel to dot
if last item of it is "gif" or last item of it is among the items of "jpeg.jpg" then
put it into trep
put last item of it into tType -- this type is different from Bernd's script
else if rslt contains "gif" then
put it into trep
put "gif" into tType -- this type is different from Bernd's script
else if rslt contains "jpeg" then
put it into trep
put "jpg" into tType -- this type is different from Bernd's script
end if
answer tType & cr & cr & trep
end mouseUp
Best,
Mark
Posted: Fri Aug 14, 2009 12:42 pm
by Chaumaret
Many thanks !