Skip to main content
1-Visitor
September 29, 2015
Solved

run mapkey... not valid

  • September 29, 2015
  • 2 replies
  • 2861 views

Hey

if I try to execute the following macro (clicking the "Switch Dimensions"-Button in Tools ribbon):

ProMacroLoad(L"~ Command `ProCmdInfoSwitchDims` ;");

ProMacroExecute();

I get "PRO_TK_NOT_VALID" - The specified macro is not valid as error. But I don't understand why?

Am I violating any of those four restrictions??

Note that this function is not supported for the following situations and tasks

1.Activating windows or setting the current model

2.Erasing the current model

3.Completing dialog commands ending with an "OK" button press. It will cancel some dialogs after showing them.

4.Executing macros during a trail file replay.


Best regards


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Best answer by Eike_Hauptmann

I think he had solved that issue by changing the work mode of the dialog.

So the dialog is now modeless and there is an extra button to run only that mapkey.

We have same problems with the macro: ~ Command `ProCmdInfoSwitchDims`;

It can't be used inline inside of a synchronous process. So you need to use it standalone, and that's possible with the modeless window and a button that runs the mapkey without do stuff after it.

Br,

Eike

2 replies

24-Ruby III
September 29, 2015

Luis,

is Tools tab active, when application executes a mapkey ?

MH

lgüthle1-VisitorAuthor
1-Visitor
September 29, 2015

Yes it is (because i start the application from the Tools tab).

But just to make sure I already tested:

ProMacroLoad(L"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;~ Command `ProCmdInfoSwitchDims`;");

...and got the same error

//edit1: I forgot to mention that right before the Macro I do use a ProUIDialog....

... I am really confused now...

Following MyFunction is working:

int MyFunction(uiCmdCmdId command, uiCmdValue *pValue, void *pPushCommandData){

  status = ProMacroLoad(L"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;~ Command `ProCmdInfoSwitchDims`;");

  status = ProMacroExecute();

  return 0;
}


This version is not working ?????


int MyFunction(uiCmdCmdId command, uiCmdValue *pValue, void *pPushCommandData){

  status = ProMacroLoad(L"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;~ Command `ProCmdInfoSwitchDims`;");

  status = ProMacroExecute();

...do other stuff...

return 0;
}

//edit2: ok MacroExecute is still throwing an error but creo somewhat still executes the macro...

15-Moonstone
October 1, 2015

I think he had solved that issue by changing the work mode of the dialog.

So the dialog is now modeless and there is an extra button to run only that mapkey.

We have same problems with the macro: ~ Command `ProCmdInfoSwitchDims`;

It can't be used inline inside of a synchronous process. So you need to use it standalone, and that's possible with the modeless window and a button that runs the mapkey without do stuff after it.

Br,

Eike

FV_01
October 2, 2015

One could use ProDisplaymodeSet instead of macro...

15-Moonstone
October 5, 2015

Uh ok ... I don't know that.

Thx Felix