Skip to main content
Known Participant
February 4, 2008
Question

How to Set and Get Script Label [WIN/CS3]

  • February 4, 2008
  • 8 replies
  • 1543 views
Hi All, [WIN/CS3]

How can I set and get the script label of a frame in my plugin?

I gone Through forum and found some post on it by "Ken Sadahiro"
http://www.adobeforums.com/webx/.3bbebdc3/0
and by "Bernt Haeussermann "
refer This post:

http://www.adobeforums.com/webx/.3bc37b6b/0

InterfacePtr<IScriptManager>scriptMgr(Utils<IScriptUtils>()->QueryScriptManager(kScriptTagMgrBoss));

But this line is giving error "kScriptTagMgrBoss" undeclared.

should i have to define this in .fr file if yes how can I???

scriptTagData->SetScriptList(scriptList, scriptMgr->GetRequestContext(), label); as told by Bernt.
But in CS3 it takes only two Arguments?????

can any one help how to make it working in CS3.

Thanks for the help.
This topic has been closed for replies.

8 replies

Known Participant
February 8, 2008
Hi Dirk n Bernt,

its working Now Thanks to You.I searched the whole SDK with "ScriptTagPanlID.h" and not found any thing.
I also didn't notice that "e" was missing.

Thanks again for your valuable support.
Inspiring
February 7, 2008
> what is kScriptTagMgrBoss and how to define it.it's giving undeclared.

I wrote:

> kScriptTagMgrBoss - full text search is your friend.
> #include ScriptTagPanlID.h ...

There was an "e" missing. Have a look at this file:

source/public/interfaces/architecture/ScriptTagPanelID.h

Anyway you should have found the ID using full text search.
In VStudio, type Ctrl+Shift+F and create a file set that points to your SDK. On the Mac, just click on the top right corner of your screen.

Dirk
Known Participant
February 7, 2008
Hi Bernt,
ya u have written the same thing.I am using the same code.what u Have mentioned.But problem is i am not getting
InterfacePtr<IScriptManager>scriptMgr(Utils<IScriptUtils>()->QueryScriptManager(kScriptTagMgrBoss));

so i am not able to get request context
scriptMgr->GetRequestContext();

b what is kScriptTagMgrBoss and how to define it.it's giving undeclared.

i have to include any header file for this or I have to define this in .fr????

Thanks,
Participating Frequently
February 6, 2008
Hi,

this is how I set the script-label, in this case it's on the document, but it should be rather easy to adapt it to a spline-item:

ScriptList scriptList;
InterfacePtr<IScriptManager>scriptMgr(Utils<IScriptUtils>()->QueryScriptManager(kScriptTagMgrBoss));
InterfacePtr<IScript> docScript(doc, UseDefaultIID());
scriptList.push_back(docScript);
InterfacePtr<ICommand> scriptCmd(CmdUtils::CreateCommand(kSetScriptingTagCmdBoss));
InterfacePtr<IScriptTagCmdData> scriptTagData(scriptCmd, UseDefaultIID());
scriptTagData->SetScriptList(scriptList, scriptMgr->GetRequestContext());
scriptTagData->SetTag(label);
scriptCmd->SetItemList(UIDList(docUIDRef));
scriptCmd->SetUndoability(ICommand::kAutoUndo);
ErrorCode err = CmdUtils::ProcessCommand(scriptCmd);

"doc" is an IDocument*, "docUIDRef" obviously it's UIDRef and "label" the label you want to set. And to get the label would simply be:

InterfacePtr<IScript> docScript(doc, UseDefaultIID());
label = docScript->GetTag();

I stripped the code of nil-pointer-checks for brevity. It definitely works on Win/CS3.

Good luck,

Bernt

Edit: I should've read you're links, I guess I basically wrote the same thing again ... sorry ...
Known Participant
February 6, 2008
hi Dirk,

I tried IScriptUtils::SetScriptingTag but This is asking for three parameters 1.script list 2.requestcontext 3.label.

how to get requestcontext for 2nd parameter.

and i tried header suggested by you #include "ScriptTagPanlID.h"

but it is giving its not found.

for creating labels i am using
IScriptLabel::ScriptLabelValue myTagValue("TEST_TAG", -1, PMString::kNoTranslate);

and for creating text frame i am using

UIDRef frameRef = layoutHelper.CreateTextFrame(boxUIDRef,ParentCoords,1,kFalse);

i commented out ICommand item list.but still this not working.
Inspiring
February 5, 2008
Could you please first try IScriptUtils::SetScriptingTag ?

I'm a bit short on time these days, so I can only test out the command next weekend. Therefor yesterday I did not have a look at IScriptTagCmdData before claiming you could live without request context ...

kScriptTagMgrBoss - full text search is your friend.
#include ScriptTagPanlID.h ...

Your code looks almost ok, only
- you shouldn't even have to set the ICommand item list. It helps to determine the command target though, and should just be ignored.
- These script strings are PMStrings, please apply appropriate translations.

Maybe the frameRef does not point to the correct page item, what boss is it? I'd guess it should be kSplineItemBoss, not kMultiColumnWhateverYouHave. Scripting simplifies the hierarchy!

Dirk
Known Participant
February 5, 2008
Hi Dirk,
I gone through online session 16scripting.pdf and scripting.pdf for cs2.

I am using following code and i found same in scripting pdf for setting labels.But this is not working on CS3

InterfacePtr<IScript> script(frameRef, UseDefaultIID());
ScriptList scriptList;
scriptList.push_back(script);
InterfacePtr<IScriptManager>scriptMgr(Utils<IScriptUtils>()->QueryScriptManager(kScriptTagMgrBoss));
InterfacePtr<ICommand>cmdlabel(CmdUtils::CreateCommand(kSetScriptingTagCmdBoss));
cmdlabel->SetItemList(UIDList(frameRef));
InterfacePtr<IScriptTagCmdData>ScriptTagData(cmdlabel,UseDefaultIID());
scriptTagData->SetScriptList(scriptList,scriptMgr->GetRequestContext());
IScriptLabel::ScriptLabelValue myTagValue("TEST_TAG");
scriptTagData->SetTag(myTagValue);
ErrorCode errlabl = CmdUtils::ProcessCommand(cmdlabel);

but this is not working.I am not getting what is this "kScriptTagMgrBoss".and how to declare that.

If am not using That "IScriptManager" my application is crashing while proccesing command.???

i have to write a script file for this.??????????????????

or can i do this without Script also.???????????????

Guide me how to Set And Get Labels for Frames created for indesign document. in CS3


Thanks,
Inspiring
February 4, 2008
IScriptManager and request context is only needed if you are running scripts, or if you're handling scripts from within a script provider.

To extract script labels, have a look at IScript, it is on all scriptable objects. Have a second look - some unusual inheritance here.
Yes, IScriptLabel is the base interface.

To update script labels, use kSetScriptingTagCmdBoss,
all parameters in IID_ISCRIPTTAGCMDDATA.
Probably best invoked via IScriptUtils::SetScriptingTag ...

Dirk