more flua script help


Forum: Programming and Scripting
Topic: more flua script help
started by: plinej

Posted by plinej on Feb. 13 2006,22:06
I'm working on some other scripts that I need some help on. I made an input box with the following lines:

input = Input{70,35,300,30,"scanbus #'s"}
function input:callback()
--need to add something here--
end

Now how would I get that input to be recognized in a line like this:

execute("aterm -e cdrecord blank=fast dev="..what_do_i_put_here.." &")

Posted by mikshaw on Feb. 14 2006,04:00
You probably don't want to use an execute as the callback for an input field, as the callback is usually done with every change to the input field (every key pressed would cause the execute to run).  Best idea would be to have a button that has a callback related to the contents of the input field.
Code Sample
input = Input{70,35,300,30,"scanbus #'s"}
input_button = Button{70,65,80,30,"scanbus"}
function input_button.callback()
execute("aterm -e cdrecord blank=fast dev="..input.value.." &")
end

You'd still need some way to read the output of that command back into flua, since it doesn't work the same way that a shell like bash would...so if you redirect the command's output to a file, you can read the contents of that file back into flua if it needs to be displayed or otherwise used in your flua script.

Posted by plinej on Feb. 14 2006,04:21
Thank you again Mikshaw! Works great.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.