Best Way to Run a Macro from a Dialog?

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
JimmyK
Newbie
Posts: 1
Joined: Wed Dec 09, 2020 3:44 pm

Best Way to Run a Macro from a Dialog?

Post by JimmyK » Wed Dec 09, 2020 3:57 pm

Hello,
I am building a Dialog with buttons to log me in to a VPN. I have the VPN Macro created called "Login to VPN". This is working correctly. I have a Dialog with a button like so:

object btnVPNRCx: tMSButton
Left = 56
Top = 62
Width = 153
Height = 35
Caption = 'RCx Rules'
TabOrder = 0
DoBrowse = False
BrowseStyle = fbOpen
end

AddDialogHandler>RCxMenu,btnVPNRCx,OnClick,DoVPNRCx

SRT>DoVPNRCx
MessageModal>This is doing the VPN
END>DoVPNRCx

How do I call my Macro or should I create an .exe and call the .exe? If so, what is the syntax for that?

Thank you,
Jim

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Best Way to Run a Macro from a Dialog?

Post by JRL » Wed Dec 09, 2020 5:37 pm

Some will say to use the macro or the include functions or even to place the script in a subroutine within your dialog script. My choice would be to run the script using the RunProgram function.

Code: Select all

SRT>DoVPNRCx
  //So the script doesn't stop and wait for Login to VPN to finish.
  Let>RP_Wait=0
  //So that you can see windows open
  Let>RP_Windowmode=1
  RunProgram>Path\Login to VPN.scp
  //           OR
  //RunProgram>Path\Login to VPN.exe
END>DoVPNRCx

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts