[Closed] Controlling Save
Yes it does.
I have to admit I was proven wrong, there is no such variable-path-return-stuff when it comes to the proper Max-File-Saving-Dialog.
I think you have two possibilities (hard to spell 1 am in the morning): 1. use the dialog and save the file but delete it, if it had no proper naming.
2. use the getSaveFilename Dialog and have the ability to check the string after the user hit “Save” (in this case you don’t have the fancy preview-Screen stuff as in 1.)
Anyways for the first method I’ve tried something pretty simple: Route the string back to an outer variable by a callback, afterwards check the string (e.g. by regex) and if it was wrong firing-up the save dialog again, while deleting the file. Of course this has some disadvantages if you’re dealing with LARGE files, but… it’s late and the best solution I could come up with right now.
strchecktest = undefined
fn blubber =
(
callbacks.removeScripts id:#testCallback
callbacks.addScript #filePreSave "strchecktest = callbacks.notificationParam()" id:#testCallback
(max file saveas)
if (filenameFromPath strchecktest) == "teswt.max" then
(
format "Bad formatting, try again
"
deleteFile strchecktest
(max file saveas)
)
callbacks.removeScripts id:#testCallback
)
blubber()
Thank you for your help today. Sounds like its time to get some rest haha.
I think the best solution is just making a replacement “save” and “save as” scripts.
That way I can easily just popup the open\save dialog and be able to get the users input as well as make sure it meets the required formatting.
I’ll get something together and post it for you to check out tomorrow.