Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 11:51:48 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Compiling Macro Script
Pages: 1 2 »   Go Down
Print
Author Topic: Compiling Macro Script  (Read 824 times)
0 Members and 1 Guest are viewing this topic.
rrc1962
Active Member

Offline Offline

Posts: 434


View Profile
« on: June 28, 2011, 10: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, 10:41:45 PM by rrc1962 » Logged
BR549
Active Member

Offline Offline

Posts: 2,557


View Profile
« Reply #1 on: June 28, 2011, 11:19:03 PM »

Using the VB editor you have 2 options save as macro OR a compiled macro.

(;-) TP
Logged
Tony Bullard
Active Member

Offline Offline

Posts: 83


View Profile
« Reply #2 on: June 29, 2011, 07: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

Logged
rrc1962
Active Member

Offline Offline

Posts: 434


View Profile
« Reply #3 on: June 29, 2011, 08: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, 08:55:29 AM by rrc1962 » Logged
BR549
Active Member

Offline Offline

Posts: 2,557


View Profile
« Reply #4 on: June 29, 2011, 10: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
Logged
Tony Bullard
Active Member

Offline Offline

Posts: 83


View Profile
« Reply #5 on: June 29, 2011, 10: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, 10:35:42 AM by Tony Bullard » Logged
DaveCVI
V4 Screen Contributor

Offline Offline

Posts: 532



View Profile WWW
« Reply #6 on: June 29, 2011, 10: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
Logged

Author of the MachStdMill Extensions for Mach3
www.CalypsoVentures.com
djc
Active Member

Offline Offline

Posts: 47


View Profile
« Reply #7 on: June 29, 2011, 02: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.
Logged
DaveCVI
V4 Screen Contributor

Offline Offline

Posts: 532



View Profile WWW
« Reply #8 on: June 29, 2011, 02: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.
Logged

Author of the MachStdMill Extensions for Mach3
www.CalypsoVentures.com
BR549
Active Member

Offline Offline

Posts: 2,557


View Profile
« Reply #9 on: June 29, 2011, 04: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
Logged
Pages: 1 2 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!