Jump to content

Help about combobox


Recommended Posts

I'm trying to learn AutoIt so somebody can help me.

this is my form, so i want if i click start button

if checkbox1 checked, then send the number in combo box1, loop

if checkbox2 checked, then send the number in combo box2, loop

if checkbox1 and checkbox2 checked, send the number in combo box1 and then send the number in combo box2, loop

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 110, 125, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 8, 17, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 8, 32, 17, 17)
$Combo1 = GUICtrlCreateCombo("1", 32, 8, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($combo1, "2|3|4|5|6|7|8|9|0", "")
$Button1 = GUICtrlCreateButton("start", 8, 56, 89, 25)
$Button2 = GUICtrlCreateButton("stop", 8, 88, 89, 25)
$Combo2 = GUICtrlCreateCombo("2", 32, 32, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($combo2, "2|3|4|5|6|7|8|9|0", "")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Thank you very much.

Edited by tiktaktoe
Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 130, 145, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("", 8, 8, 17, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 8, 32, 17, 17)
$Combo1 = GUICtrlCreateCombo("1", 32, 8, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($combo1, "2|3|4|5|6|7|8|9|0", "")
$Button1 = GUICtrlCreateButton("start", 8, 56, 89, 25)
$Button2 = GUICtrlCreateButton("stop", 8, 88, 89, 25)
$Combo2 = GUICtrlCreateCombo("2", 32, 32, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($combo2, "2|3|4|5|6|7|8|9|0", "")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $C1, $C2

Func Loop()
        If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
        $C1 = GUICtrlRead($Combo1, 1)
        EndIf
        If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
        $C2 = GUICtrlRead($Combo2, 1)
        EndIf
        If $C1 <> '' Or $C2 <> '' Then
            MsgBox(64, 'Result', $C1 &' \ '&$C2)
        EndIf
        $C1 = '' ;clear values
        $C2 = '' ;clear values
EndFunc

Func Stop() ;clear values
    $C1 = ''
    $C2 = ''
EndFunc

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Loop()
        Case $Button2
            Stop()
    EndSwitch
WEnd

You didn't specify where to send, and because there are only 2 boxes, there's no loop.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Hi there,

Something like this?

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>


Dim $combo1value, $combo2value


$combo1value = "Not Selected"
$combo2value = "Not Selected"




#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 110, 125, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("", 8, 8, 17, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 8, 32, 17, 17)
$Combo1 = GUICtrlCreateCombo("1", 32, 8, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($Combo1, "2|3|4|5|6|7|8|9|0", "")
$Button1 = GUICtrlCreateButton("start", 8, 56, 89, 25)
$Button2 = GUICtrlCreateButton("stop", 8, 88, 89, 25)
$Combo2 = GUICtrlCreateCombo("2", 32, 32, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($Combo2, "2|3|4|5|6|7|8|9|0", "")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$check1 = GUICtrlRead($Checkbox1)
$check2 = GUICtrlRead($Checkbox2)
If $check1 <> 4 Then
$combo1value = GUICtrlRead($Combo1)
EndIf
If $check2 <> 4 Then
$combo2value = GUICtrlRead($Combo2)
EndIf
;do something else starting here
MsgBox(64, "Results", "Combo 1 value : " & $combo1value & @CRLF & "Combo 2 value : " & $combo2value & @CRLF)
;resetting gui
$combo1value = "Not Selected"
$combo2value = "Not Selected"
GUICtrlSetState($Checkbox1, 4)
GUICtrlSetState($Checkbox2, 4)
Case $Button2
;Stopping whatever
EndSwitch
WEnd

Cheers

Edited by November

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Thx for your help, that is not my mean.

if checkbox1 checked, then send the number in combo box1 TO NOTEPAID, ( if the number in combo box1 is 2 then send 2 to notepad ), loop

if checkbox2 checked, then send the number in combo box2  TO NOTEPAD, ( if the number in combo box2 is 3 then send 3 to notepad ), loop.

if checkbox1 and checkbox2 checked, send the number in combo box1 and then send the number in combo box2, loop

 

checkbox1 checked and checkbox2 can unchecked

checkbox2 checked and checkbox1 can unchecked

Edited by tiktaktoe
Link to comment
Share on other sites

Thx for your help, that is not my mean.

if checkbox1 checked, then send the number in combo box1 TO NOTEPAID, ( if the number in combo box1 is 2 then send 2 to notepad ), loop

if checkbox2 checked, then send the number in combo box2  TO NOTEPAD, ( if the number in combo box2 is 3 then send 3 to notepad ), loop.

if checkbox1 and checkbox2 checked, send the number in combo box1 and then send the number in combo box2, loop

 

checkbox1 checked and checkbox2 can unchecked

checkbox2 checked and checkbox1 can unchecked

Ok,

So you are really close..

Try to send those values to notepad, it really simple, let's see what you can do then :)

I will wait for some results.

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

it simple for you with 488 posts i think you very good, but im a newbie and so it simple with you but difficult with me.

Thx for your reply.

 

I am trying to get you to learn how to fish and not giving you the fish.

If you want to have 400 posts, try to do, and dont have shame to get it wrong.

For now what you want is someone who can do the job for you, that isnt nice at all.

Remember life is the consequense of bad and even worst choices.

Have a nice script life!

I am done with this topic, CLICK!

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...