• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
3

Text Variable(File Name) not getting original file name when opening document as copy

Explorer ,
Feb 09, 2024 Feb 09, 2024

Copy link to clipboard

Copied

Hello All,

I have a InDesign file which has text variable (File Name) inserted in text frame. I open indesign file as a copy of original file like below.

 

ErrorCode cmdErrCode = Utils<IDocumentCommands>()->Open(&tempCopyInDesignFileRef, inDesignIDFile, K2::kSuppressUI, IOpenFileCmdData::kOpenCopy, IOpenFileCmdData::kNotUseLockFile, kFalse);

 

Issue is when I try to get text from text frame where text variable(File Name) is set. It gives me text like “Untitled-XX” instead of original file name. 

 

Is there way I can get original file name? Please suggest.

 

Thank You

Chetan S

TOPICS
SDK

Views

286

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Mar 07, 2024 Mar 07, 2024

Because you opened a copy of the document(IOpenFileCmdData::kOpenCopy) and not the original(IOpenFileCmdData::kOpenOriginal), opened document is only in memory and not saved yet, hence its returning  default document name(Untitled-x) instead of the original document name, which is the expected behaviour. If you need to retrieve the original document name, change the open flags to IOpenFileCmdData::kOpenOriginal

Votes

Translate

Translate
Community Expert ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

Text variable "File Name" is linked - and automatically updated - to the CURRENT document - how can you expect it to be linked with the old file?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

I know even less about plugins than about JS - but isn't: 

&tempCopyInDesignFileRef

a reference to your original file?

 

Can't you get the name from it?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

2nd parameter is original IDFile

 

I am opening InDesing document and parsing its object to process. there is text frame which contains Text variable "File Name", so for that text frame I should get name of original file but I am getting “Untitled-1”.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

No, you are working on a completely NEW document - that is just a copy of the original file - all variables that are defined in the document - are pointing to the document they are in - not some old document. 

 

It's like you would expect that after creating new, blank document and doing drag&drop from another document - that values of the VARIABLES will still point to the other document.

 

Those are text VARIABLES - not constants, they change and show current information. 

 

If you add variable that shows current page - and you move it to a different page - which page number would you expect to see? 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

Yes correct, is there way I can identify where Text variable ("File Name") is applied?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

What do you mean "where"? 

 

Locations in the text? 

 

https://community.adobe.com/t5/indesign-discussions/script-to-find-variable-text-and-convert-to-text...

 

But I have no idea how to do it in plugin.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

If you want to retain name of the original / source document - you need to define this variable differently - as a "static" text - not as a variable linked to the name of the file.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

@Chetan S

 

Correct me if I'm wrong - you are good with C/C++ and someone asked you to write a plugin - but you don't use InDesign daily?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 11, 2024 Feb 11, 2024

Copy link to clipboard

Copied

yes I have written plugin in in C/C++,  I am duplicating(creating copy) InDesign file and cant use original file as I am modifying it. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

LATEST

Because you opened a copy of the document(IOpenFileCmdData::kOpenCopy) and not the original(IOpenFileCmdData::kOpenOriginal), opened document is only in memory and not saved yet, hence its returning  default document name(Untitled-x) instead of the original document name, which is the expected behaviour. If you need to retrieve the original document name, change the open flags to IOpenFileCmdData::kOpenOriginal

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines