If your script makes changes to a document, you will want to save that file. This post, as will the next several posts, discuss the various ways you can do so.
From a scripting point of view, there are two possible ways to save a file. The first is deemed "simple" and the second is more complex to call and customizable. (In the FDK world, this option was deemed 'script-able.') The different between the two lies in the degree of configuration offered.
Simple operations use default settings but do offer one big choice. They allow you to choose whether you want to do the save operation with or without user interaction.
If you are doing a batch operation, you are not going to want user interaction. If, however, you are creating a command a user might call that needs user input, allowing a user to make choices regarding a save in the exact same way as he or she might had they invoked the command form the menu can be useful.
The following script invokes the save dialog using a script.
doc = app.ActiveDoc;
name = doc.Name;
doc.SimpleSave(name, true); //true signifies user directed
Here is what happens when I saved a file using this script. It is the equivalent o the user choosing File>Save.
From a scripting point of view, there are two possible ways to save a file. The first is deemed "simple" and the second is more complex to call and customizable. (In the FDK world, this option was deemed 'script-able.') The different between the two lies in the degree of configuration offered.
Simple operations use default settings but do offer one big choice. They allow you to choose whether you want to do the save operation with or without user interaction.
If you are doing a batch operation, you are not going to want user interaction. If, however, you are creating a command a user might call that needs user input, allowing a user to make choices regarding a save in the exact same way as he or she might had they invoked the command form the menu can be useful.
The following script invokes the save dialog using a script.
var doc, name;
doc = app.ActiveDoc;
name = doc.Name;
doc.SimpleSave(name, true); //true signifies user directed
Here is what happens when I saved a file using this script. It is the equivalent o the user choosing File>Save.
No comments:
Post a Comment