| SexScripts : #include: Yes, we can. - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=338 | Page 1 of 1 |
#include: Yes, we can. |
Jenny T [ Thu Sep 05, 2013 5:19 am ] |
|---|---|
Hi there! I'm new here and this is a real nice application! I'm making a couple of integrated scripts which have lot of common code between them. As currently we don't have statements like "include", is necessary to paste the common code on every file. This is really hard to maintain... I solved this by creating a batch that merges a file containing the common code and the script specific code, works like this: 1) I created a "dev" folder on the root of SexScripts 2) Moved all my scripts to it, I'm using Notepad++ to edit. 3) Created a script file with all common code, and cleaned it on other files 4) The batch merges the common code with other scripts into new files inside of the "scripts" directory; Bellow is an example of how this batch works. The files "myscript", "teasings" and "tests" are the scripts and the "commcode" is the code that should be shared with every file. Code: @echo off rd /s /q ..\scripts\myscript md ..\scripts\myscript type commcode.groov myscript.groovy > ..\scripts\myscript.groovy type commcode.groov teasings.groovy > ..\scripts\myscript\teasings.groovy type commcode.groov tests.groovy > ..\scripts\myscript\tests.groovy ..\sexscripts myscript I didn't test on Linux, but this might work: Code: #!/bin/sh
rm -rf ../scripts/myscript/* cat commcode.groov myscript.groovy > ../scripts/myscript.groovy cat commcode.groov teasings.groovy > ../scripts/myscript/teasings.groovy cat commcode.groov tests.groovy > ../scripts/myscript/tests.groovy ../sexscripts.sh myscript |
|
Re: #include: Yes, we can. |
kb215 [ Fri Sep 26, 2014 4:42 am ] |
|---|---|
Very handy script to mix them togther. Seems from searching around there are various approaches that people seem in theory think will work. Everything from using "File Evaluation" to using complex scripts. I feel using classes is the best way to do this like having a file called Functions.class and in that file using class Functions { ...method() ... }. However I haven't managed to get this to work in groovy for SS |
|
| Page 1 of 1 | All times are UTC + 1 hour [ DST ] |