Skip to main content
Known Participant
May 18, 2023
Answered

how to get document name and document color model details

  • May 18, 2023
  • 1 reply
  • 715 views

hi all,

 

filename: refresh.mm

 (IBAction)refreshSelectedTab:(NSButton *)sender {

    @try

    {

        callRefresh();

    }

    @9295854(NSException *err)

    {

        NSLog(@"Err:%@",err.description);

    }

}

the above code i used to refresh the panel after clicking it on refresh button.
the panel i have created using objective-c
so i called  callRefresh(); from objective-c to c++

file name:plugin.cpp

void callRefresh()

{

  RetrieveDocumentDetails();

}

in the above code i have called  RetrieveDocumentDetails(); to retrieve the document name and document colormodel details

 

 

file name:plugin.cpp

ASErr RetrieveDocumentDetails() {

AIDocumentHandle cDocument;

    sAIDocument->GetDocument(&cDocument);

 

ai::UnicodeString documentName("");

sAIDocument->GetDocumentFileName(documentName);

std::string documentFileName = documentName.as_UTF8();

 

ai::int16 documentColorModel=0;

sAIDocument->GetDocumentColorModel(&documentColorModel);

}

 

in the above code i have used to retrieve the document name and color model details..
while retrieving document name and color models details in the function RetrieveDocumentDetails();  that is function called from objective-c to c++ , the details are not getting retrieved .

if i call the function RetrieveDocumentDetails(); without calling it from objective-c , the details will get retrieve..
if call the function RetrieveDocumentDetails(); using objective-c the details are not get retrieving .

please anyone kindly help me to solve this problem...

Thank you

This topic has been closed for replies.
Correct answer A. Patterson

You may have a context problem. See this thread for a solution if that's the case:

 

https://community.adobe.com/t5/illustrator-discussions/window-button-and-aishapeconstructionsuite-newrect-function/m-p/10292083

1 reply

A. Patterson
A. PattersonCorrect answer
Inspiring
May 18, 2023
Mahesh12Author
Known Participant
May 19, 2023

hi @A. Patterson  thanks for your reply 

it works retrieving details
but crashing while retrieving details


is there any solution to solve this