Jump to content
Sign in to follow this  
galan2015

Loop and set another data in GUICtrlCreateCombo

Recommended Posts

galan2015

 

;I'd like to on the end of the function, script changed for another option in the combolist. This will be part of the loop

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

$Form1 = GUICreate("Form1", 418, 177, 192, 114)
$Combo1 = GUICtrlCreateCombo("exe Files", 16, 24, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GuiCtrlSetData(-1,'ini Files|Txt Files|Cfg files')
$Combo2 = GUICtrlCreateCombo("Find A", 176, 24, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GuiCtrlSetData(-1,'Find B')
$Input1 = GUICtrlCreateInput("Input1", 16, 56, 321, 21)
$Button = GUICTRLCreateButton("check", 10, 10, 20,20)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 80, 97, 25)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 80, 97, 25)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 224, 80, 113, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

 

Edited by galan2015

Share this post


Link to post
Share on other sites
JLogan3o13

Can you please explain more clearly what you are trying to do? This...

script changed for another option in the combolist.

...is very vague. 


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
kylomas

galan2015,

Is your question related to this thread?  If so, does my response help?  If not, see JLogan3o13 above.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
galan2015

galan2015,

Is your question related to this thread?  If so, does my response help?  If not, see JLogan3o13 above.

kylomas

I would like to take a snapshot of data from text files. No.

1. My first combo [Select file]
2. My second combo [Male | Female]
3. My third combo [Michael | Jordan | Natasha]

I would like to function if it is proven options to choose from in ComboList1, ComboList2, Combolist3. After selecting ComboList3 (CL2 is a sub-CL1 and CL2 CL3 is a sub-category) and then to change to the next available option.

Share this post


Link to post
Share on other sites
Melba23

galan2015,

Does this help?

#include <GUIConstantsEx.au3>

$sData_1 = "Option 1|Option 2|Option 3"
$sData_2A = "|Option 101|Option 201|Option 301"
$sData_2B = "|Option 402|Option 502|Option 602"
$sData_2C = "|Option 703|Option 803|Option 903"

$hGUI = GUICreate("Test", 500, 500)

$cCombo_1 = GUICtrlCreateCombo("", 10, 10, 200, 20)
GUICtrlSetData($cCombo_1, $sData_1)

$cCombo_2 = GUICtrlCreateCombo("", 250, 10, 200, 20)
GUICtrlSetState($cCombo_2, $GUI_DISABLE)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cCombo_1
            Switch GUICtrlRead($cCombo_1)
                Case "Option 1"
                    GUICtrlSetData($cCombo_2, $sData_2A)
                    GUICtrlSetState($cCombo_2, $GUI_ENABLE)
                Case "Option 2"
                    GUICtrlSetData($cCombo_2, $sData_2B)
                    GUICtrlSetState($cCombo_2, $GUI_ENABLE)
                Case "Option 3"
                    GUICtrlSetData($cCombo_2, $sData_2C)
                    GUICtrlSetState($cCombo_2, $GUI_ENABLE)
            EndSwitch

    EndSwitch

WEnd

If this is nowhere close, then please try and explain what you are trying to do in more detail as you are not being very clear at present.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
galan2015

I need to change the data in 60,000 files. The function appends a line to each file.
I have three combo list:
1. The first combo A | B | C | .. | Z after selecting a name in the pop Combo 2
2. The names of clients
3. The third combo contains a list of files in a folder on my misfortune number of files to be edited for any user: 8.

After selecting the data manually from the combo letter, after pressing the button that activates the function appends data to a single file.

But I would like to function After adding in the file lines jumped to the next file and performed the function again. The file names in a combo 2 and 3 are variable.

Share this post


Link to post
Share on other sites
Melba23

galan2015,

That reads nothing like what you described in your earlier posts - and really does not advance us very much further forward. I will try and ask specific questions to see if I can tease out some more details.

- 1. The combo which the user actions first - what does it contain?

- 2. The combo which holds the "names of clients" - from where does it get these? Is its content alphabetically linked to the "A-Z" combo?

- 3. Where does the combo with a file list come in? I really hope you do not intend to put all 60,000 filenames in it!  You say you want to "jump[...] to the next file" - how do you define "the next file" if you can only select one at a time in the combo?

You answer those points clearly and we might be able to make some progress.

M23

  • Like 1

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
galan2015

Combo1 contains a list from A to Z.
Combo2
contains a list of names from txt file.              ;;;;;;;;;; Made by myself, User1|User2|User4

Combo 3 contains a list of paths to files from txt file ;;;;;;;;;;;; usrini.txt|user.txt|backup.txt|class.txt|forum.txt|log.txt ... and two others

I want to do :
Pick Combo1[A]
Pick Combo2[Andrzej1]
PIck Combo3[1] ; $i = 8, 8 files
Function
Pick Combo3[2]
Function
Pick Combo3[3]
Function

Pick Combo3[4]
Function

Pick Combo3[5]
Function

Pick Combo3[6]
Function

Pick Combo3[7]
Function
Pick Combo3[8]
Function

Pick Combo2[Andrzej2]
Pick Combo3[1]

Function
Pick Combo3[2]
Function
Pick Combo3[3]
Function

Pick Combo3[4]
Function

Pick Combo3[5]
Function

Pick Combo3[6]
Function

Pick Combo3[7]
Function
Pick Combo3[8]
Function


.........

Edited by galan2015

Share this post


Link to post
Share on other sites
galan2015

Otherwise, how to count the number of options in comboList?

Share this post


Link to post
Share on other sites
kylomas

galan2015,

Total entries or selected entries?  As I said in the thread that I pointed you to earlier, definition of the relationships of the data in the combo controls is the only difficult task here.  Combo1 is related to combo2...is related to combo2...etc...

Perhaps if you post some real world example data with an explanation of it's use it will become clearer. 

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
Melba23

galan2015,

Looking at what you want to do, why are you even thinking of using combos? All you do is run through their entries one by one in order - and that is a job for loops, not combos.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
galan2015

im gonna make some sample :P  give me a time

Share this post


Link to post
Share on other sites
galan2015

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 458, 122, 192, 114)
$Combo1 = GUICtrlCreateCombo("ComboA", 0, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUiCtrlSetData(-1,"ComboB")
$Combo2 = GUICtrlCreateCombo("Sex", 152, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Combo3 = GUICtrlCreateCombo("Combo3", 304, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 56, 97, 17)
$Button = GUICtrlCreateButton('write file',280,56,50,30)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

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

            Exit
        Case $Combo1
        $if1 = GuiCtrlRead($combo1)
IF      $if1 = 'ComboA' then
            GuiCtrlSetData($Combo2,"")
    GuiCtrlSetData($Combo2,"Male")
    EndIf
IF      $if1 = 'ComboB' then
        GuiCtrlSetData($Combo2,"")
    GuiCtrlSetData($Combo2,"Female")
    EndIf
        Case $Combo2
        $if1 = GuiCtrlRead($combo2)
IF      $if1 = 'Female' then
    GuiCtrlSetData($Combo3,"")
    GuiCtrlSetData($Combo3,"Agnieszka|Ania")
    EndIf
IF      $if1 = 'Male' then
    GuiCtrlSetData($Combo3,"")
    GuiCtrlSetData($Combo3,"Andrzej|Adam")
    Endif
        Case $Combo3
IF      $if1 = 'Andrzej' then
EndIf
        Case $Button
              GUICtrlSetState($Checkbox2,1)
              Sleep(150)
            GUICtrlSetState($Checkbox2,1)
            MSgBox(1,'ANd what now script should do','Script should pick Another option from $combo3. That is it')
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites
kylomas

Script should pick Another option from $combo3

Based on what?

 


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
JLogan3o13

Personally I would do something like this. Of course, if you get into multiple sub choices this is going to be a PITA to support:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 458, 122, 192, 114)
$Combo1 = GUICtrlCreateCombo("Choose Combo", 0, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"ComboA|ComboB", "Choose Combo")
$Combo2 = GUICtrlCreateCombo("Choose Sex", 152, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"Male|Female", "Choose Sex")
$Combo3 = GUICtrlCreateCombo("Choose Name", 304, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
        GUiCtrlSetData(-1,"Fred|Judy", "Choose Name")

$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 56, 97, 17)
$Button = GUICtrlCreateButton('write file',280,56,50,30)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            If GUICtrlRead($Combo1) = "Choose Combo" Then
                GUICtrlSetData($Combo2, "Choose Sex")
                GUICtrlSetData($Combo3, "Choose Name")
            Else
                GUICtrlSetData($Combo2, (GUICtrlRead($combo1) = "ComboA") ? "Male" : "Female")
                    If GUICtrlRead($Combo2) <> "Choose Sex" Then GUICtrlSetData($Combo3, (GUICtrlRead($combo2) = "Male") ? "Fred" : "Judy")
            EndIf
    EndSwitch
WEnd

 


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
galan2015

Personally I would do something like this. Of course, if you get into multiple sub choices this is going to be a PITA to support:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 458, 122, 192, 114)
$Combo1 = GUICtrlCreateCombo("Choose Combo", 0, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"ComboA|ComboB", "Choose Combo")
$Combo2 = GUICtrlCreateCombo("Choose Sex", 152, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"Male|Female", "Choose Sex")
$Combo3 = GUICtrlCreateCombo("Choose Name", 304, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
        GUiCtrlSetData(-1,"Fred|Judy", "Choose Name")

$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 56, 97, 17)
$Button = GUICtrlCreateButton('write file',280,56,50,30)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            If GUICtrlRead($Combo1) = "Choose Combo" Then
                GUICtrlSetData($Combo2, "Choose Sex")
                GUICtrlSetData($Combo3, "Choose Name")
            Else
                GUICtrlSetData($Combo2, (GUICtrlRead($combo1) = "ComboA") ? "Male" : "Female")
                    If GUICtrlRead($Combo2) <> "Choose Sex" Then GUICtrlSetData($Combo3, (GUICtrlRead($combo2) = "Male") ? "Fred" : "Judy")
            EndIf
    EndSwitch
WEnd

 

​no that is big fail :P hope i will learn by myself and show u how  how i solve the problem

 

Share this post


Link to post
Share on other sites
JLogan3o13

As I said, it would be a pain in the ass to manage, but you're insisting to do it with combos rather than a loop (as at least one member has already suggested).


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

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  

  • Similar Content

    • omicron
      By omicron
      Hello!

      I am working on a function that I am just getting lost on. The goal is a multiple nested loop.

      Here are the steps:
      Contents of file1.txt::
      [topic] var1=Name var2=OtherName var3=SomeotheName Contents of file2.txt::
      [subTopic] top=sub1 top2=sub2 top3=sub3 The Shell I am working from::
      #include <file.au3> $file = "c:\yourfile.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) msgbox(0,'','the line ' & $i & ' is ' & $line) Next FileClose($file) Understanding however that the "msgbox" needs to then become a variable. in example the following::
      $file = "c:\yourfile.txt" FileOpen($file, 0) While true( prog.exe is running && "WinName" is open) do For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) ;Open File to log "current location of file 1" FileWriteLine ("filename", $i & ' is ' & $line) var = $line Next $file2 = "c:\yourfile.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) ; OpenFile to log "Current location of file 2" FileWriteLine ("filename", $i & ' is ' & $line) Next FileClose($file2) FileClose($file) The goal in written form is the following ::

      While in "OpenWindow"
          read from file 1 starting at line 1 until end of file.
         file 1 is a list of names to be searched.
         With $line selected, add this element to the element in file 2.
       
      The search of a variables in list 1 and list 2 differ on the amount of posts that day. (This is not a web based platform, it is a game) I need to search 2 names and take a screenshot of the out put. The sizes of the names list depend on the activity of names at the time of search.
      This loop continues until all the names from both lists have been searched. Mostly in the format of::
      File1= item
      File2= Vendor
       
      Item + Vendor  ( Capture screen, scroll) -- Not sure how to detect if I need to scroll)
       
      Thank you for your help and support!
    • Jackized
      By Jackized
      Is there a way to loop back to the beginning and keep the already entered data in the GUI Input boxes? I can GUIDelete and start a new GUI but all the typed data has to be redone. Here is a sample.

       
      #Include <GuiConstants.au3> Dim $msg,$okbutton,$cancelbutton,$objOU,$intAccValue,$strGroup1,$strGroup2 Dim $strFirstName,$strLastName,$strUserName,$strUserName2,$strPassword,$strDescription,$strContainer Dim $Combo,$Duration Do $Form1 = GuiCreate("", 300, 300)          GUISetBkColor(0xA6CAF0)         GuiCtrlCreateLabel("First Name:", 50, 10)         $strFirstName = GuiCtrlCreateInput("", 50, 25, 200, 20)         GUICtrlSetState ( $okbutton, $GUI_FOCUS )         GuiSetState()     $okbutton = GUICtrlCreateButton ("OK",75,240,50,20)     $cancelbutton = GUICtrlCreateButton ("Cancel",175,240,50,20) While 1     $msg = GUIGetMsg()     Select     Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton             Exit     Case $msg = $okbutton             $strFirstName = GUICtrlRead($strFirstName)             ExitLoop     EndSelect Wend $len = StringLen($strFirstName)     If $len > "20" then         MsgBox(0, "ERROR Name to long", $strFirstName & " can't be over 20 characters." & @CRLF & "Total: " & $len)         ;Exit         GUIDelete($Form1)     EndIf Until $len < "20" MsgBox(0, "Done", "")  
    • mrtgtr
      By mrtgtr
      I want to do something , after wait 2 min and again do same thing
      But I do do not want with sleep, it must be timer 
      How I do this ?
    • Skeletor
      By Skeletor
      Hi Guys,
      Is it possible to get a variable on your For..Next loop? 
       
      Local $Lines1 = _FileCountLines(C:\temp\test.txt) Local $linesToCount2 = $Lines1 + 2 $var = Number($linesToCount2) For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = $var To $count Next ;Code does stuff here Next Somehow my code doesn't work even though I thought I could convert the variable to a Integer / Number.
      This code I posted above does not move to the next value.
      But the code below does... why is that?
      For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = 2 To $count Next ;Code does stuff here Next  
      Why is the For loop resetting itself?
      Is it because the program does not cache the variable and needs to keep on acquiring this variable each time?
      If so , how would you make this variable static?

       
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
×