SevereMessage Posted July 24, 2015 Share Posted July 24, 2015 Trying to make sort of an incremental game for the lols, and here's my problem right now.Keep in mind I'm a complete newbie at autoit, but I have a pretty good understanding of it, so go easy on me.I have currently$gems = GUICreate("Gem Seller", 219, 157, 887, 250)$SellSelected = GUICtrlCreateButton("Sell Selected", 8, 40, 89, 25)$Sellall = GUICtrlCreateButton("Sell all", 68, 96, 73, 25)$Select = GUICtrlCreateCombo("Choose a Gem to sell!", 8, 8, 193, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))$gemtype = GUICtrlSetData(-1, "Ruby|Emerald|Sapphire|Topaz|")$status = _GUICtrlStatusBar_Create($gemtype)_GUICtrlStatusBar_SetText($status, "You've selected: ")I've added also a status bar How can I read the data that GUICtrlSetData is selected? I tried$selGUICtrlRead($gemtype) and it doesn't work. Link to comment Share on other sites More sharing options...
water Posted July 24, 2015 Share Posted July 24, 2015 (edited) GUICtrlRead is fine. But you have to read the control. Means:$sel = GUICtrlRead($Select) Edited July 24, 2015 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SevereMessage Posted July 24, 2015 Author Share Posted July 24, 2015 (edited) GUICtrlRead is fine. But you have to read the control. Means:$sel = GUICtrlRead($Select) Sorry, I ment it, right now its laid out like this:$gems = GUICreate("Gem Seller", 219, 157, 887, 250)$SellSelected = GUICtrlCreateButton("Sell Selected", 8, 40, 89, 25)$Sellall = GUICtrlCreateButton("Sell all", 68, 96, 73, 25)$Select = GUICtrlCreateCombo("Choose a Gem to sell!", 8, 8, 193, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))$gemtype = GUICtrlSetData(-1, "Ruby|Emerald|Sapphire|Topaz|")$status = _GUICtrlStatusBar_Create($gemtype)$input1 = GUICtrlRead($gemtype)_GUICtrlStatusBar_SetText($status, "You've selected: " & $input1) but it returns as 1, which I'm guessing is from the -1 Edit: or no, I followed the $select, but it displays "Choose a gem to sell" not the actual gems. How can I define what gem is what? I thought about maybe splitting the string? Edited July 24, 2015 by SevereMessage Link to comment Share on other sites More sharing options...
water Posted July 24, 2015 Share Posted July 24, 2015 Until you have not selected an item the default value is being returned. SevereMessage 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SevereMessage Posted July 24, 2015 Author Share Posted July 24, 2015 Until you have not selected an item the default value is being returned.I selected topaz for example, but it still returns 0? Link to comment Share on other sites More sharing options...
water Posted July 24, 2015 Share Posted July 24, 2015 Is this the whole script you posted? You need to run a loop to wait until the control has been selected. SevereMessage 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SevereMessage Posted July 24, 2015 Author Share Posted July 24, 2015 Is this the whole script you posted? You need to run a loop to wait until the control has been selected.It's the only part that matters right now, the other parts are way too long and unnecessary, what can I add to make it work and how can I define the strings? Link to comment Share on other sites More sharing options...
water Posted July 24, 2015 Share Posted July 24, 2015 Something like this:#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $sComboRead = "" Local $hGUI = GUICreate("Example", 300, 200) Local $hComboBox = GUICtrlCreateCombo("Choose a Gem to sell!", 10, 10, 185, 20) GUICtrlSetData($hComboBox, "Ruby|Emerald|Sapphire|Topaz") Local $hClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hClose ExitLoop Case $hComboBox $sComboRead = GUICtrlRead($hComboBox) MsgBox($MB_SYSTEMMODAL, "", "You have selected: " & $sComboRead, 0, $hGUI) EndSwitch WEnd SevereMessage 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SevereMessage Posted July 24, 2015 Author Share Posted July 24, 2015 Something like this:#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $sComboRead = "" Local $hGUI = GUICreate("Example", 300, 200) Local $hComboBox = GUICtrlCreateCombo("Choose a Gem to sell!", 10, 10, 185, 20) GUICtrlSetData($hComboBox, "Ruby|Emerald|Sapphire|Topaz") Local $hClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hClose ExitLoop Case $hComboBox $sComboRead = GUICtrlRead($hComboBox) MsgBox($MB_SYSTEMMODAL, "", "You have selected: " & $sComboRead, 0, $hGUI) EndSwitch WEnd Ooh right, thank you very much, added in_GUICtrlStatusBar_SetText($status, "You've selected: " & $Select2) in case and it works perfectly, next question how can I define Topaz, Ruby, etc?Likeif GUiCtrlRead(Topaz)ThenCheckAmount() Link to comment Share on other sites More sharing options...
water Posted July 24, 2015 Share Posted July 24, 2015 What do you mean by "define"? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SevereMessage Posted July 24, 2015 Author Share Posted July 24, 2015 What do you mean by "define"?Like make them variables I guess?I want to make it so whenever ruby for example is selected, and is clicked "SELL"it runs a function, (Different function for each gem)I'm guessing I would need to define it as a variable? Link to comment Share on other sites More sharing options...
water Posted July 24, 2015 Share Posted July 24, 2015 Case $SellSelected ; When the Sell button is pressed check which item to sell. $sComboRead = GUICtrlRead($hComboBox) If $sComboRead = "xy" Then ...Something like this? SevereMessage 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SevereMessage Posted July 24, 2015 Author Share Posted July 24, 2015 Case $SellSelected ; When the Sell button is pressed check which item to sell. $sComboRead = GUICtrlRead($hComboBox) If $sComboRead = "xy" Then ...Something like this? Aww yiss, thank you so much! Link to comment Share on other sites More sharing options...
water Posted July 24, 2015 Share Posted July 24, 2015 Glad to be of service My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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