ScreenScript #Include like directive

Moderators: TomKerekes, dynomotion

Post Reply
LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

ScreenScript #Include like directive

Post by LarryJD » Fri Sep 17, 2021 2:19 am

A feature that could make custom screen design and maintenance much easier would be to add a #include like directive to the Screen Script syntax. An include directive would remove the need to update multiple Screen Script files when a change is made. Screen content could be logically broken into separate files with little to no overlapping content.

Ideally the screen editor would be able to rewrite content to the files that originally specified the controls when the screen script file was read in by the screen editor. Initial segmenting of screen content into separate files files would be done manually with any editor program (e.g. Notes++).

The include directive would be very useful on its own, if the screen editor changes couldn't be delivered at the same time as the KmotionCNC screen script reader changes.
Thanks,
Larry

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: ScreenScript #Include like directive

Post by TomKerekes » Fri Sep 17, 2021 4:54 pm

Hi Larry,

I can't see a reason why running a SubScript from a button Action would be any different from a C Program running a SubScript. I tried below and it seems to work for me. Maybe you could provide an example that shows a problem.

SubScript.png
SubScript.png (10.88 KiB) Viewed 1145 times

KMotionCNC already supports a means of including files via SubScripts. I've attached an example where RTCP1 "includes" RTCP2. However the Screen Editor doesn't support this for reading or writing. Does that work for you? I like your idea of writing back to the original files. We'll look into that.
Attachments
RTCP2.scr
(33.93 KiB) Downloaded 62 times
RTCP1.scr
(20.64 KiB) Downloaded 58 times
Regards,

Tom Kerekes
Dynomotion, Inc.

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: ScreenScript #Include like directive

Post by TomKerekes » Fri Sep 17, 2021 7:42 pm

Hi Larry,

Attached is a Screen Editor that should read Screen Script files with nested SubScripts. It also shows the hierarchy. But can't write them. I've attached an example with a main RTCP1T and 4 subscripts.

Tree.png
Attachments
KMotionCNCScreenEditor.exe
(110 KiB) Downloaded 69 times
RTCP3T.scr
(16.79 KiB) Downloaded 56 times
RTCP2TB.scr
(3.62 KiB) Downloaded 63 times
RTCP2TA.scr
(5.63 KiB) Downloaded 63 times
RTCP2T.scr
(9.23 KiB) Downloaded 58 times
RTCP1T.scr
(19.41 KiB) Downloaded 59 times
Regards,

Tom Kerekes
Dynomotion, Inc.

LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Re: ScreenScript #Include like directive

Post by LarryJD » Fri Sep 17, 2021 7:56 pm

Hi Tom,

Thanks for the sample. It's great that the include is already implemented!

I was a bit confused by the RTCP2 file content. It included the base page content plus the additional content of the subscript. I've included modified files RTCP1_LJD.scr and RTCP2_LJD.scr that represent what more of what I'm trying to implement. Initially it didn't work. I think the problem I was having was caused by my trying to load the base page using the Screen Editor. Once I went into the GCodeConfigCNC.txt file and change the screen to load, it worked. I think the bottom line is that the base page can only be loaded directly by KnotionCNC (as you indicated). My files didn't use the include because I didn't realize it was available. So I still need to figure out why my button actions couldn't load subscripts with incompletely defined controls. But with the example you have given me (But30 & 31) and knowing to not try to load the base page with Screen Editor, I should be able to track it down. I'll confirm when I get my screens working or will be back with more questions :)

I do have one question now. Can a subscript include another subscript? The reason I ask is that I'll have button actions that load a subscript to update a screen area shared by other button actions. I'd like to have a common subscript that all of the button subscripts can include that will put that screen area into a known state (i.e. set all controls used in that screen area to Hidden and reset the color of all the buttons).

Thanks you very much for your help.
Attachments
RTCP2_LJD.scr
(651 Bytes) Downloaded 64 times
RTCP1_LJD.scr
(20.64 KiB) Downloaded 58 times
Thanks,
Larry

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: ScreenScript #Include like directive

Post by TomKerekes » Fri Sep 17, 2021 8:07 pm

Hi Larry,

That was my mistake to leave what I moved into the SubScript file in the original file.

See my previous post.
Regards,

Tom Kerekes
Dynomotion, Inc.

LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Re: ScreenScript #Include like directive

Post by LarryJD » Fri Sep 17, 2021 8:20 pm

Our messages crossed :)

Thank you very much Tom! I'll try the Screen Editor right away.
Thanks,
Larry

LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Re: ScreenScript #Include like directive

Post by LarryJD » Fri Sep 17, 2021 9:52 pm

Hi Tom,

The new Screen Editor works great, thank you! I like that it keeps the content in the order read in when it does a write out.

Is it possible for the editor to put a marker comment in the output to indicate the file where each script segment came from? Alternately and maybe a better more general solution would be to allow comment lines in a screen script. The user could put a comment at the top and bottom of each subscript file that indicates which subscript it is. If these comment line were included in the write operation, that would be all that is needed.

Supporting comment lines would also be helpful in organizing screen script content. Comments could be added with a text editor so Screen Editor wouldn't need to implement a means for entering comment lines. Maintaining blank lines would be nice too.

Thank you again for you quick responses and help.
Thanks,
Larry

Post Reply