Skip to main content
Inspiring
March 22, 2023
Answered

JSX: Make document copy using Document.saveAs() without changing original filename

  • March 22, 2023
  • 2 replies
  • 1663 views

I need to make document copy to perform some operations on it.

Main problem, when I use  Document.saveAs() is that I loose my original filename.

 

Is there any way to saving copy of existing document with modifying original filename?

This topic has been closed for replies.
Correct answer sttk3

That is unfortunate. Have you tried the action? Dynamic actions solve many problems.

2 replies

Legend
March 22, 2023

Is it correct to mean that the problem is that when you do saveAs, the reference to the document is taken to the one you exported?

 

The solution to this problem is as follows.

  • Duplicate a file via File object before open document, open and edit it
  • Execute an action that recorded Save a Copy
Hacker-CBAuthor
Inspiring
March 23, 2023

Yes, this is exact problem.

but I can't duplicate file, because I'm calling JSX from the CEP panel and file i already opened. 
Only ome way I found is to use export for screens call.

sttk3Correct answer
Legend
March 23, 2023

That is unfortunate. Have you tried the action? Dynamic actions solve many problems.

Hacker-CBAuthor
Inspiring
March 22, 2023

* ...without modifying original filename

CarlosCanto
Community Expert
Community Expert
March 22, 2023

how are you losing your original file name?

 

SaveAs(File) takes a file as argument 1, you provide the file name and location. 

Disposition_Dev
Legend
March 22, 2023

Yes. but this name will be used as default filename for future file saving.

I want to save copy, and original file name should be left unchanged.


so you want to "save as" the current document, but you want it to save with the same name as the original document without overwriting the original file???