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

Get the document name in C++

Community Beginner ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

Can anyone guide me with getting the document name using C++ and I have the attached the code please guide me if it goes wrong.

IDocument* document = Utils<ILayoutUIUtils>()->GetFrontDocument();
if (document == nil)
{
CAlert::InformationAlert(“no document opened”);
break;
}
else
{
IDocument* docname = Utils<ILayoutUIUtils>()->GetFrontDocument();
// doc = document->GetDocument();
docname = doc->GetDocumentName();
CAlert::InformationAlert(“Document opened );
}

P.S: In this I have used “IDocument.h” header file but it shows an error listed below

1>..\..\..\source\sdksamples\CustomHttpLinkUI\CustomHttpLinkUIObserver.cpp(178): error C2039: ‘GetDocument’: is not a member of ‘IDocument’
1>C:\Users\user\Desktop\sdk 2020\sdk 2020\plugin_sdk_15.0.0.155 old\plugin\source\public\interfaces\architecture\IDocument.h(37): note: see declaration of ‘IDocument’
1>..\..\..\source\sdksamples\CustomHttpLinkUI\CustomHttpLinkUIObserver.cpp(180): error C2001: newline in constant
1>..\..\..\source\sdksamples\CustomHttpLinkUI\CustomHttpLinkUIObserver.cpp(181): error C2059: syntax error: ‘}’

Rajendran
TOPICS
How to , SDK

Views

838

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

Community Expert , May 04, 2020 May 04, 2020

For the second and third error the issue is that you have an an unclosed string literal. The last line mentioned below

CAlert::InformationAlert(“Document opened );

Does not have a closing quote for the string literal and hence it is being interpreted as a string constant continuing on a newline which is not allowed in this manner

 

-Manan

Votes

Translate

Translate
Community Expert ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

What is cofusing here, look into the IDocument.h file and see what functions are available. I also can't see the GetDocument method mentioned in the header file. The method that should work for you seem to be GetName

virtual void IDocument::GetName(PMString & name) const

 

-Manan

 

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 Beginner ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

But it doesn't work correctly the same error get repeated for twice..So that I have refer another fourm to get the document name

 

https://community.adobe.com/t5/indesign/indesign-cs3-how-to-get-the-current-document-name/td-p/13680...

 

but it shows an error

 

 

Rajendran

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 ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

For the second and third error the issue is that you have an an unclosed string literal. The last line mentioned below

CAlert::InformationAlert(“Document opened );

Does not have a closing quote for the string literal and hence it is being interpreted as a string constant continuing on a newline which is not allowed in this manner

 

-Manan

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 Beginner ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Hi,

While getting the current document name I have found this error. Here by I have attached the code .And I don't know how to resolve it.Please guide me.

#include "IDocumentUIUtils.h"
#include "IDocument.h"
#include "IDocumentList.h"
#include "DocumentID.h"
#include "IDocumentUtils.h"

 

IDocument *docFrom = Utils<ILayoutUIUtils>()->GetFrontDocument();
if (docFrom == NULL)
break;
PMString pDoc = GetDocFromUIDRef(GetUIDRef(docFrom));

 

error C3861: 'GetDocFromUIDRef': identifier not found

Rajendran

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 ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

I can't see the method GetDocFromUIDRef listed in the SDK, where did you get this method from? Is this function defined in your code? If that is the case then you will have to include the header file that has the declaration to this method to your cpp file which has the code you listed above and also compile(if needed)/link the object file that has the defintion of GetDocFromUIDRef to your plugin project.

 

Also i see that you are reposting the same question again on the forum that has already been answered, please maintain decorum of the space and don't open duplicate posts.

https://community.adobe.com/t5/indesign/get-the-document-name-in-c/td-p/11103118?page=1

If you are having issues post it on the original question and provide more details on what you did and what is not working for you

 

-Manan

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 Beginner ,
May 08, 2020 May 08, 2020

Copy link to clipboard

Copied

LATEST

Hi all,

I got the document name in the form of alert box but I need to displa the document name value into editbox can someone provide me the solution and guide me

 

Regards,

Rajendran

 

 

Rajendran

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