Indesign scripting - Save Copy
I'm using a Objective-C Scripting Bridge to communicate with InDesign CS3/CS4. Unfortunately I'm stuck on Save command which appears to be existing only as a part of the standard suite and not defined again in InDesign. Because of that it look开发者_开发知识库s like I can Save, Save as but not Save Copy a document. Does anyone have any idea how to proceed?
Just to shortly explain the difference between Save and Save Copy - using Save Copy the current doc doesn't change which is opposite to Save or Save as.
the only other alternative other than that which philip-regan suggests. Would be to use GUI scripting but I'm still not sure what the point would be. If you wanted to save time of not closing and reopening you could save the doc make a duplicate via the finder and continue onward in indesgn with out the close and re-open bit
I always thought the distinction between Save As
and Save Copy
as being more semantic than anything because all that command is really doing is performing a Save As
but appending the file name with " copy" (e.g., "MyLayout.indd" becomes "MyLayout copy.indd"). Just use Save
as a Save Copy
alternative by giving an alternate name for the document when you save it.
Edit per OP's comments: You're right that Save Copy isn't defined in the dictionary. The only way I see around this is to mimic the command's behavior by saving to a location with a new name, closing the current-yet-renamed document, and reopening the original. Not ideal, I know, but I don't see another way around it, unless Save Copy is defined in the Javascript API, which I doubt.
Well, since Save Copy is not defined in the scripting dictionary, the only way how to proceed is to save current document a create a copy via Finder.
If you search the header file for InDesign, these are the methods that pop up:
- (InDesignDocument *) saveTo:(id)to stationery:(BOOL)stationery versionComments:(NSString *)versionComments forceSave:(BOOL)forceSave; // Save the document
- (void) saveACopyTo:(id)to stationery:(BOOL)stationery; // Saves a copy of the document.
精彩评论