Jump to content

How Can I fix my Scripts - (Moved)


Recommended Posts

Hi,

Can you help me to fix this scripts? Thanks!

#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 post
Share on other sites
  • Developers

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 post
Share on other sites
  • Developers
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 post
Share on other sites
  • Developers

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

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 post
Share on other sites
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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...