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

SDK: How to get custom name of the text frame?

New Here ,
Oct 18, 2019 Oct 18, 2019

Hello, everyone,

I had ask you how I can get a custom name of a text frame. I tried to add the custom name to a layer, group, or object too, via a slow double-click on it, then type the name. (So instead of generic names.) Can I get the custom name of the text frame?

CustomName01.PNG

 

I had ITextFrameColumn frameCol from:

 

 

 

UIDRef pageItemUIDRef = aItems.GetRef(index);
InterfacePtr<IHierarchy> hier(pageItemUIDRef, UseDefaultIID());
if (Utils<IPageItemTypeUtils>()->IsTextFrame(pageItemUIDRef))
  {
  InterfacePtr<IGraphicFrameData> frameData(pageItemUIDRef, UseDefaultIID());
  UIDRef uid(::GetDataBase(mDoc), frameData->GetTextContentUID());
  InterfacePtr<IMultiColumnTextFrame> frame(uid, UseDefaultIID());
  UID tempFrameListUID = frame->GetFrameListUID();
  UIDRef tempFrameListUIDRef(::GetDataBase(mDoc), tempFrameListUID);

  InterfacePtr<IHierarchy> hier(frame, UseDefaultIID());
  int multiColumnFrameChildCount = hier->GetChildCount();

  for (int32 currIndex = idx; currIndex<idx + multiColumnFrameChildCount; currIndex++)
    {
    currentUID = frameList->GetNthFrameUID(currIndex);
    UIDRef currentRef(::GetDataBase(mDoc), currentUID);
    InterfacePtr<ITextFrameColumn> frameCol(currentRef, UseDefaultIID());
    // FRAME NAME?
    }
  }

 

 

 


When I work with a parent layers I can take a name via spreadLayer:

 

 

 

InterfacePtr<IGeometry> geo(aFrame, UseDefaultIID());
InterfacePtr<IHierarchy> hier(aFrame, UseDefaultIID());

InterfacePtr<ISpreadLayer> spreadLayer(::GetDataBase(hier), hier->GetLayerUID(), UseDefaultIID());
PMString layerName;
if (spreadLayer != nil)
  {
  spreadLayer->GetName(&layerName);
  }

 

 

 


Can you help me with how to get custom name? I did not find anything about it in the documentation, sample examples and on the forums. Thx

TOPICS
SDK
1.0K
Translate
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 ,
Oct 18, 2019 Oct 18, 2019

Hi,

with ExtendScript it would be easy:

var textFrameName = myTextFrame.name;

 

name is a simple property of the text frame object with value String.

 

Using SDK code I have no idea. Sorry.

 

Regards,
Uwe Laubender

( ACP )

Translate
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 ,
Oct 18, 2019 Oct 18, 2019
Translate
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 ,
Oct 18, 2019 Oct 18, 2019

Hi Aidy_Sun,

true. Frames also have a label property.

But when looking at the screenshot from e_rezanina you can see that the text frame is renamed using property name.

 

Regards,
Uwe Laubender

( ACP )

Translate
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
New Here ,
Oct 18, 2019 Oct 18, 2019

Hi, Laubender and Aidy_Sun,

thx for your replies. But issue is when I make a plugin with SDK, not in a script.

Translate
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
Mentor ,
Oct 18, 2019 Oct 18, 2019

IScript is unusual in that it extends IScriptLabel - easy to miss, and IScriptLabel has all the goodies.

You'll also need some IHierarchy hopping: You have ITextFrameColumn (kFrameItemBoss) but IID_ISCRIPT is on the kSplineItemBoss.

See IScriptUtils:SetScriptingTag for command wrappers.

Translate
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
Mentor ,
Oct 18, 2019 Oct 18, 2019

Coming from email, I missed the original question.

IID_IPAGEITEMNAME is also on kSplineItemBoss.

kSetPageItemNameCmdBoss needs that kSplineItemBoss on the itemlist, the new name is in IID_ISTRINGDATA.

Translate
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
Guide ,
Oct 21, 2019 Oct 21, 2019

Hi,

 

There is a helper for this. 

IPageItemNameFacade

 

P.

Translate
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
New Here ,
Oct 21, 2019 Oct 21, 2019

Hi, Dirk_Becker and Pickory,

thx for advices. I'm goint try it. I will inform you about result.

R.

Translate
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
New Here ,
Oct 21, 2019 Oct 21, 2019
LATEST

Previously, I used IPageItemNameFacade badly, because I used it on FrameUID and it was empty PMString. With correct pageItemUIDRef is work correctly.

 

UIDList aItems;
...
UIDRef pageItemUIDRef = aItems.GetRef(index);
PMString assignedPageItemName = Utils<Facade::IPageItemNameFacade>()->GetUserAssignedPageItemName(pageItemUIDRef);
Translate
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