Macros and UI

Professional Windows® software to communicate with CAN and CAN FD busses and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
scope
Posts: 18
Joined: Wed 24. Jan 2024, 15:42

Macros and UI

Post by scope » Wed 7. Feb 2024, 10:25

is there a way to map a button to run a Macro ?

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Macros and UI

Post by M.Maidhof » Wed 7. Feb 2024, 12:01

yes, simply put the name of the macro in the “Execute Command” property of the button. But note: this will only work when no other macro is working in that time and the macro is already available in the macro list.

regards

Michael

dmeir
Posts: 13
Joined: Thu 29. Aug 2024, 10:58

Re: Macros and UI

Post by dmeir » Mon 2. Sep 2024, 12:54

I cannot get my VBS macro to run this way.
The macro is loaded in the Project Manager, and no other macro (that I know of) is currently running.
I also can't add the macro to the "macro list" because it says "this macro is already loaded".
In the “Execute Command” property of my button I put the macro's filename without extension, as shown in the Project Manager's "Macros" list.

Bonus question: how do I only run a specific function out of a VBS macro file?

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Macros and UI

Post by M.Heidemann » Mon 2. Sep 2024, 13:53

Hello,

You enter the name of a subroutine, not the Macro-File.

For example:

Code: Select all


Sub doSomething()

PrintToOutputWindow "Hello!"

End Sub

in the execute Command property you just enter the name of the subroutine:

Code: Select all

doSomething
(Notice: No Parenthesis, no Quotes).

Try again and let us know if it works now.

BR

Marvin
---
Marvin Heidemann
PEAK-Support Team

dmeir
Posts: 13
Joined: Thu 29. Aug 2024, 10:58

Re: Macros and UI

Post by dmeir » Thu 5. Sep 2024, 12:08

Thanks, this works.
I'll add that one has to use the complete name of the function including underscores (somewhere in the forum or documentation it was suggested that one has to remove the underscores).

Post Reply