cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

run mapkey... not valid

SOLVED
Highlighted
Newbie

run mapkey... not valid

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: run mapkey... not valid

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

5 REPLIES 5

Re: run mapkey... not valid

Luis,

is Tools tab active, when application executes a mapkey ?

MH


Martin Hanák

Re: run mapkey... not valid

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...

Re: run mapkey... not valid

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

Re: run mapkey... not valid

One could use ProDisplaymodeSet instead of macro...

Re: run mapkey... not valid

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

Thx Felix