Jump to content
Sign in to follow this  
ramin92003

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

 

Share this post


Link to post
Share on other sites

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.
  :)

Share this post


Link to post
Share on other sites
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.
  :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.
  :)

Share this post


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, 

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...