aseitz Posted July 19, 2010 Share Posted July 19, 2010 (edited) Hey Guys, I rock AutoIT when it comes to Console UI but I suck at the Windows stuff. I am trying to make a Window that opens up and displays the contents of a folder. The folder will contain folders and files and I need the Window to display these items. Using Windows Explorer is not an option because I am attempting to make the window secure and do not want all the fluff of the Windows Explorer. This is probably stupid simple but I am thoroughly stumped. The Window also should not have any controls on it other than Min/Max/Close. Double-Clicking the items should either move to the next folder or launch the file that was clicked. Thanks! Edited July 19, 2010 by aseitz Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 20, 2010 Share Posted July 20, 2010 So you want _FileListToArray() to get you a list of contents, maybe do it twice to get separate lists of folders and files. The control in your window would be either GuiCtrlCreateList() for a simple, 1-column list, or GuiCtrlCreateListView() for a multi-column list. That, plus the examples in the help file should get you started. When you get stuck, post what you have for more help. 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 Link to comment Share on other sites More sharing options...
aseitz Posted July 20, 2010 Author Share Posted July 20, 2010 So you want _FileListToArray() to get you a list of contents, maybe do it twice to get separate lists of folders and files. The control in your window would be either GuiCtrlCreateList() for a simple, 1-column list, or GuiCtrlCreateListView() for a multi-column list.That, plus the examples in the help file should get you started. When you get stuck, post what you have for more help.Hey thanks for the reply. The part I am stuck on is preventing me from posting code... I am unable to find a sample of a window that is used to browse files "explorer" style. If I could use a tree-view or file-open type of thing, I would not be stuck. I just can't find a sample of an "windows explorer style" (not internet explorer) file browser for files.If you have any suggestions, I would love to hear them.I am / have been browsing the forums through the sample GUI and using the search with no real results. The sample windows that come with the AutoIT editor are not the correct style either. In fact it seems everything is covered in the samples - except what I am trying to find. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 20, 2010 Moderators Share Posted July 20, 2010 aseitz, a sample of a window that is used to browse files "explorer" styleHave you looked at FileOpenDialog? If you want to make a custom version, you could look at KaFu's Tri-State TreeView here. M23  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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
aseitz Posted July 20, 2010 Author Share Posted July 20, 2010 Hey thanks for the reply. The part I am stuck on is preventing me from posting code... I am unable to find a sample of a window that is used to browse files "explorer" style. If I could use a tree-view or file-open type of thing, I would not be stuck. I just can't find a sample of an "windows explorer style" (not internet explorer) file browser for files.If you have any suggestions, I would love to hear them.I am / have been browsing the forums through the sample GUI and using the search with no real results. The sample windows that come with the AutoIT editor are not the correct style either. In fact it seems everything is covered in the samples - except what I am trying to find.Attached is a very crude mock-up of what i am looking for.Am I just going to have to present a blank window ... align a white background and parse and place icons manually? Seems a lot of work for some windows hook that must be there already. Link to comment Share on other sites More sharing options...
aseitz Posted July 20, 2010 Author Share Posted July 20, 2010 (edited) Ok this seems to me to be the hardest way to do it - but here is what I have. If your executing the code directly, create a @WindowsDir\System32\Icons Folder and toss one link in there. The code is only worrying about one link at the moment because that part of the logic is going to be easier for me to deal with than the initial creation of a functional icon. I can't seem to figure out how to make a real icon ... just a fake one. expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Local $ICON_ROOT = @WindowsDir & "\System32\Icons" Local $ICON_PAD = 10 ; Padding Between Icons Local $ICON_X = 20 ; Start Point For Icons X Position Local $ICON_Y = 10 ; Start Point For Icons Y Position Local $LABEL_X = 10 ; Start Point For Label X Position Local $LABEL_Y = 45 ; Start Point For Label Y Position ; Set our search to search for any file name. $Search = FileFindFirstFile($ICON_ROOT & "\*.lnk") ; Start a loop to loop through the Icons Folder. While 1 If $Search = -1 Then ExitLoop EndIf ; Fill in our File variable and move on $File = FileFindNextFile($Search) ; This really will never happen If @error Then ExitLoop ; Set some variables to be used for file manipulation $FullFilePath = $ICON_ROOT & "\" & $File $FileAttributes = FileGetAttrib($FullFilePath) ; Skip if we are looking at a Directory If Not StringInStr($FileAttributes,"D") Then ; Let's Pull properties of it $Link=FileGetShortcut($FullFilePath) $LinkName = StringTrimRight( $File, 4) EndIf WEnd ; GUI GuiCreate("Application Launcher", 640, 480) $icon = GUICtrlCreateIcon($Link[0], $Link[5], $ICON_X, $ICON_Y) GuiCtrlCreateLabel($LinkName, $LABEL_X, $LABEL_Y, 100, 20) ; GUI MESSAGE LOOP GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEndAppLauncher.au3 Edited July 20, 2010 by aseitz Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 21, 2010 Share Posted July 21, 2010 (edited) A bunch of Labels...? What if you started from something more like this, instead: #include <GuiConstantsEx.au3> Global $ICON_ROOT = "C:\Program Files\AutoIt3\Include" Global $hGUI = GUICreate("Application Launcher", 640, 480) Global $idLV = GUICtrlCreateListView("Name |Attrib ", 10, 10, 620, 460) ; Set our search to search for any file name. $Search = FileFindFirstFile($ICON_ROOT & "\*.au3") If $Search = -1 Then MsgBox(16, "Error", "No .au3 files found.") Exit EndIf ; Start a loop to loop through the Icons Folder. While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop $FullFilePath = $ICON_ROOT & "\" & $File $FileAttributes = FileGetAttrib($FullFilePath) If Not StringInStr($FileAttributes, "D") Then ; Let's Pull properties of it $Link = FileGetShortcut($FullFilePath) $LinkName = StringTrimRight($File, 4) GUICtrlCreateListViewItem($LinkName & "|" & $FileAttributes, $idLV) EndIf WEnd ; GUI MESSAGE LOOP GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd P.S. If you learn to use the GuiListView.au3 UDF, you can icons, checkboxes, and all kinds of geeky coolness to your ListView. Edited July 21, 2010 by PsaltyDS 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 Link to comment Share on other sites More sharing options...
aseitz Posted July 21, 2010 Author Share Posted July 21, 2010 (edited) A bunch of Labels...? What if you started from something more like this, instead: #include <GuiConstantsEx.au3> Global $ICON_ROOT = "C:\Program Files\AutoIt3\Include" Global $hGUI = GUICreate("Application Launcher", 640, 480) Global $idLV = GUICtrlCreateListView("Name |Attrib ", 10, 10, 620, 460) ; Set our search to search for any file name. $Search = FileFindFirstFile($ICON_ROOT & "\*.au3") If $Search = -1 Then MsgBox(16, "Error", "No .au3 files found.") Exit EndIf ; Start a loop to loop through the Icons Folder. While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop $FullFilePath = $ICON_ROOT & "\" & $File $FileAttributes = FileGetAttrib($FullFilePath) If Not StringInStr($FileAttributes, "D") Then ; Let's Pull properties of it $Link = FileGetShortcut($FullFilePath) $LinkName = StringTrimRight($File, 4) GUICtrlCreateListViewItem($LinkName & "|" & $FileAttributes, $idLV) EndIf WEnd ; GUI MESSAGE LOOP GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd P.S. If you learn to use the GuiListView.au3 UDF, you can icons, checkboxes, and all kinds of geeky coolness to your ListView. Thanks for the help - I must be explaining this wrong. What I am trying to do is create a Window that shows a bunch of icons that can be used to launch programs. The icons are actual .lnk files. I can't seem to figure out how AutoIT creates Windows Icons. Any ideas? Edited July 21, 2010 by aseitz Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now