Jump to content




GUI menu trubbles [will not run program]


  • You cannot reply to this topic
4 replies to this topic

#1 rex41043

  • Members
  • 88 posts

Posted 10 April 2012 - 09:20 PM

i'm having trubble with a GUI menu when i try to run the help program it will not run and its there in the dir but it will not run it it just dos nothing but yet the shutdown and reboot works can eny 1 help


sid = 0

function menu(id, text)
if sid == id then
write(">>")
else
write(" ")
end
print(text)
end

while true do
term.clear()
term.setCursorPos(1,1)
shell.run("id")
term.setCursorPos(34,1)
write("iCube v0.1_alpha")
term.setCursorPos(14,6)
write("+--------------------+")
term.setCursorPos(14,7)
write("|")
menu(0,"Download Center |")
term.setCursorPos(14,8)
write("|")
menu(1,"Programs |")
term.setCursorPos(14,9)
write("|")
menu(2,"Restart |")
term.setCursorPos(14,10)
write("|")
menu(3,"Shutdown |")
term.setCursorPos(14,11)
write("|")
menu(4,"Help |")
term.setCursorPos(14,12)
write("+--------------------+")

event, key = os.pullEvent("key")
if key == 200 and sid > 0 then sid = sid - 1
elseif key == 208 and sid < 4 then sid = sid + 1
elseif key == 28 then
if sid == 0 then shell.run("ICO/root/downloadc")
elseif sid == 1 then shell.run("ICO/root/programs")
elseif sid == 2 then os.reboot()
elseif sid == 3 then os.shutdown()
elseif sid == 4 then shell.run("ICO/root/help")
end
end
end

#2 OmegaVest

  • Members
  • 436 posts

Posted 10 April 2012 - 09:29 PM

Okay, umm, are you trying to run the default help program? Because that requires arguments to run. So, in this case, you would need to write a window, or line that prompts the user for a help query, such as "apis" or "programming".

If you are not using the default help program, then we would need the code for the help program that you ARE using.

#3 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 10 April 2012 - 09:33 PM

Make sure the 3 files are present. Also try to add a break after the shell.run's to break the while loop.

so
if sid == 0 then
shell.run("ICO/root/downloadc")
break

I made the 3 files on my computer. Just had them simply clear the screen, print a message, sleep for 1 second. The code works great as is, no breaks needed.

You probably dont have access to those programs on the computer you are on or there is a problem with those programs.

Edited by luanub, 10 April 2012 - 09:48 PM.


#4 rex41043

  • Members
  • 88 posts

Posted 10 April 2012 - 09:38 PM

View PostOmegaVest, on 10 April 2012 - 09:29 PM, said:

Okay, umm, are you trying to run the default help program? Because that requires arguments to run. So, in this case, you would need to write a window, or line that prompts the user for a help query, such as "apis" or "programming".

If you are not using the default help program, then we would need the code for the help program that you ARE using.
no its 1 we made

#5 rex41043

  • Members
  • 88 posts

Posted 10 April 2012 - 09:50 PM

View Postluanub, on 10 April 2012 - 09:33 PM, said:

Make sure the 3 files are present. Also try to add a break after the shell.run's to break the while loop.

so
if sid == 0 then
shell.run("ICO/root/downloadc")
break

I made the 3 files on my computer. Just had them simply clear the screen, print a message, sleep for 1 second. The code works great as is, no breaks needed.

You probably dont have access to those programs on the computer you are on or there is a problem with those programs.
THANX SO MUCH IT WORKED





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users