Hello Guest it is April 20, 2024, 01:56:54 AM

Author Topic: Compiling Macro Script  (Read 9113 times)

0 Members and 1 Guest are viewing this topic.

Compiling Macro Script
« on: June 28, 2011, 11:38:58 PM »
Can you compile a VB script?  It is actually a button script.  If yes, could someone point me in the right direction?

Thanks very much.
« Last Edit: June 28, 2011, 11:41:45 PM by rrc1962 »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Compiling Macro Script
« Reply #1 on: June 29, 2011, 12:19:03 AM »
Using the VB editor you have 2 options save as macro OR a compiled macro.

(;-) TP
Re: Compiling Macro Script
« Reply #2 on: June 29, 2011, 08:44:56 AM »
I have searched the forums and Mach Customize Wiki for more info on compiled macros and this is the only thread with a reference to it. How would you use a compiled macro differently than an .m1s macro? Thanks for any help. Tony

Re: Compiling Macro Script
« Reply #3 on: June 29, 2011, 09:44:54 AM »
I'll second tony's comment.  I can save a button script as a compiled file (.mcc), but when I go back to "Edit Button Script" and click on the button, the original .m1s opens. What I'm trying to do is make it so that button code can not be messed with or even in human readable form...in other words, compiled code.

Edit...

Messing with this more, it appears that I can only save a script as an mcc file if I rename it.  A button script always has the name HiddenScript, so when I try to save it as an mcc file, it just tells me that HiddenScript.m1s already exists and asks to overwrite.  If I rename it to something like HiddenScript1.mcc, it saves as compiled code, but is not attached to the button.
« Last Edit: June 29, 2011, 09:55:29 AM by rrc1962 »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Compiling Macro Script
« Reply #4 on: June 29, 2011, 11:08:29 AM »
I don't think you can complie a button script as it is embeded into the screenset. The only other way is to have your button call the compiled macro.

Code"M999"

(;-) TP
Re: Compiling Macro Script
« Reply #5 on: June 29, 2011, 11:32:05 AM »
Rcc, if all you want is not to have an operator edit the script how about using Screen4 and disabling “VB Script function edited in Mach3” for the button you’re concerned about?
Tony

I'm trying to insert a picture here but can't figure out how to do it.
« Last Edit: June 29, 2011, 11:35:42 AM by Tony Bullard »
Re: Compiling Macro Script
« Reply #6 on: June 29, 2011, 11:42:34 AM »
Hi,
Look up some more tools in the docs and the pieces will come together....

1) look up RunScript. The call allows a script to call a named disk file which contains other scritpts.
the disk file invoked can be either a .m1s or a .mcc file.
2) compile the code you want into an mcc file.
3) make the button code in the set file be a RunScript line that invokes your compiled code.

This will require use of mach 3.43.xx as the necesary calls are not in the mach 3.42.xx series.

Dave
Author of the MachStdMill Extensions for Mach3
www.CalypsoVentures.com

Offline djc

*
  •  47 47
    • View Profile
Re: Compiling Macro Script
« Reply #7 on: June 29, 2011, 03:19:03 PM »
1) look up RunScript. The call allows a script to call a named disk file which contains other scritpts.
the disk file invoked can be either a .m1s or a .mcc file.
2) compile the code you want into an mcc file.
3) make the button code in the set file be a RunScript line that invokes your compiled code.

Other than hiding your macro code from the end-user, could you elaborate on the possible benefits of doing this?

Thanks.
Re: Compiling Macro Script
« Reply #8 on: June 29, 2011, 03:32:57 PM »
The motivations for doing this are:
1) this removes the script from the set file - it now lives in a disk file instead of in the set file.
That may or may not be important to you depending on what you are doing.
For example, in my  MachStdMill software, this technique is used to let there be only one copy of a routine in one disk file. That's a huge deal when the only alternative is 106 copies of the routine that all live inside the set file. So this approach can be a huge maintenance productivity gain for complicated software. On the flip side, for a single simple button, it's probably more trouble than it's worth.

2) The external disk file  called by RunScript can be either source (m1s) or compiled (mcc). So if you want to use an mcc file (for whatever reason), you pretty much have to make the compiled script live outside the set file.

Dave

1) look up RunScript. The call allows a script to call a named disk file which contains other scritpts.
the disk file invoked can be either a .m1s or a .mcc file.
2) compile the code you want into an mcc file.
3) make the button code in the set file be a RunScript line that invokes your compiled code.

Other than hiding your macro code from the end-user, could you elaborate on the possible benefits of doing this?

Thanks.
Author of the MachStdMill Extensions for Mach3
www.CalypsoVentures.com

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Compiling Macro Script
« Reply #9 on: June 29, 2011, 05:00:06 PM »
If ALL you want to do is stop the OP from monkeying with the controls simply LOCK the Mach config. that includes the edit button functions.

(;-) TP