Copy link to clipboard
Copied
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?
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
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
Hi, Laubender and Aidy_Sun,
thx for your replies. But issue is when I make a plugin with SDK, not in a script.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi,
There is a helper for this.
IPageItemNameFacade
P.
Copy link to clipboard
Copied
Hi, Dirk_Becker and Pickory,
thx for advices. I'm goint try it. I will inform you about result.
R.
Copy link to clipboard
Copied
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);
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more