Thanks to Ken and Paul. I am in fact using Ken's solution, but I am worried 
that it looks odd to the user (a school pupil or teacher). I understand the 
idea of modifying the name the person has chosen (you get this for example when 
trying to do more than one download of the same file in a browser, so it is 
'known' convention), but in my context I don't think I can do that since the 
user won't know it's happened until they come to try to retrieve the file, and 
then there is a (slight) danger of their not recognising it.

It looks as if some applications can get inside the OS Save dialog (and on the 
Mac too - for example Graphic Converter), but LC ones can't. I agree it is too 
much work to grow one's own to make it look exactly like the OS one, although I 
might have a go when I'm less busy.

I no longer have updating rights in QCC (I suppose, since I don't pay the extra 
$199 to be a Developer, although that's what I am!), otherwise I might 
formulate a suggestion that this intervention be allowed.

Graham


On 29 Feb 2012, at 03:46, Ken Ray <[email protected]> wrote:

> 
>> Now say there is already such a file in the directory. Of course I can 
>> detect it (by 'there is a') and warn the user, but only in a separate, 
>> home-grown dialog (an 'ask' dialog) after the Save dialog has been 
>> dismissed. This is clumsy and odd as a user experience. Is there any way I 
>> can hack into the conventional Save dialog so that it thinks it is being 
>> asked to save a file with an extension in spite of my user not typing one?
> 
> No, unfortunately. At the moment the easiest workaround (sans creating a 
> custom Save dialog of your own) is to bring up the Save dialog, look at the 
> name they entered, and if it doesn't have the right extension, add it and 
> check to see if there's a file by that name already in the destination 
> folder. If so, bring up a custom "do you want to overwrite" dialog.
> 
> Ken Ray
> Sons of Thunder Software, Inc.

On  Tue, 28 Feb 2012 21:57:40 +0000, Paul Hibbert <[email protected]> wrote:
> 
> Hi Graham,
> 
> I have just been though a similar issue, but my app allows the user to save a 
> GIF, PNG or JPEG file and I wanted to be sure the user added the correct 
> extension. I did end up putting a check in place, with a warning dialogue, 
> inside a repeat loop. Potentially a user could sit there all night typing the 
> wrong extension, but the check also corrects the extension and re-presents 
> the save dialogue, so if they continually type a wrong extension over the 
> corrected one, they deserve to sit there all night, eventually they will 
> learn!
> 
> I know it's a bit clumsy, but not being in a position to compete with the 
> likes of Adobe I felt it was better than allowing the user to screw-up and 
> end up with an un-useable file, or worse, overwrite a good file with an 
> un-useable one. It seems the only alternative was to write a custom save 
> dialogue routine to mimic the OS dialogue which could be a nightmare with a 
> cross platform app.
> 
> Ken's answer is the most straightforward, but if you are mainly concerned 
> with the user inadvertently overwriting a file, and really don't want to have 
> a pop-up or re-present the save dialogue, you could check to see if the file 
> exists, then just modify the name slightly. Many apps will add a version 
> number in this case, so if they type MyOwnFile and your script adds the 
> missing .jpg extension, but MyOwnFile.jpg already exists, then you further 
> modify the filename to MyOwnFile-1.jpg or MyOwnFile_1.jpg. The file save 
> routine would need to be in a checking loop so the next MyOwnFile becomes 
> MyOwnFile-2.jpg etc., so it can only exit the loop when it has a unique 
> filename beginning with their choice and ending with the correct extension.
> 
> Paul

_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to