Jump to content

display a list of files from a folder..?


Recommended Posts

I need some help.. I want to know how to get a list of files from a folder.. e.g. programs files, or my documents, can i get a list of all the files, and i can open them from autoits interface? i'm a little lost for words.. or i should say code on how to do this. :)

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 462, 285, 192, 125)
$List1 = GUICtrlCreateList("", 16, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$List2 = GUICtrlCreateList("", 240, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$List3 = GUICtrlCreateList("", 16, 192, 425, 71, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Programs files or whatever", 24, 8, 128, 17)
GUICtrlCreateLabel("My documents or whatever", 240, 8, 132, 17)
GUICtrlCreateLabel("Desktop or whatever", 24, 176, 103, 17)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit
Edited by slightly_abnormal
Link to comment
Share on other sites

  • Moderators

Look at FileFindFirstFile() in the Help File. Perfect Example there.

Store them in an Array() Then call them as you need them.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

look at FileFindFirstFile, FileFindNextFile, and FileOpenDialog in the help file.

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

Taken from Lesson #6 of "Welcome to Autoit 1-2-3"

; includes
#include <GuiConstants.au3>
#include <file.au3>

;****************** FILE LOCATION **********

$File_loc = @ScriptDir & "\"
$File_type = "*.txt"

;********************************************


; create the GUI.
$win = GUICreate("File List/View Demo", 614, 370)
; set the font for the GUI
GUISetFont(9, 400, -1, "MS Sans Serif")
; create buttons.
$btnList = GUICtrlCreateButton("&List Files", 10, 330, 75, 25)
$btnView = GUICtrlCreateButton("&View File", 85, 330, 75, 25)
; create the left list.
$TutorItList = GUICtrlCreateList("", 10, 10, 150, 330)
; create the right edit.
$TutorItEdit = GUICtrlCreateEdit("Please select a tutorial from the list to your left.", 175, 10, 420, 345, $ES_AUTOVSCROLL + $ES_READONLY + $ES_MULTILINE + $WS_VSCROLL)
; set the edit colors.
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetColor(-1, 0x000000)
; set focus to the edit.
GUICtrlSetState($TutorItList, $GUI_FOCUS)
; show the GUI.
GUISetState()

; start the loop.
While 1
; listen for a message
    $msg = GUIGetMsg()
; using select/case for the message
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            Exit
        Case $msg = $btnList
            Set_tutor()
        Case $msg = $btnView
            View_tutor()
; end the selections        
    EndSelect
    
WEnd

; Function to populate the left list.
Func Set_tutor()
    $TutList = _FileListToArray ($File_loc, $File_type, 1); list files to an array.
    If (Not IsArray($TutList)) Or (@error = 1) Then
        MsgBox(262208, "Tutor Error", "No Files\Folders Found.   ", 5)
        Return
    EndIf
    GUICtrlSetData($TutorItList, ""); set list to empty.
    For $x = 1 To $TutList[0]; for loop to place the files in the list.
        GUICtrlSetData($TutorItList, (StringTrimRight($TutList[$x], 4)) & "|", 1); string trim the last 4 characters ( .txt )
    Next
EndFunc   

; Function to populate the right edit.
Func View_tutor()
    $s_text = GUICtrlRead($TutorItList); read the selected file to a variable.
    If $s_text = "" Then Return
    $n_text = StringTrimLeft($File_type, 1)
    $s_text = $File_loc & $s_text & $n_text; set the location of the file.
    Dim $Tut_text
    If Not _FileReadToArray($s_text, $Tut_text) Then; read the file to an array.
        MsgBox(4096, "Tutor Error", " Error reading log to Array     error:" & @error)
        Return
    EndIf
    GUICtrlSetData($TutorItEdit, ""); set the edit to empty.
    For $x = 1 To $Tut_text[0]; for loop to place the read file into the edit.
        GUICtrlSetData($TutorItEdit, $Tut_text[$x] & @CRLF, 1)
    Next
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Moderators

Val, you should just link it, I've seen this thing in 3 different places in 10 mins :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

here's what i got out of the help file.. not exactly what i was looking for.. :)

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 462, 285, 192, 125)
$List1 = GUICtrlCreateList("", 16, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$search = FileFindFirstFile("C:\program files")  
$List2 = GUICtrlCreateList("", 240, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$search = FileFindFirstFile("%homedrive%%homepath%\my documents")  
$List3 = GUICtrlCreateList("", 16, 192, 425, 71, -1, $WS_EX_CLIENTEDGE)
$search = FileFindFirstFile("%homedrive%%homepath%\desktop")  
GUICtrlCreateLabel("Programs files or whatever", 24, 8, 128, 17)
GUICtrlCreateLabel("My documents or whatever", 240, 8, 132, 17)
GUICtrlCreateLabel("Desktop or whatever", 24, 176, 103, 17)
GUISetState(@SW_SHOW)

$message = "Hold down Ctrl or Shift to choose multiple files."

$var = FileOpenDialog($message, "C:\program files", "All Files (*.)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)


If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd
Link to comment
Share on other sites

another option, just replace the input for a select folder

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars', 1)

Dim $a_check[10], $msg, $ret, $s_attr
Dim $input, $group, $a_attr, $listbox, $button, $btn_exit

GUICreate("ListBox Add Item Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Enter files to find", 25, 15)
$input = GUICtrlCreateInput("", 125, 10, 180, 25)
$group = GUICtrlCreateGroup("Atrributes", 10, 40, -1, 200)
$a_attr = StringSplit("A,D,H,RO,RW,S,E,Drives,NB", ",")
$a_check[0] = 9
$a_check[1] = GUICtrlCreateCheckbox("Archive", 15, 55, 170, 20)
$a_check[2] = GUICtrlCreateCheckbox("Directory", 15, 75, 170, 20)
$a_check[3] = GUICtrlCreateCheckbox("Hidden", 15, 95, 170, 20)
$a_check[4] = GUICtrlCreateCheckbox("Read-Only", 15, 115, 170, 20)
$a_check[5] = GUICtrlCreateCheckbox("Read-Write", 15, 135, 95, 20)
$a_check[6] = GUICtrlCreateCheckbox("System", 15, 155, 170, 20)
$a_check[7] = GUICtrlCreateCheckbox("Exclusive", 15, 175, 170, 20)
$a_check[8] = GUICtrlCreateCheckbox("Drives", 15, 195, 170, 20)
$a_check[9] = GUICtrlCreateCheckbox("No Brackets (Drives Only)", 15, 215, 170, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

$listbox = GUICtrlCreateList("", 240, 40, 120, 120)
$button = GUICtrlCreateButton("Get Names", 240, 160, 120, 40)
$btn_exit = GUICtrlCreateButton("Exit", 240, 205, 120, 40)

GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
         ExitLoop
      Case $msg = $button
         $s_attr = ""
         For $i = 1 To $a_check[0]
            If (BitAND(GUICtrlRead($a_check[$i]), $GUI_CHECKED)) Then
               If (StringLen($s_attr) > 0) Then
                  $s_attr &= "," & $a_attr[$i]
               Else
                  $s_attr = $a_attr[$i]
               EndIf
            EndIf
         Next
         _GUICtrlListClear ($listbox)
         $ret = _GUICtrlListAddDir ($listbox, $s_attr, GUICtrlRead($input))
         If ($ret < 0) Then
            If ($ret == $LB_ERRATTRIBUTE) Then
               MsgBox(16, "Error", "Invalid Attribute sent to _GUICtrlListAddDir")
            ElseIf ($ret == $LB_ERRSPACE) Then
               MsgBox(16, "Error", "insufficient space to store the new strings from calling _GUICtrlListAddDir")
            ElseIf ($ret == $LB_ERRREQUIRED) Then
               MsgBox(16, "Error", "Argument required for file search in call to _GUICtrlListAddDir")
            ElseIf ($ret == $LB_ERR) Then
               MsgBox(16, "Error", "Unknown error from _GUICtrlListAddDir" & @CRLF & "Possibly no files/folders found")
            EndIf
         EndIf
   EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

second try, and headache. :)

#include <GUIConstants.au3>
;#include <Array.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 462, 285, 192, 125)
$List1 = GUICtrlCreateList("", 16, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$search1 = FileFindFirstFile("C:\program files")  
$List2 = GUICtrlCreateList("", 240, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$search2 = FileFindFirstFile("%homedrive%%homepath%\my documents")  
$List3 = GUICtrlCreateList("", 16, 192, 425, 71, -1, $WS_EX_CLIENTEDGE)
$search3 = FileFindFirstFile("%homedrive%%homepath%\desktop")  
GUICtrlCreateLabel("Programs files or whatever", 24, 8, 128, 17)
GUICtrlCreateLabel("My documents or whatever", 240, 8, 132, 17)
GUICtrlCreateLabel("Desktop or whatever", 24, 176, 103, 17)
GUISetState(@SW_SHOW)


_ArrayDisplay ( $search, $search2, $search3 )
$Arraydisplay Return 1

GuiSetState ()

While 1

    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    endselect


    
    sleep(200)
WEnd
Link to comment
Share on other sites

second try, and headache. :)

#include <GUIConstants.au3>
;#include <Array.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 462, 285, 192, 125)
$List1 = GUICtrlCreateList("", 16, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$search1 = FileFindFirstFile("C:\program files")  
$List2 = GUICtrlCreateList("", 240, 32, 201, 136, -1, $WS_EX_CLIENTEDGE)
$search2 = FileFindFirstFile("%homedrive%%homepath%\my documents")  
$List3 = GUICtrlCreateList("", 16, 192, 425, 71, -1, $WS_EX_CLIENTEDGE)
$search3 = FileFindFirstFile("%homedrive%%homepath%\desktop")  
GUICtrlCreateLabel("Programs files or whatever", 24, 8, 128, 17)
GUICtrlCreateLabel("My documents or whatever", 240, 8, 132, 17)
GUICtrlCreateLabel("Desktop or whatever", 24, 176, 103, 17)
GUISetState(@SW_SHOW)
_ArrayDisplay ( $search, $search2, $search3 )
$Arraydisplay Return 1

GuiSetState ()

While 1

    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    endselect
    
    sleep(200)
WEnd

that would give me a headache also

.... you have a selection of scripts above to choose from

8)

NEWHeader1.png

Link to comment
Share on other sites

modify to fit your needs

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars', 1)

Dim $a_check[10], $msg, $ret, $s_attr, $s_folder
Dim $input, $group, $a_attr, $listbox, $button, $btn_exit, $btn_folder

GUICreate("ListBox Add Item Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Enter files to find", 25, 15)
$input = GUICtrlCreateInput("*.txt", 125, 10, 180, 25)
$btn_folder = GUICtrlCreateButton("...", 320, 10, 50, 25)
$group = GUICtrlCreateGroup("Atrributes", 10, 40, -1, 200)
$a_attr = StringSplit("A,D,H,RO,RW,S,E,Drives,NB", ",")
$a_check[0] = 9
$a_check[1] = GUICtrlCreateCheckbox("Archive", 15, 55, 170, 20)
GUICtrlSetState($a_check[1], $GUI_CHECKED)
$a_check[2] = GUICtrlCreateCheckbox("Directory", 15, 75, 170, 20)
$a_check[3] = GUICtrlCreateCheckbox("Hidden", 15, 95, 170, 20)
$a_check[4] = GUICtrlCreateCheckbox("Read-Only", 15, 115, 170, 20)
GUICtrlSetState($a_check[4], $GUI_CHECKED)
$a_check[5] = GUICtrlCreateCheckbox("Read-Write", 15, 135, 95, 20)
GUICtrlSetState($a_check[5], $GUI_CHECKED)
$a_check[6] = GUICtrlCreateCheckbox("System", 15, 155, 170, 20)
$a_check[7] = GUICtrlCreateCheckbox("Exclusive", 15, 175, 170, 20)
$a_check[8] = GUICtrlCreateCheckbox("Drives", 15, 195, 170, 20)
$a_check[9] = GUICtrlCreateCheckbox("No Brackets (Drives Only)", 15, 215, 170, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

$listbox = GUICtrlCreateList("", 240, 40, 120, 120)
$button = GUICtrlCreateButton("Get Names", 240, 160, 120, 40)
$btn_exit = GUICtrlCreateButton("Exit", 240, 205, 120, 40)

GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
         ExitLoop
  Case $msg = $btn_folder
   $s_folder = FileSelectFolder("Select Folder","",6,@ScriptDir)
      Case $msg = $button
         $s_attr = ""
         For $i = 1 To $a_check[0]
            If (BitAND(GUICtrlRead($a_check[$i]), $GUI_CHECKED)) Then
               If (StringLen($s_attr) > 0) Then
                  $s_attr &= "," & $a_attr[$i]
               Else
                  $s_attr = $a_attr[$i]
               EndIf
            EndIf
         Next
         _GUICtrlListClear ($listbox)
         $ret = _GUICtrlListAddDir ($listbox, $s_attr, $s_folder & "\" & GUICtrlRead($input))
         If ($ret < 0) Then
            If ($ret == $LB_ERRATTRIBUTE) Then
               MsgBox(16, "Error", "Invalid Attribute sent to _GUICtrlListAddDir")
            ElseIf ($ret == $LB_ERRSPACE) Then
               MsgBox(16, "Error", "insufficient space to store the new strings from calling _GUICtrlListAddDir")
            ElseIf ($ret == $LB_ERRREQUIRED) Then
               MsgBox(16, "Error", "Argument required for file search in call to _GUICtrlListAddDir")
            ElseIf ($ret == $LB_ERR) Then
               MsgBox(16, "Error", "Unknown error from _GUICtrlListAddDir" & @CRLF & "Possibly no files/folders found")
            EndIf
         EndIf
   EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

but how can i get this behavior, lists all files/and folders in a directory from within the autoit gui, double clicking the files listed will launch that file.. you know how windows behaves.. I got alittle ahead of myself with this, you know because the files are alot to list, and i update them quite frequently it's alittle to much hassle.. i'd prefer displaying all files in a folder, then doing it manually..

my coding is limited so, go easy on me.. and the above codes provided were nice.. but not exactly right, since they just display.. i want to open files.. and display all of them that is in a folder

#include<GUIconstants.au3>
;===BETA
Global Const $WM_COMMAND    = 0x0111
Global Const $LBN_SELCHANGE = 1
Global Const $LBN_DBLCLK    = 2
Dim $GCCList[4]
;////SNIPPED////
$Form2 = GUICreate("PROGRAMS", 390, 300, 302, 218, -1, $WS_EX_TOPMOST)
GUISetIcon("D:\005.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 375, 280)
;////SNIPPED////
;////SNIPPED////
$TabSheet6 = GUICtrlCreateTabItem("PROGRAMS")
;beta
$GCCList[1] = GUICtrlCreateList("", 20, 70, 160, 120)
GUICtrlSetData(-1, "_|Notepad|Regedit|Control|MSpaint|g.Sample|f.List|h.Control|j.Here|h.here|", "a.menu")
$GCCList[2] = GUICtrlCreateList("", 180, 70, 190, 120)
GUICtrlSetData(-1, "_|Notepad|Regedit|Control|MSpaint|g.Sample|f.List|h.Control|j.Here|h.here|", "a.menu")
$GCCList[3] = GUICtrlCreateList("", 20, 180, 160, 115)
GUICtrlSetData(-1, "_|Notepad|Regedit|Control|MSpaint|g.Sample|f.List|h.Control|j.Here|h.here|", "a.menu")
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;=============================BETA>
    EndSelect
    For $i = 1 To 3
;ToolTip(ControlGetFocus($Form2)) << Use this to find out what the Control Ref ID is if you add more list boxes or controls
        If _IsPressed ('0D') And ControlGetFocus($Form2) = 'ListBox' & $i Then; Every list box is not ListBox"1"
            If StringInStr(GUICtrlRead($GCCList[$i]), 'notepad') Then Run('Notepad.exe'); you have things capitalized up top, and they were lowercased here
            If StringInStr(GUICtrlRead($GCCList[$i]), 'mspaint') Then Run('mspaint.exe'); so I replaced "=" with a StringInStrin() not case sensitive command
            If StringInStr(GUICtrlRead($GCCList[$i]), 'regedit') Then Run('regedit.exe')
            Sleep(100); Delay not to run multiple copies
;ECT
;========================
        EndIf
    Next
WEnd

;===================>
Func MY_WM_COMMAND ($hWnd, $msg, $wParam, $lParam)
    $nNotifyCode    = BitShift($wParam, 16)
    $nID            = BitAND($wParam, 0x0000FFFF)
    $hCtrl        = $lParam
;==================>
    For $x = 1 To 3; Replace 3 with however many list boxes you have
        If $nID = $GCCList[$x] Then
            Switch $nNotifyCode
                Case $LBN_DBLCLK
                    If GUICtrlRead($GCCList[$x]) = 'notepad' Then Run('Notepad.exe')
                    If GUICtrlRead($GCCList[$x]) = 'mspaint' Then Run('mspaint.exe')
                    If GUICtrlRead($GCCList[$x]) = 'regedit' Then Run('regedit.exe')
  ;ECT
                    Return 0
            EndSwitch
        EndIf
    Next
EndFunc;==>MY_WM_COMMAND

Func _IsPressed ($s_hexKey, $v_dll = 'user32.dll')
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc;==>_IsPressed
;=====================END BETA>
Edited by slightly_abnormal
Link to comment
Share on other sites

but how can i get this behavior, lists all files/and folders in a directory from within the autoit gui, double clicking the files listed will launch that file.. you know how windows behaves.. I got alittle ahead of myself with this, you know because the files are alot to list, and i update them quite frequently it's alittle to much hassle.. i'd prefer displaying all files in a folder, then doing it manually..

my coding is limited so, go easy on me.. and the above codes provided were nice.. but not exactly right, since they just display.. i want to open files.. and display all of them that is in a folder

#include<GUIconstants.au3>
;===BETA
Global Const $WM_COMMAND    = 0x0111
Global Const $LBN_SELCHANGE = 1
Global Const $LBN_DBLCLK    = 2
Dim $GCCList[4]
;////SNIPPED////
$Form2 = GUICreate("PROGRAMS", 390, 300, 302, 218, -1, $WS_EX_TOPMOST)
GUISetIcon("D:\005.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 375, 280)
;////SNIPPED////
;////SNIPPED////
$TabSheet6 = GUICtrlCreateTabItem("PROGRAMS")
;beta
$GCCList[1] = GUICtrlCreateList("", 20, 70, 160, 120)
GUICtrlSetData(-1, "_|Notepad|Regedit|Control|MSpaint|g.Sample|f.List|h.Control|j.Here|h.here|", "a.menu")
$GCCList[2] = GUICtrlCreateList("", 180, 70, 190, 120)
GUICtrlSetData(-1, "_|Notepad|Regedit|Control|MSpaint|g.Sample|f.List|h.Control|j.Here|h.here|", "a.menu")
$GCCList[3] = GUICtrlCreateList("", 20, 180, 160, 115)
GUICtrlSetData(-1, "_|Notepad|Regedit|Control|MSpaint|g.Sample|f.List|h.Control|j.Here|h.here|", "a.menu")
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;////SNIPPED////
;=============================BETA>
    EndSelect
    For $i = 1 To 3
;ToolTip(ControlGetFocus($Form2)) << Use this to find out what the Control Ref ID is if you add more list boxes or controls
        If _IsPressed ('0D') And ControlGetFocus($Form2) = 'ListBox' & $i Then; Every list box is not ListBox"1"
            If StringInStr(GUICtrlRead($GCCList[$i]), 'notepad') Then Run('Notepad.exe'); you have things capitalized up top, and they were lowercased here
            If StringInStr(GUICtrlRead($GCCList[$i]), 'mspaint') Then Run('mspaint.exe'); so I replaced "=" with a StringInStrin() not case sensitive command
            If StringInStr(GUICtrlRead($GCCList[$i]), 'regedit') Then Run('regedit.exe')
            Sleep(100); Delay not to run multiple copies
;ECT
;========================
        EndIf
    Next
WEnd

;===================>
Func MY_WM_COMMAND ($hWnd, $msg, $wParam, $lParam)
    $nNotifyCode    = BitShift($wParam, 16)
    $nID            = BitAND($wParam, 0x0000FFFF)
    $hCtrl        = $lParam
;==================>
    For $x = 1 To 3; Replace 3 with however many list boxes you have
        If $nID = $GCCList[$x] Then
            Switch $nNotifyCode
                Case $LBN_DBLCLK
                    If GUICtrlRead($GCCList[$x]) = 'notepad' Then Run('Notepad.exe')
                    If GUICtrlRead($GCCList[$x]) = 'mspaint' Then Run('mspaint.exe')
                    If GUICtrlRead($GCCList[$x]) = 'regedit' Then Run('regedit.exe')
 ;ECT
                    Return 0
            EndSwitch
        EndIf
    Next
EndFunc;==>MY_WM_COMMAND

Func _IsPressed ($s_hexKey, $v_dll = 'user32.dll')
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc;==>_IsPressed
;=====================END BETA>
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...