Jump to content

Ned help editing code to list a specific folder.

Recommended Posts


I have the following code which I found on internet:


#include <GuiConstantsEx.au3>
#include <File.au3>
#include <Array.au3>

GUICreate("Automation", 300, 500)
$sourceFolder = GUICtrlCreateInput("Source Folder", 10, 10, 280, 20)
$add = GUICtrlCreateButton("Add", 10, 35, 75, 20)
$mylist = GUICtrlCreateList("", 10, 60, 280, 300)


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $add
            $sFolder = ControlGetText("Automation", "", "Edit1")
            Local $FileList = _FileListToArray($sFolder, "*.*")

            If @error = 1 Then
                MsgBox(0, "", "No Folders Found.")
            If @error = 4 Then
                MsgBox(0, "", "No Files Found.")

            For $i = 1 To $FileList[0]
                GUICtrlSetData($mylist, $FileList[$i])
        Case $GUI_EVENT_CLOSE

1. How do I edit this so it automatically lists the Documents folder contents on the given computer?

2. If the Documents folder contains .ahk scripts, what do I need to add, if the window, let's say, displays a filename of "Testscript.ahk" to be able to double click on the .ahk file and actually load it?


Thank you!

Share this post

Link to post
Share on other sites


If you want to open .ahk files, why not code the script itself in AHK? Why use AutoIt at all?


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


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

Well I have a seperate GUI that I created with AHK that automatically sends code to notepad based on some text boxes and button clicking. This allows a user that has no coding ability to make their own script. I'm hoping the other AHK script will  save the script inside of the user's Documents folder.  I want users to have a GUI to easily select their already created scripts for people who have no computer ability ( I work at a hospital Help Desk....yes, we have people with minimal ability that work there lol). Basically the GUI would be for ease of access. 

Share this post

Link to post
Share on other sites

You're not answering the question though, why are you making things more complicated by mixing languages, when they will both - by themselves - accomplish everything you're after?

√-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