This theme hasn’t quite slipped my mind, obtaining a correct name to save a file under, is indeed an important endeavour in a script.
There are several things to consider when getting a new filename to save under.
The most important is whether we are within the scope of an application when the saving of the data takes place or not.
The second one, is to stay within the behaviour of the app we are assisting.
As long as we are inside the scope of an application, telling the app to save the file under a name with an extension, it will either ignore the lack of an extension, or silently add it, also let the file be saved with the extension of the users choice (expenses.1 quater.2012), still setting the correct uti of the file. I think this must be tested on the app in speak before hand. Some apps, like Safari, balks at “customized extensions”, while others, like Microsoft Excel accepts them. So there is no universal scheme to be had.
Should we create and save a file outside the scope of an app, but still want it to conform to an app with regard to opening the file, without a specific extension, then there are certain things to consider.
The most important consideration is whether we are willing to go to the efforts of installing Satimage.Osax at a user’s machine in order to be sure, that the renaming of files can be a little bit more liberal, as Satimage.Osax is capable of setting the uti of a file. I have found no other Osax’en or other way to perform this particular operation.
Along side this is the fact that the only other way to bypass the lack of a way to set a uti is to set the default application of the file. This may break however if the user removes the .DS_Store file, since this information appears to be stored in the .DS_Store file of the folder where the file resides.
Conclusion
My assumption is that you want to be sure that the file can be opened with the app you have designated for the file.
Should you save the file within the scope of the app, then you can let the user choose any name he or she wants for the file. Provided the app lets you do so manually.
Should you save the file outside the scope of the application, then you can still let the user choose any name with any extension he or she likes, provided that you are willing to acertain that Satimage.Osax is installed, so that you can set the uti for the file directly “inside” the file.
Given the lack of Satimage.Osax is accepted, and that users sometimes removes their .DS_Store files, I’d recommend not allowing any filename without the proper extension for the uti of that filetype, since the extension of a file are the most important way now adays for the launch services to decide what application to use to open it with, when no uti are set explicitly for the file.