Posted 13 March 2012 - 10:09 PM
Im trying to make a program for monitors, in which you can kind of connect a computer and monitor together.
My code so far is like this:
mon = peripheral.wrap("back")
while true do
input = read()
term.redirect(mon)
term.setCursorBlink(true)
shell.run(input)
term.restore()
end
But what im trying to do is get it so everytime i press a key, it shows it on both the monitor and the actual computer.
So i thought maybe i can wait for the key event, like so
mon = peripheral.wrap("back")
while true do
event, key == os.pullEvent()
if event == "key" then
term.redirect(mon)
presskey(key) – This isnt real, but thats what i am trying to accomplish
term.restore()
presskey(key)
end
end
And then press that key on both computers.
So im wondering if theres a way to simulate a key press or anything like it.
Thanks!
My code so far is like this:
mon = peripheral.wrap("back")
while true do
input = read()
term.redirect(mon)
term.setCursorBlink(true)
shell.run(input)
term.restore()
end
But what im trying to do is get it so everytime i press a key, it shows it on both the monitor and the actual computer.
So i thought maybe i can wait for the key event, like so
mon = peripheral.wrap("back")
while true do
event, key == os.pullEvent()
if event == "key" then
term.redirect(mon)
presskey(key) – This isnt real, but thats what i am trying to accomplish
term.restore()
presskey(key)
end
end
And then press that key on both computers.
So im wondering if theres a way to simulate a key press or anything like it.
Thanks!