Vladi243 Posted May 25, 2008 Share Posted May 25, 2008 I created a simple GUI with inputbox and button. The problem is that the value that I put in the inputbox isn't read. I tried 2 scripts. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 293, 117, 301, 284) $Input1 = GUICtrlCreateInput("", 67, 24, 150, 21) $Button1 = GUICtrlCreateButton("OK", 104, 72, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Events GUICtrlSetOnEvent($Button1, "clicked") GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func clicked() GUIDelete() Run ("C:\Program Files\Mozilla Firefox\firefox.exe") Sleep (5000) Send ("{TAB 2}") $ReadInput1=GUICtrlRead ($Input1) Send ($ReadInput1);Its not working. Sending only the number "0". EndFunc #include <GUIConstants.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 293, 117, 301, 284) $Input1 = GUICtrlCreateInput("", 67, 24, 150, 21) $Button1 = GUICtrlCreateButton("OK", 104, 72, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Events GUICtrlSetOnEvent($Button1, "clicked") GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func clicked() GUIDelete() Run ("C:\Program Files\Mozilla Firefox\firefox.exe") Sleep (5000) Send ("{TAB 2}") Send (GUICtrlRead ($Input1));Its not working. Sending only the number "0". EndFunc What's wrong with my script. Link to comment Share on other sites More sharing options...
Kyme Posted May 25, 2008 Share Posted May 25, 2008 you can read gui if youre Form1 it's close....make it to don't close when you press "Ok" or use IniWrite/IniRead hope to help you Link to comment Share on other sites More sharing options...
Vladi243 Posted May 25, 2008 Author Share Posted May 25, 2008 OK, I'll try it later. Thank you. Link to comment Share on other sites More sharing options...
TnTProductions Posted May 25, 2008 Share Posted May 25, 2008 (edited) sorry i found even more errors but now its fixed so here is finished code #include <GUIConstants.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 293, 117, 301, 284) $Input1 = GUICtrlCreateInput("", 67, 24, 150, 21) $Button1 = GUICtrlCreateButton("OK", 104, 72, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop GUIDelete() Run ("C:\Program Files\Mozilla Firefox\firefox.exe") Sleep (5000) Send ("{TAB 2}") Case $nMsg = $button1 $ReadInput1 = GUICtrlRead($Input1) Send($ReadInput1);Its not working. Sending only the number "0". EndSelect WEnd P.S add an exit functions its real annoying not being able to exit your script!!! Edited May 25, 2008 by TnTProductions "FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology" Link to comment Share on other sites More sharing options...
Vladi243 Posted May 26, 2008 Author Share Posted May 26, 2008 This script isn't working. When I press on OK button there are no reaction. I want that after pressing on OK, it will continue the script. Link to comment Share on other sites More sharing options...
sandin Posted May 26, 2008 Share Posted May 26, 2008 what does Send ("{TAB 2}") means? what are you trying to achieve with your script? Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Vladi243 Posted May 26, 2008 Author Share Posted May 26, 2008 I'm trying to create a bot that writing and sending commands in the browser instead of me.The script above is just a simple example, so I can learn how to use with GUICtrlRead(). As I've already said, this function doesn't working for me. Link to comment Share on other sites More sharing options...
sandin Posted May 26, 2008 Share Posted May 26, 2008 ...anywayz, this will send your input: #include <GUIConstants.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 293, 117, 301, 284) $Input1 = GUICtrlCreateInput("", 67, 24, 150, 21) $Button1 = GUICtrlCreateButton("OK", 104, 72, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Events GUICtrlSetOnEvent($Button1, "clicked") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") GUISetState() While 1 Sleep(10) WEnd func _exit() Exit EndFunc Func clicked() Local $ReadInput1 = GUICtrlRead($Input1) GUIDelete($Form1) Run ("C:\Program Files\Mozilla Firefox\firefox.exe") Sleep (5000) Send ("{TAB 2}") Send ($ReadInput1) Exit EndFunc Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
enaiman Posted May 26, 2008 Share Posted May 26, 2008 IMO, your problem is that you're deleting the GUI first and try to read from it after ... and that can't work. What you can do is: read the value prior to deleting. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode Dim $StringToSend #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 293, 117, 301, 284) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitFunc") $Input1 = GUICtrlCreateInput("", 67, 24, 150, 21) $Button1 = GUICtrlCreateButton("OK", 104, 72, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Events GUICtrlSetOnEvent($Button1, "clicked") GUISetState() While 1 Sleep(200) WEnd Func clicked() $StringToSend = GUICtrlRead ($Input1) MsgBox(0, "Sending to Firefox", $StringToSend) GUIDelete() Run ("C:\Program Files\Mozilla Firefox\firefox.exe") Sleep (5000) Send ("{TAB 2}") Send ($StringToSend);Its not working. Sending only the number "0". EndFunc Func ExitFunc() Exit EndFunc SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Vladi243 Posted May 26, 2008 Author Share Posted May 26, 2008 Thanks guys!!! The both scripts is sending my input:). Link to comment Share on other sites More sharing options...
rasim Posted May 26, 2008 Share Posted May 26, 2008 Vladi243Don`t mix GUIOnEventMode with GUIGetMsg. Link to comment Share on other sites More sharing options...
Vladi243 Posted May 26, 2008 Author Share Posted May 26, 2008 Vladi243Don`t mix GUIOnEventMode with GUIGetMsg.OK, but why??? Link to comment Share on other sites More sharing options...
sandin Posted May 26, 2008 Share Posted May 26, 2008 cause only one of them can work, it's either GuiGetMsg, or GuiOnEventMode. Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now