AutoScrub Posted December 22, 2014 Share Posted December 22, 2014 I'm loosing my mind, hopefully someone can help me out. Basically I have a tab open with an input box where you can type a name in and then it goes ahead and checks that name against a library for info. I have the input box set with a name when it launches, so it queries that info and that single instance works. What does not work is me being able to query any other instance. $Tab_Tracker = GUICtrlCreateTabItem("Tracker") Global $I_SN = GUICtrlCreateInput("TestName", 16, 48, 169, 21) $Label11 = GUICtrlCreateLabel("Name: ", 16, 80, 186, 25) $Label12 = GUICtrlCreateLabel("Level: ", 16, 112, 186, 25) $Label13 = GUICtrlCreateLabel("Id: ", 16, 144, 186, 25) $Label14 = GUICtrlCreateLabel("Elo: ", 16, 176, 186, 25) $Label15 = GUICtrlCreateLabel("Label15", 16, 208, 186, 25) $B_S_LU = GUICtrlCreateButton("Query", 200, 48, 75, 25) $UserName = GUICtrlRead($I_SN) Func Query() $I_SN = GUICtrlCreateInput $UserName = GUICtrlRead($I_SN) EndFunc I can't figure out how I can get the input variable to change in the code once I press the button and have all my labels (WHICH ARE BASED OF OFF THE VAR) to change. Please help Obi-Wan Kenobi. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 22, 2014 Moderators Share Posted December 22, 2014 You keep recreating the Input (in the Query() func), using GUICtrlRead right after before anything can be typed in it. Remove the Query() $I_SN = GUICtrlCreateInput Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AutoScrub Posted December 22, 2014 Author Share Posted December 22, 2014 So I would have GUICtrlRead($I_SN, 0), which would read it but you said to add it in the querry and then you said to remove querry, which is it, cause neither seems to work. Link to comment Share on other sites More sharing options...
AutoScrub Posted December 22, 2014 Author Share Posted December 22, 2014 right after before I feel like your trolling me so hard. Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted December 22, 2014 Moderators Solution Share Posted December 22, 2014 AutoScrub,Moderators here are not in the habit of trolling newcomers. We prefer welcoming them to the forum - so consider yourself welcome. SmOke_N's comment was absolutely correct - in the Query() function you are reassigning the $I_SN by (incorrectly and with bad syntax) reusing GUICtrlCreateInput so that the original ControlID set when creating the "TestName" input is lost. That means that your GUICtrlRead does not use the correct value for the original input and so fails to read its content. Take a look at this example script:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) Global $I_SN = GUICtrlCreateInput("TestName", 16, 48, 169, 21) $Label11 = GUICtrlCreateLabel("Name: ", 16, 80, 186, 25) $Label12 = GUICtrlCreateLabel("Level: ", 16, 112, 186, 25) $Label13 = GUICtrlCreateLabel("Id: ", 16, 144, 186, 25) $Label14 = GUICtrlCreateLabel("Elo: ", 16, 176, 186, 25) $Label15 = GUICtrlCreateLabel("Label15", 16, 208, 186, 25) $B_S_LU = GUICtrlCreateButton("Query", 200, 48, 75, 25) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $B_S_LU _Query() EndSwitch WEnd Func _Query() ; Read username $UserName = GUICtrlRead($I_SN) If $UserName Then ; Change label GUICtrlSetData($Label11, "Name: " & $UserName) EndIf EndFunc ;==>_QueryPlease ask if yo have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AutoScrub Posted December 22, 2014 Author Share Posted December 22, 2014 Thank's alot! That helped understand it much better and I was able to resolve the issue using the While and Func example you gave. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2014 Moderators Share Posted December 22, 2014 AutoScrub,Glad I could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 22, 2014 Moderators Share Posted December 22, 2014 Guess I forgot a comma separating the two. I'm not in the habit of recreating code that doesn't run out of the box to demonstrate the issue. Certainly not looking to "troll" anyone, regardless of their status on the forum. Glad things worked out for you, as it seems, the original code you posted (able to be ran on our side or not) did not really demonstrate the extent of the issue based on your reply to Melba23. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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