Posted 13 October 2017 - 01:09 AM
if you've ever wanted to have batch files or similar in computercraft OR you clicked on this while browsing programs,
I have just the program
Latch 1.0
Pastebin:uaRxBM0q
how it works:
Latch works by opening the selected file in the filesystem, and reading the lines, then it executes the programs listed in sequential order.
ex: run the code
Feel free to write programs to go with this, or even improve on this program's design
known bugs:
after executing, it ALWAYS says file not found
Edit:
Thanks to Luca_S for fixing this bug, and changing the code
You are free to use this in your Operating system, or in any project you want, feel free to add credit, although i don't require it as long as you don't claim it as your own
I have just the program
Latch 1.0
Pastebin:uaRxBM0q
how it works:
Latch works by opening the selected file in the filesystem, and reading the lines, then it executes the programs listed in sequential order.
ex: run the code
lsc example
Example Script:
ls
cd ..
cd rom
ls
cd programs
ls
cd ../..
programs
How to write a script(for dummies):- type edit, and choose a filename. press enter
- list the programs and their args in sequential order.
- press ctrl, then press save
- run lsc <script name>
known bugs:
after executing, it ALWAYS says file not found
Edit:
Thanks to Luca_S for fixing this bug, and changing the code
Tiedied up the loop a bit and also put the execution of the commands after the reading in, so that commands that take a longer time don't keep the FS handle open.
Also this fixes the File not found bug.
Pastebin: R9K4JHZN
You are free to use this in your Operating system, or in any project you want, feel free to add credit, although i don't require it as long as you don't claim it as your own
Edited on 15 November 2017 - 06:44 PM