ramin92003 Posted November 8, 2018 Share Posted November 8, 2018 Hi, Can you help me to fix this scripts? Thanks! expandcollapse popup#include <Misc.au3> ; include statements to handdel basic input functions #include <MsgBoxConstants.au3> ; include statement to use message box object #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 254, 233, 516, 270) $List1 = GUICtrlCreateList("", 16, 8, 217, 149, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; BitOR style taken from help file $sItems = "+|-|*|/" GUICtrlSetData($List1, $sItems) _GUICtrlListBox_SetSel($List1, 1) ; Set position 1 (which is the 2nd in list) as default $Button1 = GUICtrlCreateButton("Select", 80, 176, 75, 25) GUISetState(@SW_SHOW) Local $aaa $aaa = $Button1 $selItems = _GUICtrlListBox_GetSelItemsText($sItems) While 1 Switch $aaa = GUIGetMsg() Case $aaa = $GUI_EVENT_CLOSE ExitLoop Case $selItems = "+" MsgBox(0, "You choose:"," +") Case $selItems = "-" MsgBox(0, "You choose:", "-" ) Case $selItems = "*" MsgBox(0, "You choose", "*") Case $selItems = "/" MsgBox(0, "You choose", "/" ) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Developers Jos Posted November 8, 2018 Developers Share Posted November 8, 2018 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 8, 2018 Developers Share Posted November 8, 2018 7 minutes ago, ramin92003 said: Can you help me to fix this scripts? Thanks! Don't you think it would help when you give us a clue about the problem first? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
nooneclose Posted November 8, 2018 Share Posted November 8, 2018 There is something wrong with either: $selItems = _GUICtrlListBox_GetSelItemsText($sItems) or something is wrong with: GUICtrlSetData($List1, $sItems) your code is acting like the $sItems = "+|-|*|/" is not being stored properly or not being accessed properly. Basically, because no real case is found the code just ends. I think. Link to comment Share on other sites More sharing options...
ramin92003 Posted November 8, 2018 Author Share Posted November 8, 2018 Sorry, The problem is when running the code nothing appears on the screen. I mean the window doesn't come up. This script should show the math operations when selecting one of them from the list. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 8, 2018 Developers Share Posted November 8, 2018 Your code is really pretty messed up as far as logic is concerned. Have a look at this version and see if that is what you like to do: #include <Misc.au3>; include statements To handdel basic input functions #include <MsgBoxConstants.au3>; include statement To use message box object #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 254, 233, 516, 270) $List1 = GUICtrlCreateList("", 16, 8, 217, 149, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; BitOR style taken from help file $sItems = "+|-|*|/" GUICtrlSetData($List1, $sItems) _GUICtrlListBox_SetSel($List1, 1) ; Set position 1 (which is the 2nd in list) as default $Button1 = GUICtrlCreateButton("Select", 80, 176, 75, 25) GUISetState(@SW_SHOW) $selItems = _GUICtrlListBox_GetSelItemsText($sItems) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button1 Switch GUICtrlRead($List1) Case "+" MsgBox(0, "You choose:", "+") Case "-" MsgBox(0, "You choose:", "-") Case "*" MsgBox(0, "You choose", "*") Case "/" MsgBox(0, "You choose", "/") EndSwitch EndSwitch WEnd Jos ramin92003 and ibrahem 1 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ramin92003 Posted November 8, 2018 Author Share Posted November 8, 2018 33 minutes ago, Jos said: Your code is really pretty messed up as far as logic is concerned. Have a look at this version and see if that is what you like to do: #include <Misc.au3>; include statements To handdel basic input functions #include <MsgBoxConstants.au3>; include statement To use message box object #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 254, 233, 516, 270) $List1 = GUICtrlCreateList("", 16, 8, 217, 149, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; BitOR style taken from help file $sItems = "+|-|*|/" GUICtrlSetData($List1, $sItems) _GUICtrlListBox_SetSel($List1, 1) ; Set position 1 (which is the 2nd in list) as default $Button1 = GUICtrlCreateButton("Select", 80, 176, 75, 25) GUISetState(@SW_SHOW) $selItems = _GUICtrlListBox_GetSelItemsText($sItems) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button1 Switch GUICtrlRead($List1) Case "+" MsgBox(0, "You choose:", "+") Case "-" MsgBox(0, "You choose:", "-") Case "*" MsgBox(0, "You choose", "*") Case "/" MsgBox(0, "You choose", "/") EndSwitch EndSwitch WEnd Jos Thanks, 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