CAlert::InformationAlert
Hi all,
I m new to Indesign Programming.
(InDesign CS3 on Win XP)
I m trying to test "BasicMenu" (a sample file in SDK)
I found some codes:
/* DoAlwaysOn
void BscMnuActionComponent::DoAlwaysOn()
CAlert::InformationAlert(kBscMnuAlwaysOnStringKey);
/* DoOnIfFrontDoc
void BscMnuActionComponent::DoOnIfFrontDoc()
CAlert::InformationAlert(kBscMnuOnIfFrontDocStringKey);
/* DoNeedsSelection
void BscMnuActionComponent::DoNeedsSelection()
CAlert::InformationAlert(kBscMnuNeedsSelectionStringKey);
When I click the plug-in menu, it display respectively:
"Activation of the 'Always enabled' menu item.[US]"
"Activation of the 'Needs front doc' menu item.[US]"
"Activation of the 'Needs layout selection' menu item.[US]"
I am very puzzled with it, I just only found the "Other StringKeys" in
"BscMnuID.h",
// Other StringKeys:
#define kBscMnuAboutBoxStringKey kBscMnuStringPrefix
"kBscMnuAboutBoxStringKey"
#define kBscMnuAlwaysOnStringKey kBscMnuStringPrefix
"kBscMnuAlwaysOnStringKey"
#define kBscMnuOnIfFrontDocStringKey kBscMnuStringPrefix
"kBscMnuOnIfFrontDocStringKey"
#define kBscMnuNeedsSelectionStringKey kBscMnuStringPrefix
"kBscMnuNeedsSelectionStringKey_"
Where are the displayed messages are defined? Can anybody help~~~
Thanks!
Carl
/* DoAlwaysOn
/ void BscMnuActionComponent::DoAlwaysOn()
PMString YourString("Your Message");
YourString.SetTranslatable(kFalse);
CAlert::InformationAlert(YourString);
u can define it like this...
Harry
Similar Messages
-
How to get a value from JavaScript
How to get return value from Java Script and catch it in c++ code. I have tried following code, but its not working in my case.
what I want is if it returns true then call some function if it returns false then do nothing, so how to get those values in c++
ScriptData::ScriptDataType fDataType = resultData.GetType();
if (fDataType == kTrue)
CAlert::InformationAlert("sucess");
//call some function
else
CAlert::InformationAlert("Error");
// do nothing
JavaScript Code:
if(app.scriptArgs.isDefined("paramkeyname1"))
var value = app.scriptArgs.get("paramkeyname1");
alert(value);
return true;
else
alert ("SORRY");
return false;How to get java script result into JSResult i m not getting it.
I have wriiten follwing code in c++ :
WideString scriptPath("\\InDesign\\Source1.jsx");
IDFile scriptFile(scriptPath);
InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
if(scriptRunner)
ScriptRecordData arguments;
ScriptIDValuePair arg;
ScriptID aID;
ScriptData script(scriptFile);
ScriptData resultData;
PMString errorString;
KeyValuePair<ScriptID,ScriptData> ScriptIDValuePair(aID,script);
arguments.push_back(ScriptIDValuePair);
PMString paramkeyname1;
Utils<IScriptArgs>()->Save();
Utils<IScriptArgs>()->Set("paramkeyname1",scriptPath);
Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner,script,arguments,resultData,erro rString,kFalse);
Utils<IScriptArgs>()->Restore();
ScriptData::ScriptDataType fDataType = resultData.GetType(); // here i should get true or false which i m passing it from javascript code......not as s_boolean
if (fDataType == kTrue)
//CAlert::InformationAlert("sucess");
iOrigActionComponent->DoAction(ac, actionID, mousePoint, widget);
else
this->PreProcess(PMString(kCstAFltAboutBoxStringKey));
Java script code:
function main()
var scrpt_var;
var scriptPath,scrptMsg;
var frntDoc=app.documents[0];
if(app.scriptArgs.isDefined("paramkeyname1"))
var value = app.scriptArgs.get("paramkeyname1");
alert(value);
return true; // i want this value i should get in c++ code...How to get these values in c++
else
alert ("Error");
return false; // i want this value i should get in c++ code...How to get these values in c++ -
How to enable the widgets in Indesign CC..?
Hi,
I am working on porting our Indesign CS6 plugin to Indesign CC plugin.I have completed the porting and the plugins has opened in Indesign CC,but i have one problem in design. Three of our Widgets has not opened in Indesign CC.
The code is the following,
.fr file
resource SampleDialogWidget (kSDKDefDialogResourceID + index_enUS)
__FILE__, __LINE__,
kSampleDialogWidgetID, // WidgetID
kPMRsrcID_None, // RsrcID
kBindNone, // Binding
0, 0, 700,400, // Frame (l,t,r,b)
kTrue, kTrue, // Visible, Enabled
kSampleDialogTitleKey, // Dialog name
//<FREDDYWIDGETDEFLISTUS>
SamplePrefListBox
SamplePreflistboxWidgetID,
kSysOwnerDrawListBoxPMRsrcId, // WidgetId, RsrcId
kBindAll, // Frame binding
Frame(15,15,170,360) // Frame
kTrue, kTrue, // Visible, Enabled
1,0, // List dimensions
19, // Cell height
1, // Border width
kFalse,kTrue, // Has scroll bar (h,v)
kTrue, // Multiselection
kTrue, // List items can be reordered
kTrue, // Draggable to new/delete buttons
kTrue, // Drag/Dropable to other windows
kTrue, // An item always has to be selected
kFalse, // Don't notify on reselect
kSamplePrefListElementRsrcID // Fill list box with widgets with this ID (default is 0)
CellPanelWidget
kCellPanelWidgetID, kPMRsrcID_None, // WidgetId, RsrcId
kBindAll, // Frame binding
Frame(-1,1,154,340) // Frame
kTrue, kTrue // Visible, Enabled
// ----- This is the CPanelControlData that holds the widgets
// that are items in the list box. They are not persistent
GenericPanelWithBorderWidget
SamplePrefGeneralTabWidgetID, kPMRsrcID_None,
kBindBottom |kBindRight,
Frame(175,10,695,360) // Frame
kTrue, kTrue,
StaticTextWidget
kInvalidWidgetID, // WidgetId (default=0)
kSysStaticTextPMRsrcId, // RsrcId
kBindNone, // Frame binding
10, 15, 138, 35, // Frame: left, top, right, bottom.
kTrue, kTrue, // Visible, Enabled
kAlignLeft, kEllipsizeEnd,kTrue, // Alignment, ellipsize style
kSamplePrefProjectPathStringKey, // Initial text.
kSamplePrefProjectPathTextEditBoxWidgetID // No associated widget
// TextEditBox Widget resource
TextEditBoxWidget
kSamplePrefProjectPathTextEditBoxWidgetID, // WidgetId
kSysEditBoxPMRsrcId, // RsrcId
kBindNone, // Frame binding
Frame(140, 15, 420, 35), // Frame (l,t,r,b)
kTrue, kTrue // Visible, Enabled
0, // Widget id of nudge button (0 so we dont get one)
0, 0,// small,large nudge amount
0, // max num chars(0 = no limit)
kFalse,// is read only
kFalse,// should notify each key stroke
kFalse,// range checking enabled
kFalse,// blank entry allowed
0, // Upper bounds
0, // Lower bounds
"", // Initial text
ButtonWidget
kSampleChooseProjectButtonWidgetID,
kSysButtonPMRsrcId,
kBindNone,
430, 15, 500, 35,
kTrue, kTrue,
kSampleChooseBtnStringKey,
GenericPanelWithBorderWidget
SamplePrefFittingTabWidgetID, kPMRsrcID_None,
kBindBottom |kBindRight,
Frame(175,10,695,360) // Frame
kTrue, kTrue,
StaticTextWidget
kInvalidWidgetID, // WidgetId
kSysStaticTextPMRsrcId, // RsrcId
kBindNone, // Frame binding
Frame( 10,15,300,35 ), // Frame (l,t,r,b)
kTrue, kTrue, kAlignLeft, // Visible, Enabled, Alignment
kDontEllipsize,kTrue, //**new element in InDesign 2.0: don't add any ellipses
"Drag/Drop Operation", // Text
0// WidgetId for associated control for shortcut focus
SeparatorWidget
0,
kPMRsrcID_None,
kBindNone,
Frame(10,37,450,38),
kTrue,kTrue,
StaticTextWidget
0, // WidgetId
kSysStaticTextPMRsrcId, // RsrcId
kBindNone, // Frame binding
Frame( 10, 40, 250, 60 ), // Frame (l,t,r,b)
kTrue, kTrue, kAlignLeft, // Visible, Enabled, Alignment
kDontEllipsize,kTrue, //**new element in InDesign 2.0: don't add any ellipses
kSampleTextOptionsTextKey, // Text
0 // WidgetId for associated control for shortcut focus
CheckBoxWidget
kSampleTextFitCheckBoxWidgetID, // WidgetId
kSysCheckBoxPMRsrcId, // RsrcId
kBindNone,
Frame(150, 40, 350, 60) // left, top, right, bottom
kTrue, // Visible
kTrue, // Enabled
kAlignLeft, // Alignment
kSampleTextFitChkBoxTextKey // Initial text
GenericPanelWithBorderWidget
SamplePrefScriptEventsTabWidgetID, kPMRsrcID_None,
kBindBottom |kBindRight,
Frame(175,10,695,360) // Frame
kTrue, kTrue,
StaticTextWidget
0, // WidgetId (default=0)
kSysStaticTextPMRsrcId, // RsrcId
kBindNone, // Frame binding
10, 10, 200, 30, // Frame: left, top, right, bottom.
kTrue, kTrue, // Visible, Enabled
kAlignLeft, kEllipsizeEnd,kTrue, // Alignment, ellipsize style
kSampleDropDownEventsTextKey, // Initial text.
0 // No associated widget
SamplePrefListBox
SamplePrefDragDropScriptlistboxWidgetID, kSysOwnerDrawListBoxPMRsrcId, // WidgetId, RsrcId
kBindAll, // Frame binding
Frame(10, 35, 200, 120) // Frame
kTrue, kTrue, // Visible, Enabled
1,0, // List dimensions
19, // Cell height
1, // Border width
kFalse,kTrue, // Has scroll bar (h,v)
kTrue, // Multiselection
kTrue, // List items can be reordered
kTrue, // Draggable to new/delete buttons
kFalse, // Drag/Dropable to other windows
kTrue, // An item always has to be selected
kFalse, // Don't notify on reselect
k SamplePrefListElementRsrcID // Fill list box with widgets with this ID (default is 0)
CellPanelWidget
kCellPanelWidgetID, kPMRsrcID_None, // WidgetId, RsrcId
kBindAll, // Frame binding
Frame(-1,1,187,243) // Frame
kTrue, kTrue // Visible, Enabled
// ----- This is the CPanelControlData that holds the widgets
// that are items in the list box. They are not persistent
ButtonWidget
SamplePrefDragDropScriptAddBtnWidgetID,
kSysButtonPMRsrcId,
kBindNone,
20, 125, 90, 145,
kTrue, kTrue,
kSampleAddScriptButtonTextKey,
ButtonWidget
SamplePrefDragDropScriptRemoveBtnWidgetID,
kSysButtonPMRsrcId,
kBindNone,
100, 125, 180, 145,
kTrue, kTrue,
kSampleRemoveScriptButtonTextKey,
Elements added:
void SampleDialogController::PopulatePrefListElement()
do
InterfacePtr<IPanelControlData> iPanelControlData(this, UseDefaultIID());
ASSERT(iPanelControlData);
if(!iPanelControlData) {CAlert::InformationAlert("IPanelControlData err");break;}
SDKListBoxHelper listHelper(iPanelControlData,kSamplePluginID, SamplePreflistboxWidgetID, kSampletDialogWidgetID);
IControlView * listBox = listHelper.FindCurrentListBox();
if(listBox == nil) {
CAlert::InformationAlert("listBox err");
break;
listHelper.EmptyCurrentListBox();
InterfacePtr<IListBoxController> listCntl(listBox,IID_ILISTBOXCONTROLLER); // useDefaultIID() not defined for this interface
ASSERT_MSG(listCntl != nil, "listCntl nil");
if(listCntl == nil) {
CAlert::InformationAlert("IListBoxController err");
break;
//Addin the string to the listbox
const int targetDisplayWidgetId =SamplePrefOptionTextWidgetID;
listHelper.AddElement("General", targetDisplayWidgetId);
listHelper.AddElement("Fitting", targetDisplayWidgetId);
listHelper.AddElement("Events and Scripts", targetDisplayWidgetId);
listCntl->DeselectAll();
}while(0);
I dont know how to enable these three widgets in Indesign CC.please refer this code and help me if anyone has idea regarding this problem.
Thanks in advance,
Vimala LHi,
As per ur suggestion,i have done the below changes
.fr file:
type SamplePrefListBox
(kViewRsrcType) : StdListBoxWidgetN
(ClassID = kStdListBoxWidgetNewBoss)
Class
kSamplePrefListBoxWidgetBoss,
kStdListBoxWidgetNewBoss,
IID_IOBSERVER,kSamplePrefListBoxObserverImpl,
resource SampleDialogWidget (kSDKDefDialogResourceID + index_enUS)
__FILE__, __LINE__,
kSampleDialogWidgetID, // WidgetID
kPMRsrcID_None, // RsrcID
kBindNone, // Binding
0, 0, 700,400, // Frame (l,t,r,b)
kTrue, kTrue, // Visible, Enabled
kSampleDialogTitleKey, // Dialog name
//<FREDDYWIDGETDEFLISTUS>
SamplePrefListBox
SamplePreflistboxWidgetID,
kSysOwnerDrawListBoxPMRsrcId, // WidgetId, RsrcId
kBindAll, // Frame binding
Frame(15,15,170,360) // Frame
kTrue, kTrue, // Visible, Enabled
kTrue, //Erase before draw
kInterfacePaletteFill, //Interface color
1,0, // List dimensions
19, // Cell height
1, // Border width
kFalse,kTrue, // Has scroll bar (h,v)
kTrue, // Multiselection
kTrue, // List items can be reordered
kTrue, // Draggable to new/delete buttons
kTrue, // Drag/Dropable to other windows
kTrue, // An item always has to be selected
kFalse, // Don't notify on reselect
0,
0,
kFalse, // Display root node
kFalse, // Use Horizontal scroll bar
kTrue, // Use vertical scroll bar
19, // Vertical scroll button increment
1, // Vertical thumb scroll increment
0, // Horizontal scroll button increment
0, // Horizontal thumb scroll increment
1, // Items selectable 1 = Single selection
kFalse, // Allow children from multibler parents to be selected
kTrue //, // Allow discontiguous selection
I got error...,error R32745: # Error: Expected ')'
SamplePrefListBoxObserver file:
void SamplePrefListBoxObserver::AutoAttach()
InterfacePtr<ISubject> subject(this, UseDefaultIID());
if (subject != nil)
subject->AttachObserver(this, IID_ILISTCONTROLDATA);
void SamplePrefListBoxObserver::AutoDetach()
InterfacePtr<ISubject> subject(this, UseDefaultIID());
if (subject != nil)
subject->DetachObserver(this, IID_ILISTCONTROLDATA);
void SamplePrefListBoxObserver::Update(const ClassID& theChange,ISubject* theSubject,const PMIID &protocol,void* changedBy)
do {
InterfacePtr<IPanelControlData> iPanelControlData(this, UseDefaultIID());
if(!iPanelControlData)
{CAlert::InformationAlert("iPanelControlData err");break;}
InterfacePtr<IWidgetParent> iWidgetParent(this, UseDefaultIID());
ASSERT(iWidgetParent);
if(!iWidgetParent)
{CAlert::InformationAlert("iWidgetParent err");break;}
InterfacePtr<IPanelControlData> iPanelControlDataDialog(
(IPanelControlData*)iWidgetParent->QueryParentFor(IID_IPANELCONTROLDATA) );
if(!iPanelControlDataDialog)
{CAlert::InformationAlert("iPanelControlDataDialog err");break;}
InterfacePtr<IControlView> view(theSubject, UseDefaultIID()) ;
if (view == nil)
{CAlert::InformationAlert("Can't find the panel control view");break;}
if (view->GetWidgetID() != SamplePreflistboxWidgetID)
if(view->GetWidgetID() == SamplePrefDragDropScriptlistboxWidgetID)
this->DeSelectList(iPanelControlDataDialog,SamplePrefUpdateScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefImportScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefAutoFlowScriptlistboxWidgetID);
else if(view->GetWidgetID() == SamplePrefUpdateScriptlistboxWidgetID)
this->DeSelectList(iPanelControlDataDialog,SamplePrefDragDropScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefImportScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefAutoFlowScriptlistboxWidgetID);
else if(view->GetWidgetID() == SamplePrefImportScriptlistboxWidgetID)
this->DeSelectList(iPanelControlDataDialog,SamplePrefDragDropScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefUpdateScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefAutoFlowScriptlistboxWidgetID);
else if(view->GetWidgetID() == SamplePrefAutoFlowScriptlistboxWidgetID)
this->DeSelectList(iPanelControlDataDialog,SamplePrefDragDropScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefUpdateScriptlistboxWidgetID);
this->DeSelectList(iPanelControlDataDialog,SamplePrefImportScriptlistboxWidgetID);
if ((protocol == IID_ILISTCONTROLDATA) && (theChange == kListSelectionChangedByUserMessage) )
if (view->GetWidgetID() ==SamplePreflistboxWidgetID)
IControlView* generaltab = iPanelControlDataDialog->FindWidget(SamplePrefGeneralTabWidgetID);
if(!generaltab)
{CAlert::InformationAlert("generaltab err");break;}
IControlView* fittingTab = iPanelControlDataDialog->FindWidget(SamplePrefFittingTabWidgetID);
if(!fittingTab)
{CAlert::InformationAlert("fittingTab err");break;}
IControlView* scriptEventTab = iPanelControlDataDialog->FindWidget(SamplePrefScriptEventsTabWidgetID);
SDKListBoxHelper listHelper(iPanelControlData,kSamplePluginID, SamplePreflistboxWidgetID, kSampleDialogWidgetID);
IControlView * listBox = listHelper.FindCurrentListBox();
if(listBox == nil){CAlert::InformationAlert("listBox err");break;}
InterfacePtr<IListBoxController> listCntl(listBox,IID_ILISTBOXCONTROLLER);
if(listCntl == nil) {break;}
int32 Selindex = listCntl->GetSelected();
if(Selindex!=-1){
InterfacePtr<IPanelControlData> panelControlData1(listBox, UseDefaultIID());
if(!panelControlData1) {break;}
IControlView* cellPanelview = panelControlData1->FindWidget(kCellPanelWidgetID);
InterfacePtr<IPanelControlData> panelControlData2(cellPanelview, UseDefaultIID());
if(!panelControlData2) {break;}
IControlView* cellView = panelControlData2->GetWidget(Selindex);
InterfacePtr<IPanelControlData> panelControlData3(cellView, UseDefaultIID());
if(!panelControlData2) {break;}
IControlView* textView = panelControlData3->FindWidget(SamplePrefOptionTextWidgetID);
InterfacePtr<ITextControlData> cellText (textView, UseDefaultIID());
PMString selectedItem = cellText->GetString();
if(selectedItem=="General")
generaltab->ShowView();
fittingTab->HideView();
scriptEventTab->HideView();
else if(selectedItem=="Fitting Options")
generaltab->HideView();
fittingTab->ShowView();
scriptEventTab->HideView();
else if(selectedItem=="Events and Scripts")
generaltab->HideView();
fittingTab->HideView();
scriptEventTab->ShowView();
} while(0);
void SamplePrefListBoxObserver::DeSelectList(IPanelControlData* iPanelControlData,WidgetID listBoxWidgetID)
do
SDKListBoxHelper listHelper(iPanelControlData,kSamplePluginID, listBoxWidgetID, kSamplePanelWidgetID);
IControlView * listBox = listHelper.FindCurrentListBox();
if(listBox == nil) {
CAlert::InformationAlert("listBox err");
break;
InterfacePtr<IListBoxController> listCntl(listBox,IID_ILISTBOXCONTROLLER); // useDefaultIID() not defined for this interface
ASSERT_MSG(listCntl != nil, "listCntl nil");
if(listCntl == nil) {
CAlert::InformationAlert("IListBoxController err");
break;
listCntl->DeselectAll(kTrue,kFalse);
}while(0);
please refer the above code and help me to develop the plugin.
We have used the SDKListBoxHelper file in our plugin.If it works in Indesign CC?
Thanks,
Vimala L -
InDesign CS6 Plug-in development problem
Hello,
IDE:Visual Studio 2010
Platform:Windows7-32
Version:Indesign CS6
Database:MySql-5.0.67-win32
ODBC:ODBC-5.1
The source code:
URI uri("odbc://New/?table=jo_user#user_id,username,reset_key,activation,register_time,login_ count");//int,varchar,tinytext,tinyint,datetime,longtext
SDKODBCWrapper odbc;
if (ISDKODBCWrapper::ODBCNormal == odbc.Query(uri))
int32 ColumnNum = odbc.GetNumberOfColumns();
for(int32 cNum=0; cNum<ColumnNum; cNum++)
ISDKODBCWrapper::ItemType retType = odbc.GetMthColumnInfo(cNum, std::string(""));
if (retType == ISDKODBCWrapper::kIntegerType)
CAlert::InformationAlert("kIntegerType");
else if (retType == ISDKODBCWrapper::kDoubleType)
CAlert::InformationAlert("kDoubleType");
else if (retType == ISDKODBCWrapper::kStringType)
CAlert::InformationAlert("kStringType");
else if (retType == ISDKODBCWrapper::kTimeStampType)
CAlert::InformationAlert("kTimeStampType");
else
CAlert::InformationAlert("Others or NULL");
else
CAlert::InformationAlert("Link ODBC error");
I have already successfully connect to the database,but why I can only get kIntegerType and kTimeStampType?
why varchar tinytext tinyint longtext are show kIntegerType?
someone please guide me...
Thank you very much.
消息编辑者为:IIASCIIuse ODBC-3.5.1 over
-
InDesign CS/CS2 Mac - making a target-specific macro
Hello.
This is more a CodeWarrior question than an InDesign question, but because the difficulty is caused by the SDK, I am asking the question here. If anyone objects to the question, I recommend not responding.
I want to do this in one of my projects (greatly simplified code to illustrate concept only):
void MyCall(PMString AString)
#ifdef PRE_RELEASE_VERSION
CAlert::InformationAlert(AString);
#endif
I want to set up my project so that if I am running a prerelease version of my plugin, PRE_RELEASE_VERSION is automatically defined by a compiler flag.
In Visual Studio this is simplicity, itself. The flag is something like /DPRE_RELEASE_VERSION. I can include it in the Preprocessor definitions field in the Properties pane. In XCode, a similar feature is present. But I have spent the last two hours studying CW8 and CW9 for a similar ability, and the closest I can come is to modify the SDKPluginPrefix.h file, which is the file automatically placed by Dolly in the Prefix File field of the C++ Language pane in the CW Target Settings Panels.
The problem is that we are not allowed to modify the SDK, as part of the rules we agree to when we download the SDK. Now, I suspect that if I did modify the SDKPluginPrefix.h file to include an additional #define statement, I doubt that Adobe would come hunting me down, nevertheless, I would rather honor that agreement.
Another possibility is some elaborate scheme of header files included in only one target, etc, but I would rather seek simplicity, if at all possible.
Is there
b any other way
to set up a macro in CW for a single target only?
TIA!
Johnif you are using CW8, click on the target settings on the Project Window. Under the Language Settings > C/C++ Language, enter your own "Prefix File" name. In this of your own prefix file, #include "SDKPluginPrefix.h" and enter whatever you feel like defining.
In CW 9, click on the target settings, too but look for C/C++ Preprocessor. do your #define there.
Since these are per target settings, you will need to do the same for all the targets.
HTH.
pete -
How to get pagenumber from a anchored rectangle?
Hi all!
I want to know the pagenumber from a rectangle, which is anchored inside a textframe.
I've got the UID from this rectangle.
Thanks!It works!
UIDList selectedItems;
ErrorCode errorCode;
PMString strPageNumber;
IDocument* iDocument = Utils<ILayoutUIUtils>()->GetFrontDocument();
if (iDocument == nil) { CAlert::ErrorAlert("iDocument == nil"); break; }
// Get the document's database
IDataBase* iDatabase = ::GetDataBase((IPMUnknown*)iDocument);
if (iDatabase == nil) { CAlert::ErrorAlert("iDatabase == nil"); break; }
InterfacePtr<ISelectionManager> iSelectionManager(Utils<ISelectionUtils>()->QueryActiveSelection());
if (iSelectionManager == nil) { CAlert::ErrorAlert("iSelectionManager == nil"); break; }
InterfacePtr<IHelloWorldSuite> iHelloWorldSuite(iSelectionManager, UseDefaultIID());
if (iHelloWorldSuite == nil) { CAlert::ErrorAlert("iHelloWorldSuite"); break; }
// Here I get the UID of the inline frame over selection
errorCode = iHelloWorldSuite->GetSelectedFrameUIDList(selectedItems);
if (errorCode == kFailure) break;
Utils<ILayoutUtils> iLayoutUtils;
// Get the hierarchy
InterfacePtr<IHierarchy> iHierarchy(iDatabase, selectedItems[0], UseDefaultIID());
if (iHierarchy == nil) { CAlert::ErrorAlert("iHierarchy == nil"); break; }
// Get the page UID
UID ownerPageUID = iLayoutUtils->GetOwnerPageUID(iHierarchy);
// Get page number string
InterfacePtr<IPageList> iPageList((IPMUnknown*)iDocument, UseDefaultIID());
if (iPageList == nil){ CAlert::ErrorAlert("iPageList == nil"); break; }
iPageList->GetPageString(ownerPageUID, &strPageNumber);
// Show page number string
CAlert::InformationAlert(strPageNumber); -
Hello. <br /><br />Im in the process of converting a CS2 plugin to CS3. <br />In the CS2 variant I use the kMoveRelativeCmdBoss & IMoveRelativeCmdData to move the contents on my document, like this... <br /><br />//------------------------------------------------------------------------ <br />void CreateAndProcessMoveRelativeCmd( <br />const UIDList& itemListToMove, <br />const PMPoint& thePoint, <br />ITransform::TransformAction action, <br />bool16 shouldPreNotify) <br />//------------------------------------------------------------------------ <br />{ <br />// Create a MoveRelativeCmd: <br />InterfacePtr<ICommand> moveCmd(CmdUtils::CreateCommand(kMoveRelativeCmdBoss)); <br /><br />// Set the MoveRelativeCmdÕs ItemList: <br />moveCmd->SetItemList(itemListToMove); <br /><br />// Get an IMoveRelativeCmdData Interface for the MoveRelativeCmd: <br />InterfacePtr<IMoveRelativeCmdData> moveData(moveCmd, IID_IMOVERELATIVECMDDATA); <br /><br />// Get an IBoundsData Interface for the MoveRelativeCmd: <br />InterfacePtr<IBoundsData> boundsData(moveCmd, IID_IBOUNDSDATA); <br /><br />// Set the IMoveRelativeCmdData Interface's data: <br />moveData->Set(thePoint, action, shouldPreNotify); <br /><br />// Process the MoveRelativeCmd: <br />if (CmdUtils::ProcessCommand(moveCmd) != kSuccess) <br />CAlert::InformationAlert(kErrorCantMoveItemRelativeTo); <br />} <br /><br />However in CS3 the IMoveRelativeCmdData have dissappeared and the action constant declared in ITransform has also vanished. What has replaced this Cmd & CmdData? <br /><br />Grateful for any ideas. <br /><br />Carl Johan Rydberg
Hi Carl,<br /><br />Take a look in the <i>porting-guide</i> PDF file that's in the <IDCS3SDK>/docs/guides folder. Specifically look at the section entitled <i>Transform and Geometry API Changes</i> on Page 43. The transform stuff has changed significantly in CS3.<br /><br />I hope this helps!<br /><br />-- Jim
-
[IDCS2 Win]Indesign Crashes after Reading Swatches Panel!
Hi,<br /><br />I have to get the count of Swatches that are "clicked or selected" in the Swatches Panel.<br /><br />Here is the Code i tried:<br /><br />InterfacePtr<IApplication>application(gSession->QueryApplication());<br /> <br />InterfacePtr<IPaletteMgr> paletteMgr(application->QueryPaletteManager());<br /> <br />InterfacePtr<IPanelMgr> panelMgr(paletteMgr, UseDefaultIID());<br /><br />InterfacePtr<IControlView>swatchPanelView(panelMgr->GetVisiblePanel(kSwatchesPanelWidge tID ));<br /><br />InterfacePtr<ISwatchesUIDData> SwatchUID(swatchPanelView,IID_ISWATCHESUIDLIST ); <br /> <br />SwatchList=SwatchUID->GetItemList();<br /> <br />NumSelectedSwatches.AppendNumber(SwatchList.Length());<br />CAlert::InformationAlert(NumSelectedSwatches);<br /><br />I get the count of swatches that are clicked when i run my plugin for the first time.But when i again select some other swatches &run my plugin i get the exact count of swatches selected but Indesign Crashes Suddenly!<br />Why this happens where am i going wrong?<br /><br />Help needed very urgent!<br />Thanks<br />myRiaz
IControlView* swatchPanelView = panelMgr->GetVisiblePanel(kSwatchesPanelWidgetID );
Methods Get() rather than Query() do not imply an AddRef. -
[CS6]Get the app version in which the document was first created
Hi All,
Is there a way to get the application version in which the document was first created?
Eg: I have a CS6 plugin in which I want to know wether the current document was originally created in CS3 or CS5 or so on.
Any help will be highly appreciated.I hope that's what you're looking for
const char* szFileName = "path_to_indd_file";
FILE* pFile = fopen(szFileName, "rb");
fseek(pFile, 0x1D, SEEK_CUR);
int32 ver_maj, ver_min;
fread(&ver_maj, sizeof(int32), 1, pFile);
fread(&ver_min, sizeof(int32), 1, pFile);
switch (ver_maj)
case 5:
CAlert::InformationAlert("CS3");
break;
case 6:
CAlert::InformationAlert("CS4");
case 7:
ver_min == 5? CAlert::InformationAlert("CS5.5"): CAlert::InformationAlert("CS5") ;
break;
case 8:
CAlert::InformationAlert("CS6");
break;
case 9:
CAlert::InformationAlert("CC");
break;
default:
CAlert::InformationAlert("Unknown version");
break;
fclose(pFile);
Regards
Bartek -
[Mac/CC 2014] modal dialogs can't be displayed
Hi everybody,
I have ported a plugin from CS6 to CC2014, which works fine for almost everything, except one. Modal dialogs seems not to work anymore. For example, this code:
CAlert::InformationAlert(PMString("Hey, display me!"));
makes InDesign freezing. More precisely, InDesign displays a while rectangle, which seems to be the modal dialog. But there is nothing more, juste this white rectangle. I can move it, but can't interact with it. As it is a modal dialog, the application refuses all further interaction, and I can't close that modal.
I have noticed this behavior was the same with, for example, a Yes/No modal dialog. I suppose this happens on every modal dialog types.
Is there anything that can cause a modal dialog not to be able to display correctly?
Some pieces of informations on versions :
OS : Mac OS 10.9.4
InDesign : 10.1.0.71
Thanks to anybody providing any piece of advice.
RémiMust have opened my eyes after waking up...
I think I guessed what happens. This modal dialog is called from a model plugin, which works in CS6. I guess Adobe has removed support on anything that is UI-related in model plugin. But instead of generating an error, it makes some mess. I'll try to move the piece of code surrounding the modal dialog call to my UI plugin and see what happens. -
Does IObserver required while I have my own observer interfaceID / implementation?
Hi All
I have created a class for a button as below and not used IID_IOBSERVER. It didn't work for me. But the same thing works with sdk sample 'snippetrunner' for 'GoButton'. Do I need to define my own Interface while I use my own IID?
Class
kMSRDoButtonBoss,
kRollOverIconButtonBoss,
IID_IMSRDOBUTTONOBSERVER, kMSRDoButtonObserverImpl,
---- MSRDoButtonObserver.cpp ---
class MSRDoButtonObserver : public CObserver
public:
MSRDoButtonObserver( IPMUnknown* boss );
virtual ~MSRDoButtonObserver();
virtual void AutoAttach();
virtual void AutoDetach();
virtual void Update( const ClassID& theChange, ISubject* theSubject, const PMIID& protocol, void* changedBy ) ;
private:
const PMIID fObserverIID;
CREATE_PMINTERFACE(MSRDoButtonObserver, kMSRDoButtonObserverImpl)
MSRDoButtonObserver::MSRDoButtonObserver( IPMUnknown* boss ) :
CObserver( boss ), fObserverIID(IID_IMSRDOBUTTONOBSERVER)
MSRDoButtonObserver::~MSRDoButtonObserver(){}
void MSRDoButtonObserver::AutoAttach()
do {
InterfacePtr<ISubject> subject(this, UseDefaultIID());
ASSERT(subject);
if (!subject) {
break;
subject->AttachObserver(this, ITriStateControlData::kDefaultIID, fObserverIID);
} while(false);
void MSRDoButtonObserver::AutoDetach()
do {
InterfacePtr<ISubject> subject(this, UseDefaultIID());
ASSERT(subject);
if (!subject) {
break;
subject->DetachObserver(this, ITriStateControlData::kDefaultIID, fObserverIID);
} while(false);
void MSRDoButtonObserver::Update(const ClassID& theChange, ISubject* theSubject, const PMIID& protocol, void* changedBy )
//if(theChange == kTrueStateMessage)
CAlert::InformationAlert("Hi");
thanks
Hakkim.AysHi Dirk
Thanks for ur reply.
Yes I have added 'kMSRDoButtonBoss' in class def & type of .fr file.
type MSRDoButton (kViewRsrcType) : RollOverIconButtonWidget (ClassID = kMSRDoButtonBoss)
And panel edit mode, shows classId as 'kMSRDoButtonBoss'.
When I click the button nothing happens!?
Hakkim.Ays -
DispatchScriptRunner()
How to pass Java script parameters into DispatchScriptRunner() Function.
Tried Code:
WideString scriptPath("InDesign\\CS5\\scripting\\indesign\\samplescripts\\JavaScript\\AddGuides.jsx" );
IDFile scriptFile(scriptPath);
InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scr iptFile));
if(scriptRunner)
ScriptRecordData arguments;
ScriptIDValuePair arg;
ScriptID aID;
ScriptData script(scriptFile);
ScriptData resultData;
PMString errorString;
//To add pair into KeyValuePair
KeyValuePair<ScriptID,ScriptData> ScriptIDValuePair(aID,script);
arguments.push_back(ScriptIDValuePair);
int length=arguments.size();
PMString str;
str.AppendNumber(length);
//CAlert::InformationAlert(str);
Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner,script,arguments,resultData,erro rString,kFalse);
Value of ScriptId is cuming null or (0);
Please provide a solution to get a scriptId
Qn 2. How to pass a particular Java script methd's parameters into DispatchScriptRunner() Function in c++ code.IScriptArgs is aggregated on the Utils boss, so you would use it as follows:
In your C++ code:
Utils<IScriptArgs>()->Save(); // Saves the current set of scripting parameters on the context stack and creates a new current context, that has no parameters set.
// Now set up the parameters that you want to access from within your JavaScript as key-value pairs
Utils<IScriptArgs>()->Set(PMString("paramkeyname1"),PMString("ParamValueAsString1") );
Utils<IScriptArgs>()->Set(PMString("paramkeyname2"),PMString("ParamValueAsString2") );
// Call your script
Utils<IScriptArgs>()->Restore(); // Replaces the current existing context with the top context on the stack of saved contexts. In other words, returns the parameter stack to the Save() position.
In your JavaScript code:
if(app.scriptArgs.isDefined("paramkeyname1")) {
var yourvalueStr = app.scriptArgs.get("paramkeyname1")
HTH -
How to trap Duplicate command executed successfully.
Hi,
I have attaced observer to document for listening protocol IID_ICOMMANDMGR for trapping command kDuplicateCmdBoss. When I perform duplicate from "Option + Drag" the kDuplicateCmdBoss command gets executed before duplicating the item.
The documentation for kDuplicateCmdBoss says that "The page items in the command's item list are duplicated if the command is prepared successfully." But How to find the command is executed successfully.
Please help me.
Thanks,
PraveenFor tracing drag action on layout, I have used following
Class
kBscDNDLayoutSourceHelperBoss,
kInvalidClass,
IID_IK2SERVICEPROVIDER, kLayoutDDSrcHelperProviderImpl,
IID_IDRAGDROPSOURCECONTENTHELPER, kBscDNDLayoutDragSourceImpl,
and the implementation class BscDNDLayoutDragSource id derived from CDragDropSource, In which currently I am overriding only WillDrag method as below.
bool16 BscDNDLayoutDragSource::WillDrag(IEvent* e) const
CAlert::InformationAlert("drag started");
return kFalse;
The alert is displayed but after that InDesign got crashed. Thus I checked it by returning false still InDesign get crash.
Any hint might solve my problem .
Please help.
Regards,
Praveen -
InDesign CC 2014.1 Error When Export PDF
I am using the following script to generate a pdf, but to execute the command sends me the message "Error Export to PDF".
Please help me identify what I'm doing wrong.
InterfacePtr<ICommand> pdfExportCmd(CmdUtils::CreateCommand(kPDFExportCmdBoss));
if(pdfExportCmd==nil)
CAlert::InformationAlert("CheckInOutDialogController::crearPDF pdfExportCmd is invalid");
break;
CAlert::InformationAlert("A2");
InterfacePtr<IPDFExportPrefs> exportPrefs((IPDFExportPrefs*)::QuerySessionPreferences(IID_IPDFEXPORTPREFS));
// set export prefs
InterfacePtr<IPDFExportPrefs> pdfExportPrefsToExp(pdfExportCmd, UseDefaultIID());
if(pdfExportPrefsToExp==nil)
CAlert::InformationAlert("CheckInOutDialogController::crearPDF pdfExportPrefs is invalid");
break;
pdfExportPrefsToExp->CopyPrefs(exportPrefs);
CAlert::InformationAlert("A3");
IDocument* theDoc = Utils<ILayoutUIUtils>()->GetFrontDocument();
UIDList pageUIDs = UIDList(::GetDataBase(theDoc));
InterfacePtr<IPageRange> myPageRange((IPageRange*)::QuerySessionPreferences(IID_IPAGERANGE));
IPageRange::RangeFormat pageRangeFormat = myPageRange->GetPageRangeFormat();
CAlert::InformationAlert("A4");
// Assume theDoc is a valid IDocument* for export.UIDList pageUIDs = UIDList(::GetDataBase(theDoc));
InterfacePtr<IPageList> iPageList((IPMUnknown*)theDoc, IID_IPAGELIST);
if (pageRangeFormat != IPageRange::kAllPages){
PMString pageRange;
pageRange = myPageRange->GetPageRange();
pageRange.SetTranslatable(kFalse);
iPageList->PageRangeStringToUIDList(pageRange, &pageUIDs);}else{
int32 cPages = iPageList->GetPageCount();
for (int32 iPage = 0; iPage < cPages; iPage++ )
CAlert::InformationAlert("Pagina");
UID uidPage = iPageList->GetNthPageUID(iPage);
pageUIDs.Append( uidPage );
CAlert::InformationAlert("A15");
// Assume pdfExportCmd is the valid ICommand* from kPDFExportCmdBoss.
InterfacePtr<IOutputPages> iExportPages(pdfExportCmd, IID_IOUTPUTPAGES);
// Assume exportPrefs is the previously set IPDFExportPrefs from kPDFExportCmdBoss.
iExportPages->InitializeFrom(pageUIDs, (exportPrefs->GetPDFExReaderSpreads() == IPDFExportPrefs::kExportReaderSpreadsON));
PMString name;
theDoc->GetName(name);
iExportPages->SetName(name);
retval = CmdUtils::ProcessCommand(pdfExportCmd);I am using the following script to generate a pdf, but to execute the command sends me the message "Error Export to PDF".
Please help me identify what I'm doing wrong.
InterfacePtr<ICommand> pdfExportCmd(CmdUtils::CreateCommand(kPDFExportCmdBoss));
if(pdfExportCmd==nil)
CAlert::InformationAlert("CheckInOutDialogController::crearPDF pdfExportCmd is invalid");
break;
CAlert::InformationAlert("A2");
InterfacePtr<IPDFExportPrefs> exportPrefs((IPDFExportPrefs*)::QuerySessionPreferences(IID_IPDFEXPORTPREFS));
// set export prefs
InterfacePtr<IPDFExportPrefs> pdfExportPrefsToExp(pdfExportCmd, UseDefaultIID());
if(pdfExportPrefsToExp==nil)
CAlert::InformationAlert("CheckInOutDialogController::crearPDF pdfExportPrefs is invalid");
break;
pdfExportPrefsToExp->CopyPrefs(exportPrefs);
CAlert::InformationAlert("A3");
IDocument* theDoc = Utils<ILayoutUIUtils>()->GetFrontDocument();
UIDList pageUIDs = UIDList(::GetDataBase(theDoc));
InterfacePtr<IPageRange> myPageRange((IPageRange*)::QuerySessionPreferences(IID_IPAGERANGE));
IPageRange::RangeFormat pageRangeFormat = myPageRange->GetPageRangeFormat();
CAlert::InformationAlert("A4");
// Assume theDoc is a valid IDocument* for export.UIDList pageUIDs = UIDList(::GetDataBase(theDoc));
InterfacePtr<IPageList> iPageList((IPMUnknown*)theDoc, IID_IPAGELIST);
if (pageRangeFormat != IPageRange::kAllPages){
PMString pageRange;
pageRange = myPageRange->GetPageRange();
pageRange.SetTranslatable(kFalse);
iPageList->PageRangeStringToUIDList(pageRange, &pageUIDs);}else{
int32 cPages = iPageList->GetPageCount();
for (int32 iPage = 0; iPage < cPages; iPage++ )
CAlert::InformationAlert("Pagina");
UID uidPage = iPageList->GetNthPageUID(iPage);
pageUIDs.Append( uidPage );
CAlert::InformationAlert("A15");
// Assume pdfExportCmd is the valid ICommand* from kPDFExportCmdBoss.
InterfacePtr<IOutputPages> iExportPages(pdfExportCmd, IID_IOUTPUTPAGES);
// Assume exportPrefs is the previously set IPDFExportPrefs from kPDFExportCmdBoss.
iExportPages->InitializeFrom(pageUIDs, (exportPrefs->GetPDFExReaderSpreads() == IPDFExportPrefs::kExportReaderSpreadsON));
PMString name;
theDoc->GetName(name);
iExportPages->SetName(name);
retval = CmdUtils::ProcessCommand(pdfExportCmd); -
Problem with FileUtils::CopyFile() CS4 Mac
Hi all,
I'm trying to copy some files from within my plugin into the Script Folder but the files don't get copied. I can create files within the folder and I also reach the files within the plugin (I think). Where is my mistake?
// The code
const int MAXITEMS = 12;
PMString scriptfiles[MAXITEMS] = {
"scriptfile01.jsx",
"scriptfile02.jsx",
"scriptfile03.jsx",
"scriptfile04.jsx",
"scriptfile05.jsx",
"scriptfile06.jsx",
"scriptfile07.jsx",
"scriptfile08.jsx",
"scriptfile09.jsx",
"scriptfile10.jsx",
"scriptfile11.jsx",
"scriptfile12.jsx"};
PMString newscriptfiles[MAXITEMS] = {
"newscriptfile01.jsx",
"newscriptfile02.jsx",
"newscriptfile03.jsx",
"newscriptfile04.jsx",
"newscriptfile05.jsx",
"newscriptfile06.jsx",
"newscriptfile07.jsx",
"newscriptfile08.jsx",
"newscriptfile09.jsx",
"newscriptfile10.jsx",
"newscriptfile11.jsx",
"newscriptfile12.jsx"};
for (int i = 0; i < MAXITEMS ; i++) {
// go to the the source files
IDFile theSource;//scriptfiles[i];
FileUtils::GetPackageFolder(&theSource);
FileUtils::AppendPath(&theSource, PMString("Versions"));
FileUtils::AppendPath(&theSource, PMString("A"));
FileUtils::AppendPath(&theSource, PMString("Resources"));
FileUtils::AppendPath(&theSource, PMString(scriptfiles[i]));
// if i call the files within the package
// he seems to find them
//PMString filename = theSource.GetFileName();
//CAlert::InformationAlert(filename);
// go to the the target files
IDFile theTarget;
FileUtils::GetAppInstallationFolder(&theTarget);
FileUtils::AppendPath(&theTarget, PMString("Scripts"));
FileUtils::AppendPath(&theTarget, PMString("Scripts Panel"));
FileUtils::AppendPath(&theTarget, PMString("MPO Launcher"));
//if the folder doesn't exist
FileUtils::CreateFolderIfNeeded(theTarget,kTrue);
// get the new names
PMString fn( newscriptfiles[i]);
FileUtils::AppendPath(&theTarget, fn);
// if i use OpenFile it creates the files
//FileUtils::OpenFile(theTarget, "w");
// and this doesnt work. Why?
FileUtils::CopyFile(theSource, theTarget);Found my error.
FileUtils::GetPackageFolder(&theSource);
doesn't return the folder of the plugin.
Maybe you are looking for
-
Is there a way to find the list of PCs and iDevices connected to my Itunes Match?
Is there a way to find the list of PCs and iDevices connected to my Itunes Match?
-
Music only exists on my ipod..itunes library shows up empty?
I open my itunes library and it shows about 15 songs, however it previously contained 2000+ songs. I have about 1500 on my ipod. How is this possible? Is it safe to try and sync?
-
Tracing Options Preview box won't check in Ai CS3
This should be a simple one for all you experts. I'm new to Illustrator. I opened a downloaded world map as a JPEG and saved it as both JPEG and TIFF. I'm playing around with Illustrator CS3 and wanted to convert the map from raster to vector format
-
My phone Cox mail account shows 12 emails in the sent folder, but when I open the folder it's empty. How do I get rid of the number 12 in the sent folder ? richie
-
Can I import images from DVD to my HDD through bridge (I have Win 7
Hi, I'm using Win 7 (and also have Bridge on Mac OS X). I'd like to import images from DVD to my HDD through Adobe Bridge. But I can't find the option to import from DVD in Bridge (either in Win 7 or Mac). My DVD drive on my Win machine is external w