Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --v2.3 by GraySloth 2013-Apr-30
- --name this startup to run program on monitor automatically
- --Works great for this program but can be used for othes: http://pastebin.com/UkzR2J5T
- --variables
- local sSide = nil -- the side the monitor is on, nil will dynamically find the side but you can change it to be static
- local sProgram = { "clock" } -- the program you are running, now supports multiple arguments
- local textScale = 1 --change from 0.5 to 5
- --main
- if sSide == nil then
- for n,sMonitorSide in ipairs(rs.getSides()) do
- if peripheral.isPresent(sMonitorSide) and peripheral.getType(sMonitorSide) == "monitor" then
- sSide = sMonitorSide
- break
- end
- end
- if not sSide then
- print( "No monitor attached" )
- return
- end
- end
- if peripheral.getType( sSide ) ~= "monitor" then
- print( "No monitor on "..sSide.." side" )
- return
- end
- local sPath = shell.resolveProgram( sProgram[1] )
- if sPath == nil then
- print( "No such program: "..sProgram[1] )
- return
- end
- print( "Running "..sProgram[1].." on "..sSide.." monitor" )
- local monitor = peripheral.wrap( sSide )
- monitor.setTextScale( textScale )
- term.redirect( monitor )
- shell.run( sProgram[1],sProgram[2], sProgram[3] )
- term.restore()
Advertisement
Add Comment
Please, Sign In to add comment