Jump to content

File Explorer


Recommended Posts

is there a way to make a file explorer like the windows one using autoit?

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

I think so... It would be quite a bit of work though... I don't see any reason why it wouldn't be possible.

do you know how i would go about doing it?

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

do you know how i would go about doing it?

Hmm... step 1, make the GUI. That's what I would do... If you plan on imitating the file explorer exactly I would mess around until I had the GUI like they have theirs. Then I would start making the buttons actually do stuff... Most of the stuff you could find in the helpfile (or in the forums).

Incidentally, why do you want to make this?

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Hmm... step 1, make the GUI. That's what I would do... If you plan on imitating the file explorer exactly I would mess around until I had the GUI like they have theirs. Then I would start making the buttons actually do stuff... Most of the stuff you could find in the helpfile (or in the forums).

Incidentally, why do you want to make this?

im making a sort of a shell just to learn more functions and the power of autoit and for fun.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

i guess i should be more specific what im not sure how to do is the file list like explorer you go into a folder and there is the files and folders i have no clue how to even start doing that ive looked around in the help file and i just cant seem to figure out how...

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

im making a sort of a shell just to learn more functions and the power of autoit and for fun.

I thought that might be it... I made a start menu just to see if I could, and I learned a lot!

i guess i should be more specific what im not sure how to do is the file list like explorer you go into a folder and there is the files and folders i have no clue how to even start doing that ive looked around in the help file and i just cant seem to figure out how...

I would begin with _FileListToArray() That will list all the contents in a directory.

As to other things, search the helpfile for a little bit and then forums, and then just ask a question here. Someone is usually nice enough to point you in the right direction...

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

nevermind i figured that out...

Edited by EagleClaw

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

this isnt making sense right now why is this code giving an error

$files=_FileListToArray($folder)
    for $i=0 to $i=_arraymax($files)
        ;msgbox("","",$files[$i])
        GUICtrlCreateListViewItem($files[$i],$listview1)
    Next
Try:

$files=_FileListToArray($folder)
    for $i=1 to $files[0] - 1
      ;msgbox("","",$files[$i])
        GUICtrlCreateListViewItem($files[$i],$listview1)
    Next

The _FileListToArray, like many other functions (but not all), returns an array where the value of the 0 index is the number of items in the array (aside from itself).

So I changed your code so that it starts with the first actual value, 1, and goes to the end.

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Hi,

Look at Holger's AutoIt Explorer (link from my signature), and my SearchMiner for inspiration...?

Best, randall

that helps alot but can you explain how the filegeticon function works or maybe an easier way of doing it...

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

Hi,

I don't know either "how" or "easier"! [ask Holger?....]

But can show the method (only shown for 3.2.4.9, not beta here as it has changed.. someone ?...)

; filelistt.au3
#include <GUIConstants.au3>
#include <Array.au3>
#include <File.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AForm1", 633, 454, 193, 115)
$ListView1 = GUICtrlCreateListView("Filename                   |Size|Filetype            ", 20, 22, 540, 373)
;~ GUICtrlSetImage($ListView1, "shell32.dll", 3)
$ListView1_0 = GUICtrlCreateListViewItem("test item", $ListView1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
loadfiles("C:\")
GUICtrlSetImage($ListView1_0, "shell32.dll", 3)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ListView1
    EndSwitch
WEnd
Func loadfiles($folder)
    $files = _FileListToArray($folder, "*.*", 1)
    local $szIconFile1,  $nIcon1=0,$ListViewItem[UBound($files)]
    For $i = 1 To UBound($files) - 1
        $ListViewItem[$i]=GUICtrlCreateListViewItem($files[$i] & "|" & Int(FileGetSize($files[$i]) / 1024) & "|" & StringRight($files[$i], 3), $ListView1)
        _FileGetIcon( $szIconFile1,  $nIcon1, $folder&$files[$i])
;~      If @AutoItVersion > "3.2.5.1" and $nIcon1>0  Then $nIcon1 = -$nIcon1 -1
        GUICtrlSetImage(-1, $szIconFile1, $nIcon1)
    Next
EndFunc   ;==>loadfiles

Func _FileGetIcon(ByRef $szIconFile, ByRef $nIcon, $szFile)
    If StringInStr(FileGetAttrib($szIconFile), "D") Then
        $nIcon = 3
    Else
        Dim $szRegDefault = "", $szDefIcon = "", $szExt, $arSplit
        $szExt = StringRight($szFile, 4)
        $szRegDefault = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & $szExt, "ProgID")
        If $szRegDefault = "" Then $szRegDefault = RegRead("HKCR\" & $szExt, "")
        If $szRegDefault <> "" Then $szDefIcon = RegRead("HKCR\" & $szRegDefault & "\DefaultIcon", "")
        If $szDefIcon = "" Then
            $szIconFile = "shell32.dll"
        ElseIf $szDefIcon <> "%1" Then
            $arSplit = StringSplit($szDefIcon, ",")
            If IsArray($arSplit) Then
                $szIconFile = $arSplit[1]
                If $arSplit[0] > 1 Then $nIcon = $arSplit[2]
            Else
                Return 0
            EndIf
        EndIf
    EndIf
    Return 1
EndFunc   ;==>_FileGetIcon
Best, Randall
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...