Sign in to follow this  
Followers 0
Cha0sBG

Combo & array

12 posts in this topic

#1 ·  Posted (edited)

Hello,

i was wondering how can i make a combo show all active windows and processes

do i have to use an array or what ?

waiting for reply ^^

Edited by Cha0sBG

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites



Take the example from the command GuiCtrlCreateCombo (which will give you a gui window with a combo box in it) and then add the example from the command Processlist and modify it by replacing the messagebox with:

GuiCtrlSetData ($ComboVariable, $list[$i][0] & " --> " & $list[$i][1])

Once you've done that, and if it still doesn't work, post ye code we shall see what's wrong yar.

Share this post


Link to post
Share on other sites

$Form1 = GUICreate("Form1", 288, 252, 222, 139)
$combo=GUICtrlCreateCombo("",5,5,120,25)
$combo2=GUICtrlCreateCombo("",130,5,150,25)

$pro=ProcessList()
for $x =1 to $pro[0][0]
GUICtrlSetData($combo,$pro[$x][0])
Next
$win=winList()
for $y =1 to $win[0][0]
GUICtrlSetData($combo2,$win[$y][0])
Next
GUISetState(@SW_SHOW)
While 1
    sleep(100)
WEnd

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Acequi i kinda followed your example but alitle difrent but i think i messed up :S

#include <GUIConstantsEx.au3>

$GUI = GUICreate("Function Manager", 300, 200)
$Combo = GUICtrlCreateCombo("", 20, 10, 150, 20)
$Button1 = GUICtrlCreateButton("Refresh List", 20, 35, 70, 20)
$pro=ProcessList()
$radio1 = GUICtrlCreateRadio("Windows", 105, 35)
$radio2 = GUICtrlCreateRadio("Processes", 105, 55)
GUISetState()

While 1
    $msg = GUIGetMsg()
    $pro=ProcessList()
        for $x =1 to $pro[0][0]
    Next
    $win=winList()
    for $y =1 to $win[0][0]
Next
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio1), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        GUICtrlSetData($Combo,$pro[$x][0])
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio2), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        GUICtrlSetData($Combo,$win[$y][0])
        EndIf
WEnd

Hmm any ideas ? ;)

Edited by Cha0sBG

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

Acequi i kinda followed your example but alitle difrent but i think i messed up :S

#include <GUIConstantsEx.au3>

$GUI = GUICreate("Function Manager", 300, 200)
$Combo = GUICtrlCreateCombo("", 20, 10, 150, 20)
$Button1 = GUICtrlCreateButton("Refresh List", 20, 35, 70, 20)
$pro=ProcessList()
$radio1 = GUICtrlCreateRadio("Windows", 105, 35)
$radio2 = GUICtrlCreateRadio("Processes", 105, 55)
GUISetState()

While 1
    $msg = GUIGetMsg()
    $pro=ProcessList()
        for $x =1 to $pro[0][0]
    Next
    $win=winList()
    for $y =1 to $win[0][0]
Next
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio1), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        GUICtrlSetData($Combo,$pro[$x][0])
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio2), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        GUICtrlSetData($Combo,$win[$y][0])
        EndIf
WEnd

Hmm any ideas ? :D

What's up with these For/Next loops?
; ...

    For $x = 1 To $pro[0][0]
    Next

; ...

    For $y = 1 To $win[0][0]
    Next

Didn't you mean to have some code inside those loops?

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

umm isn't this a code ??? in the loop ? >.<

$pro=ProcessList()
        for $x =1 to $pro[0][0]
    Next
    $win=winList()
    for $y =1 to $win[0][0]
Next

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

Acequi i kinda followed your example but alitle difrent but i think i messed up :S

#include <GUIConstantsEx.au3>

$GUI = GUICreate("Function Manager", 300, 200)
$Combo = GUICtrlCreateCombo("", 20, 10, 150, 20)
$Button1 = GUICtrlCreateButton("Refresh List", 20, 35, 70, 20)
$pro=ProcessList()
$radio1 = GUICtrlCreateRadio("Windows", 105, 35)
$radio2 = GUICtrlCreateRadio("Processes", 105, 55)
GUISetState()

While 1
    $msg = GUIGetMsg()
    $pro=ProcessList()
        for $x =1 to $pro[0][0]
    Next
    $win=winList()
    for $y =1 to $win[0][0]
Next
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio1), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        GUICtrlSetData($Combo,$pro[$x][0])
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio2), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        GUICtrlSetData($Combo,$win[$y][0])
        EndIf
WEndoÝ÷ Øy¦j|¢uæ¬þ«¨µä𡸠~V°³­*.®Ç+máh¬×±´º(¦ÉÞyÛhµ©¦Vy·¢·²¢êÖ)^)mçºÇ¢~+mjG¬¦Vz)ìײ¢íý­ì!W¥¢r¢êÜ¢jnµêðYcºËlÛaz·×2rW­º.­"{azÇ¢wi§Ê¢jez×¥Êw ç-yÛh±ëmçZµª¶¢fèrí®bÈzØh±áh¬×±¶Z(¦ÆòºÈ§«­¢+ÙÕ¥
ÑɱMÑÑ ÀÌØí
½µ½YÉ¥±°ÀÌØíÙÉlÀÌØí¥ulÁtµÀìÅÕ½Ðì´´ØÈìÅÕ½ÐìµÀìÀÌØíÙÉlÀÌØí¥ulÅt¤

Share this post


Link to post
Share on other sites

so if i put the for/next loop still gets errors .... i want when i push the button to clear the combo list and then set the data ..


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

so if i put the for/next loop still gets errors .... i want when i push the button to clear the combo list and then set the data ..

All right, well you've been a good enough sport, here you go. ;)

#include <GUIConstantsEx.au3>

$GUI = GUICreate("Function Manager", 300, 200)
$Combo = GUICtrlCreateCombo("", 20, 10, 150, 20)
$Button1 = GUICtrlCreateButton("Refresh List", 20, 35, 70, 20)
$pro=ProcessList()
$radio1 = GUICtrlCreateRadio("Processes", 105, 35)
$radio2 = GUICtrlCreateRadio("Windows", 105, 55)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio1), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        $pro=ProcessList()
        for $x =1 to $pro[0][0]
            GUICtrlSetData ($Combo, $pro[$x][0])
        Next
    EndIf
    If $msg = $Button1 And BitAND(Guictrlread($radio2), $GUI_CHECKED) = $GUI_CHECKED Then
        GUICtrlSetData($Combo, "")
        $win=winList()
        for $x =1 to $win[0][0]
            If $win[$x][0] <> "" AND IsVisible($win[$x][1]) Then
                GUICtrlSetData ($Combo, $win[$x][0])
            EndIf
        Next
    EndIf
WEnd

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf
EndFunc

Share this post


Link to post
Share on other sites

umm some of the active windows are showing 2 times some of the 2 times :S


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

umm some of the active windows are showing 2 times some of the 2 times :S

You should be able to weed those out with _GuiCtrlComboBox_FindStringExact(), just and another If...Then statement into the For...Next loop for the Windows loop.

You'll have to add #Include <GuiComboBox.au3> to the top of the script per the help file.

Share this post


Link to post
Share on other sites

umm isn't this a code ??? in the loop ? >.<

$pro=ProcessList()
        for $x =1 to $pro[0][0]
    Next
    $win=winList()
    for $y =1 to $win[0][0]
Next
No. Run Tidy (Ctrl-T in SciTE) on your code and look at the indentation. This is one loop (with no code inside):
for $x =1 to $pro[0][0]
Next

You might check this use of a loop:

#include <Process.au3>

$win=winList()
For $w = 1 to $win[0][0]
    $WinProc = WinGetProcess($win[$w][1])
    ConsoleWrite("Window Title = " & $win[$w][0] & @CRLF & _
            "Window Handle = " & $win[$w][1] & @CRLF & _
            "Window PID = " & $WinProc & @CRLF & _
            "Window Process = " & _ProcessGetName($WinProc) & @CRLF & @CRLF)
Next

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0