Hello Guest it is March 28, 2024, 09:04:41 AM

Author Topic: script locations... tired of looking... gotta ask  (Read 4538 times)

0 Members and 1 Guest are viewing this topic.

script locations... tired of looking... gotta ask
« on: August 02, 2015, 12:26:03 PM »
Okay, read in the scripting guidel there is a screen load script, screen unload script, and a PLC script... have seen post where people have mentioned editing them, and have seen some code snippets from these scripts... But I can't find them ???. So I finally decided to just ask. Can someone please post the locations or some direcrtions for locating and editing the screen load, screen unload, PLC and signal scripts?

I'm trying to figure out LUA and want to be able to examine these. Hoping to figure out a way to display mc.mcCntlGetRunTime on my mach screen (if that's possible).

Also the Scripting Guide mentions a "Mach4 customization manual",  does this exist?

Thanks
Hit the e-stop! Hit the e-stop!
Re: script locations... tired of looking... gotta ask
« Reply #1 on: August 02, 2015, 01:14:36 PM »
Scripts are associated with individual profiles and, assuming a default install,
are stored in>>   

C:\Mach4Hobby\Profiles\your-profile-name\Macros

You may have to create the Macros folder if it does not exist.

There is a Mach4Hobby configuration manual, but I have not yet seen a
customization manual. The manuals can be found in here:

http://www.machsupport.com/help-learning/product-manuals/

or here:

http://www.pmdx.com/Downloads_Mach4/Mach4_Documentation/

and stored locally on your machine here>>

C:\Mach4Hobby\Docs

When looking for something, I encourage you to look in all three places
because they do not have identical contents.

Also, there is a a "child board" called Mach4Toolbox that contains many posts
about scripts and other customization discussions.





Steve Stallings
www.PMDX.com

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: script locations... tired of looking... gotta ask
« Reply #2 on: August 02, 2015, 01:28:32 PM »
Quote
Okay, read in the scripting guidel there is a screen load script, screen unload script, and a PLC script... have seen post where people have mentioned editing them, and have seen some code snippets from these scripts... But I can't find them

I think that these are embedded in the screens?

In Mach4, go to Operator > Edit Screen.

In the Tree manager on the left, click on "wxMach".
In the properties window below it, click the second icon, with the lightning bolt, and you'll see all the scripts there.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: script locations... tired of looking... gotta ask
« Reply #3 on: August 02, 2015, 02:29:36 PM »
After seeing Gerry's post, I decided to have a look around despite the fact that I have done no real script programming.  8-)

It appears that there are four special purpose scripts that get embedded in the screen set file.

The screen load script runs once when the screen is loaded. This is useful for initializing things.

The screen unload script runs once when the screen is unloaded. This is useful for saving data for future use.

The PLC script is a constantly running periodic script that can function like a classic PLC except that it runs Lua code.

The Signal script is a way to handle system responses to signals on an event driven basis.

Each of these scripts can be edited within the Operator > Edit Screen function by pointing the tree manager at the
top element (the name of the screenset). The list of these four scripts will appear in the properties box below when
you click on the action mode (the lightning bolt button).

Then select one of the scripts and click on the three dots that appears when you select the script. This will open
an instance of the Lua script editor. You can then edit in that editor and finish by doing a Save which re-embeds
the script into the screen set. Careful that you know which screen set it will alter, and that you have a backup of
the screen set.

Alternatively you can invoke the editor as before, but do a SaveAs to put the script file where you like for
editing purposes. You can later do a FileOpen to retrieve it followed by a plain Save to re-embed it into your
screen set.

I have tried this and it seems to work, but others probably know more about the process.
« Last Edit: August 02, 2015, 02:34:55 PM by Steve Stallings »
Steve Stallings
www.PMDX.com
Re: script locations... tired of looking... gotta ask
« Reply #4 on: August 02, 2015, 03:37:52 PM »
Thanks Steve & Gerry... that's exactly what I was looking for.

I had just found the following method from another post and was using it to look at the scripts...

Thanks Brian and Steve
Your team has made it possible, its up to us to push, explore & create our own environment. Providing you with more work to keep up with our needs.
Get ready for grey or no hair ;D


Wanted to enlighten all, to the ability at looking at the root of the script, that is the Screen.set.

If you change the name of your screen set from dot set to dot zip
then Extract the zip file to a new folder you will find a folder named "images" with all the inserted graphic images

I find it easier to edit and add to the images folder this way.

You will also find a file called 'screen.xml"

The screen.xml file is the core of all the scripting code and the attributes of the controls. This file can be edited, it is a text file. Open with any xml editor or program that formats the file correctly and saves it as a text file. Make any edits you need or like. When done, select both the file and images folder and "Add to Archive" make them a zip file again. Rename the zip file back to the dot set extension.  You can put it back in the Screens folder, but I don't believe you have too.

Now to figure out how to merge two or more sets. My thinking is as individuals share their sets, and we would like to add some great features to our set. What is the best way to merge the data? Remember property device names can not be the same. And grouping is critical.

Image below shows a content clip of the xml file

Have Fun, keep exploring :)
Thanks again


The information you all provided makes it much simplier.
Hit the e-stop! Hit the e-stop!
Re: script locations... tired of looking... gotta ask
« Reply #5 on: October 23, 2015, 08:16:56 PM »
WOW! that is very cool Andysims. I was just posting feature requests / bugs about the screen editer and that was one of them (Easier access to the images)