Does anyone know if there's an easy way to have a JavaScript save a document that has not previously been saved? For example, if I type something in a new window with the default label "Edit1", is there an easy way to have JavaScript prompt the "Save As" dialog box so the user can select a file name?
Using UltraEdit.save() returns an error if the file has not previously been saved. UltraEdit.saveAs(), without an argument, does not seem to do anything. Running the followng:
saves the file with the default name (e.g., "Edit1") automatically.
The one approach I have been able to make work is to create a tool that does basically nothing (runs a "dir" command without saving the output), but that has the "Save Active File" box checked on the Options tab. I can run this tool from JavaScript and everything works fine (the "Save As" dialog is prompted if the document has not previously been saved, and is not prompted if the file has previously been saved). But this seems like an inelegant solution, particularly if other users want to use my program (they would need to have the same tool created on their machines).
Does anyone else know an easier way to do this?
Thanks in advance, and apologies if the solution is obvious (I looked for an answer, honest).
- Ken
Using UltraEdit.save() returns an error if the file has not previously been saved. UltraEdit.saveAs(), without an argument, does not seem to do anything. Running the followng:
Code: Select all
var text = UltraEdit.activeDocument.path;
UltraEdit.saveAs(text);
The one approach I have been able to make work is to create a tool that does basically nothing (runs a "dir" command without saving the output), but that has the "Save Active File" box checked on the Options tab. I can run this tool from JavaScript and everything works fine (the "Save As" dialog is prompted if the document has not previously been saved, and is not prompted if the file has previously been saved). But this seems like an inelegant solution, particularly if other users want to use my program (they would need to have the same tool created on their machines).
Does anyone else know an easier way to do this?
Thanks in advance, and apologies if the solution is obvious (I looked for an answer, honest).
- Ken