Jump to content

Last Files Browser


arcker
 Share

Recommended Posts

Hi evry1 !

Here is my last little script.

It was so boring to open the explorer and order by last file some directories....so i decided to do this

I would like to add an option to show the icons of the files, but i really don't know how to do it

this uses the _GUICtrlListView.au3 of randallc

_GUICtrlListView by randallc

edit : new version, with sliding toolbar of simucal & valuater

it stays the config menu to don't know how to do it

;lasftfile_tabs.au3 0_2
#include <GUIConstants.au3>
#Include <GuiTab.au3>
#include <Constants.au3>
#include <Date.au3>
#include <_GUICtrlListView.au3>
#region--lastfiles
Global $hide_state = 0, $btn_state = 0, $pass = 0
Global $Button_[15], $Label_[15], $config_[8],$listview_[10],$dossier[10],$t_tab[10]
$hwnd= GUICreate("Sliding Launcher", 603, 85+85, -588, -1, -1,  BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES))
$config_[1] = GUICtrlCreateLabel("Label Name", 15, 32, 60, 20)
$config_[2] = GUICtrlCreateInput("", 75, 30, 80, 20)
$config_[3] = GUICtrlCreateLabel("Program to Launch", 175, 32, 100, 20)
$config_[4] = GUICtrlCreateInput("", 270, 30, 255, 20)
GUICtrlSetState( -1, $GUI_DROPACCEPTED )
$config_[5] = GUICtrlCreateButton("Cancel", 530, 5, 50, 20)
$config_[6] = GUICtrlCreateButton("Browse", 530, 30, 50, 20)
$config_[7] = GUICtrlCreateButton("Accept", 530, 55, 50, 20)
For $x = 1 To 7
    GUICtrlSetState($config_[$x], $GUI_HIDE)
Next
;~ ;$author = GUICtrlCreateLabel(" By...   Simucal  &&  Valuater", 120, 25, 400, 40)
;~ ;GUICtrlSetFont(-1, 20, 700)
$Show = GUICtrlCreateButton(">", 585, 8, 17, 155, BitOR($BS_CENTER, $BS_FLAT))
GUISetState(@SW_HIDE, $hwnd)
$hwnd2 = GUICreate("Sliding Launcher", 603, 160+160, 3, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$Hide = GUICtrlCreateButton("<", 585, 8, 17, 155, BitOR($BS_CENTER, $BS_FLAT, $BS_MULTILINE))
$Edit = GUICtrlCreateButton("[]", 0, 8, 15, 155, BitOR($BS_CENTER, $BS_FLAT, $BS_MULTILINE))
GUICtrlSetTip(-1, "Config")
;DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 100, "long", 0x00040001);slide in from left
GUISetState()
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)
 $config_tray = TrayCreateItem("Configure...")
 TrayItemSetOnEvent(-1, "Set_config")
TrayCreateItem("")
$exit_tray = TrayCreateItem("Exit  Sliding Launcher")
TrayItemSetOnEvent(-1, "Set_Exit")
TraySetState()
$nombretabs= 2
$nombretabs=IniRead("lastfilesettings.ini","tab","number","error")
;If $nombretabs= "error" Then
;   MsgBox(0,"Error","Impossible to find the number of tabs")
;   Exit
;EndIf

;$dossier="H:\"
$nombrecolonne=2
;$gui=GUICreate("Last Files Browser",500,420,300,150)
;$gui=GUICreate("Last Files Browser")
$exec = GUICtrlCreateButton ( "Refresh", 5, 280,100 )
$jourenmoins = GUICtrlCreateButton ( "Day -1", 110, 280,80 )
$jourenplus = GUICtrlCreateButton ( "Day +1", 200, 280,80 )
$ouvrir = GUICtrlCreateButton ( "Open", 290, 280,100 )
$delete= GUICtrlCreateButton ( "Delete", 420, 280,100 )
global $MouseDown = 0, $jour=0,$mois=@MON,$i_PrevLine=0
global $sNewDate = _NowCalcDate(),  $s_AnswerFile=@ScriptDir&"\AnswerFindLines.txt",$s_AnswerFileSorted=@ScriptDir&"\AnsSorted.txt"
global $s_AnswerFile2=@ScriptDir&"\AnswerFindLines2.txt",$i_MinJour=0, $ar_ArrayLists[1],$i_Found=0,$ar_DatesArray[1];,$ar_Files[1]
global $s_FindFiles=@ScriptDir&"\FindFiles.txt"
$s_FindFiles=FileGetShortName($s_FindFiles)
$s_AnswerFile=FileGetShortName($s_AnswerFile)
$s_AnswerFile2=FileGetShortName($s_AnswerFile2)
$s_AnswerFileSorted=FileGetShortName($s_AnswerFileSorted)
$tab=GUICtrlCreateTab(20,2,560,260)
$timertotal=TimerInit()
For $i=0 To $nombretabs-1
    ;$dossier[0]=@ScriptDir&"\"
    ;$dossier[1]=@ScriptDir&"\backup\"
    $dossier[$i]=IniRead("lastfilesettings.ini","tab","folder"& $i,"error")
    If $dossier[$i]="error" Then MsgBox (0,"error","error tab " & $i)
    $t_tab[$i]=GUICtrlCreateTabItem($dossier[$i])
    $listview_[$i]=_GUICtrlCreateListView("Files written on "& _DateTimeFormat($sNewDate,1) & "            | Heure |Size...Mb|Ext",20,22,560,240,$LVS_REPORT)
    $timerstamp1 = TimerInit()
    _FileList($dossier[$i])
    $ar_Files=__FileListToArray($dossier[$i])
    _FileSetIconDefault($listview_[$i])
    ConsoleWrite("_FirstList :"&round(TimerDiff($timerstamp1)) & " mseconds to search. for "& $dossier[$i]&@lf)
    _refresh($dossier[$i],$listview_[$i])
    ;$listview_[$i_tab]=_GUICtrlCreateListView("Files created the " & _DateTimeFormat($sNewDate,1) & " | Heure ",10,30,575,315,$LVS_REPORT)
    _GUICtrlListViewSetColumnWidth($listview_[$i],0,300)
    _GUICtrlListViewJustifyColumn($listview_[$i], 2,1)
    ;_GUICtrlListViewHideColumn($listview_[$i_tab],3)
    _GUICtrlTabSetCurFocus($tab,$i)
Next
GUISetState (@SW_SHOW,$t_tab[$i])
ConsoleWrite("_FirstList :"&round(TimerDiff($timertotal)) & " mseconds to search. for total"&@lf)
TimerStop($timerstamp1)
TimerStop($timertotal)
Local $B_DESCENDING
$timerstamp1 = TimerInit()
$i_LISTVIEWPrevcolumn=1
GUISetState ()
$ar_Files=__FileListToArray($dossier[$i])
_refresh($dossier[0],$listview_[0])
_GUICtrlTabSetCurFocus($tab, 0)
;GUISetState ()
global $i_PrevTab=0
#endregion
While 1
    $msg1 = GUIGetMsg()
    If $msg1 = $GUI_EVENT_CLOSE Then Exit
    If $msg1 = $Hide Then
        If $pass = 1 Then
            WinSetTitle($hwnd2, "", "Sliding Launcher")
            $pass = 0
        Else
            Slide_out()
        EndIf
    EndIf
    If $msg1 = $Show Then Slide_in()
        ;_GUICtrlTabSetCurFocus($tab, $i_PrevTab)
        ;_refresh($dossier[$i_PrevTab],$listview_[$i_PrevTab])
    ;EndIf
        
    If $msg1 = $Edit Then $pass = 1
    $a_pos = WinGetPos($hwnd2)
    $a_pos2 = WinGetPos($hwnd)
    If $a_pos[0] <> 0 And $hide_state = 0 Then
        WinMove($hwnd2, "", 3, $a_pos[1])
        WinMove($hwnd, "", -588, $a_pos[1])
    EndIf
    If $a_pos2[0] <> - 588 And $hide_state = 1 Then
        WinMove($hwnd, "", -588, $a_pos2[1])
        WinMove($hwnd2, "", 3, $a_pos2[1])
    EndIf
    If $pass = 1 Then WinSetTitle($hwnd2, "", "Config Mode - Please Press the Button to Configure...  Press  ""<""  to Cancel")
    $i_tab= GUICtrlread ($tab)
    if $i_tab<> $i_PrevTab Then
        $i_PrevTab=$i_tab
        $MSG1 = $exec
    EndIf
    
    select ;code du programme
        Case $msg1 = $listview_[$i_tab]
            if GUICtrlGetState($listview_[$i_tab])=1 and $i_LISTVIEWPrevcolumn<>1 Then
                _refresh($dossier[$i_tab],$listview_[$i_tab])
                $i_LISTVIEWPrevcolumn=1; so if we click again, we reverse on the sort
            EndIf
                __GUICtrlListViewSort( $listview_[$i_tab],$B_DESCENDING,GUICtrlGetState($listview_[$i_tab])); normal sort/ reverese for other columns
        case $msg1 = $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE)
            exit
        Case $MSG1 = $exec
            $sNewDate = _DateAdd( 'd',$jour, _NowCalcDate())
            GUICtrlSetData($listview_[$i_tab],"Files written on " & _DateTimeFormat($sNewDate,1))
            $ar_Files=__FileListToArray($dossier[$i_tab])
            _refresh($dossier[$i_tab],$listview_[$i_tab])
        Case $msg1 = $ouvrir
            $index=_GUICtrlListViewGetCurSel($listview_[$i_tab])
            $run=_GUICtrlListViewGetItemText($listview_[$i_tab],$index,0)
            _Rundos("start " & $dossier[$i_tab] & '"' & $run & '"')
            Slide_out()
        Case $msg1= $delete
            $index=_GUICtrlListViewGetCurSel($listview_[$i_tab])
            $run=_GUICtrlListViewGetItemText($listview_[$i_tab],$index,0)
            $rep=MsgBox(4,"Delete","Remove : " & @CR & $run)
            If $rep=6 Then FileDelete($dossier[$i_tab] & $run )
        Case $msg1 = $jourenmoins
            $jour -= 1
            $sNewDate = _DateAdd( 'd',$jour, _NowCalcDate())
            GUICtrlSetData($listview_[$i_tab],"Files created the " & _DateTimeFormat($sNewDate,1))
                $i_MinJour=$jour
                $timerstamp1 = TimerInit()
                _refresh($dossier[$i_tab],$listview_[$i_tab])
                ConsoleWrite("_refresh :"&round(TimerDiff($timerstamp1)) & " mseconds to search."&@lf)
        Case $msg1 = $jourenplus
            if $jour then
                $jour += 1
                $sNewDate = _DateAdd( 'd',$jour, _NowCalcDate())
                $timerstamp1 = TimerInit()
                GUICtrlSetData($listview_[$i_tab],"Files created the " & _DateTimeFormat($sNewDate,1))
                _refresh($dossier[$i_tab],$listview_[$i_tab])
                ConsoleWrite("_refreshArray :"&round(TimerDiff($timerstamp1)) & " mseconds to search."&@lf)
            EndIf
    EndSelect
    If $msg1 = $GUI_EVENT_PRIMARYDOWN Then
        If $MouseDown = 0 Then
            $MouseDown = TimerInit()
        Else
            If TimerDiff($MouseDown) < 200 Then
                $SelectLine = StringSplit((GUICtrlRead(GUICtrlRead($listview_[$i_tab]))),"|")
                $run=$SelectLine[1]
                ConsoleWrite("dossier : " & $dossier & @CR)
                _Rundos("start " & $dossier & '"' & $run & '"')
            EndIf
        EndIf
    EndIf
    ; Réinitialise le compteur si aucun autre click n'est détécté
    If $MouseDown > 0 And TimerDiff($MouseDown) > 200 Then $MouseDown = 0
WEnd
Func Slide_in()
    $hide_state = 0
    GUISetState(@SW_HIDE, $hwnd)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 100, "long", 0x00040001);slide in from left
    GUISetState(@SW_SHOW, $hwnd2)
    WinActivate($hwnd2)
    WinWaitActive($hwnd2)
    _GUICtrlTabSetCurFocus($tab, 0)
    _GUICtrlTabSetCurFocus($tab, 1)
    _GUICtrlTabSetCurFocus($tab, $i_PrevTab)
EndFunc   ;==>Slide_in
Func Slide_out()
    $hide_state = 1
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 100, "long", 0x00050002);slide out to left
    GUISetState(@SW_HIDE, $hwnd2)
    GUISetState(@SW_SHOW, $hwnd)
    WinActivate($hwnd)
    WinWaitActive($hwnd)
EndFunc   ;==>Slide_out
Func Function(ByRef $B)
    Slide_out() 
EndFunc   ;==>Function
Func Set_Exit()
    Exit
EndFunc   ;==>Set_Exit
Func Set_Config()
    $a_pos = WinGetPos($hwnd)
    If $a_pos[0] = 3 Then Return
    Slide_in()
    $pass = 1
EndFunc   ;==>Set_Config
Func _FileList($dossier)
    $dossierShort=FileGetShortName($dossier)
    $sCommand=  " dir " & $dossierShort & "*.*   /TW/Od /-C /a-d-h-s | FIND "&'"/"'&"> " &  $s_AnswerFile2
    _RunDOS($sCommand)
EndFunc   ;==>_FileList
Func _refresh($dossier,$liste)
    local $szIconFile
    $searchquierie=_DateTimeFormat($sNewDate,2)
    _LockAndWait3()
    __GUICtrlListViewDeleteAllItems($liste)
    if StringLen($searchquierie)=9 then $searchquierie="0"&$searchquierie
;   for $k= $i_PrevLine to UBound($ar_Files)-1
    for $k= 0 to UBound($ar_Files)-1
        If StringInStr($ar_Files[$k],$searchquierie) Then
            $tmp=StringMid($ar_Files[$k],12)
            _GUICtrlCreateListViewItem($tmp,$liste)
            $i_Found=1
        Elseif  $i_Found then
            ;$i_PrevLine=$k
            $i_Found=0
            ExitLoop
        EndIf
    Next
    _ResetLockWait3()
    _GUIListViewReDim()
    redim $ar_ArrayLists[ubound($ar_ArrayLists)+1]
    $ar_ArrayLists[-$jour]=$ar_LISTVIEWArray
EndFunc   ;==>_refresh

don't forget to download the config file !

up to 10 folders

rename lastfilesettings.au3 to lastfilesettings.ini

lastfiles_tabs.au3

lastfilesettings.au3

Edited by arcker

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

Hi,

Here it is with icons; only changes at your lines for "_GUICtrlCreateListViewItem"

If $tmpdate[1] = $mois And $tmpdate[2]=$jour And $tmpdate[0]=@YEAR Then
                    If $tmp<>"Desktop.ini" And $tmp<>"pagefile.sys" Then
                        $nIcon=0
                        FileGetIcon($szIconFile, $nIcon,$tmp )
                            _GUICtrlCreateListViewItem($tmp & "|"&  $tmpdate[3] & ":" & $tmpdate[4] & ":" & $tmpdate[5],$liste)
                        EndIf
                        _GUICtrlSetImage(-1,$szIconFile,$nIcon)
                    EndIf
                EndIf
oÝ÷ Ù©Ýjëh×6Func _refresh($dossier)
    local $szIconFile

In your original and this, I have to switch between tabs to get current tab active to see the listview on first tab at present?...

[PS My sort routine will not work herer? - as it is only set up at present to handle one active list-view; another little challenge!]

Best, Randall

Hi,

I think this is working on all international settings, with sliding toolbar, icons, and fast sort?...

So I have deleted versions I wrote which were not compatible...

Best, randall

GUICtrlListView.au3, ListView GUI Fast Sort

Edited by randallc
Link to comment
Share on other sites

yes i've constated thus bug too

i'll try to fix it

thanx for your help ! i will try your modifications now

edit : yes, your sort function doesn't seem to work anymore...

C:\Program Files\AutoIt3\beta\Include\_GUICtrlListView.au3 (73) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: 
If StringInStr(FileGetAttrib($ar_LISTVIEWArrayITEM[2] &$ar_LISTVIEWArrayITEM[1]),"D") or StringInStr(FileGetAttrib($ar_LISTVIEWArrayITEM[1]),"D")  or StringInStr(FileGetAttrib($ar_LISTVIEWArrayITEM[3]),"D")Then 
If StringInStr(FileGetAttrib($ar_LISTVIEWArrayITEM[2] &$ar_LISTVIEWArrayITEM[1]),"D") or StringInStr(FileGetAttrib($ar_LISTVIEWArrayITEM[1]),"D")  or StringInStr(FileGetAttrib(^ ERROR

edit2 : i don't understand why listview doesn't show when created....

i've another program with exactly the same code, and no problem

for your sort function, do you think it's possible to fix it ? or it's impossible ?

edit 3 : ok i've fixed the "non shown" problem

i've simply added GUICtrlSetState(-1,$gui_show) after the first listview creation

i wait you for any solution about sorting before to post an update

cheers

Edited by arcker

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

Hi,

I think you had my close function at the end of a display, so you had closed the sort facility; I have changed it to be included with a new "delete" also add the extra underscore; see new file and please till me if it is working for you as it zips along for me even with icons.[needs version 0_45 of UDF via signature link]

Best, randall

Hi,

I think this is working on all international settings, with sliding toolbar, icons, and fast sort?...

So I have deleted versions I wrote which were not compatible...

Best, randall

GUICtrlListView.au3, ListView GUI Fast Sort

Edited by randallc
Link to comment
Share on other sites

  • 1 month later...

Hi,

latest version of "FileBrowser" for trial in zip at "_GUICtrlListView.au3" link in signature.

1. Please check the on-event mode maintains low cpu.[thanks to others.... Arcker etc]

2. Double-click to open now working with on-event mode.

3. Context [and File...] menu for rename, open, open multiple, open in explorer, open in scite, copy, delete.

4. Rename using Edit ListView Item.

5. Shrinks to a button, attaches to side required [thanks to others.... Simucal etc]

6. Use Filter and Extension

7. Corrected added tabs and directories not having full function

8. Corrected exe icons not showing properly..credit [thanks to others.... ?? ...own up!? etc]

9. option to skip back through days with no matching files rather than one at a time.

I know ther is still one irritating bug, but not critical, and I doubt you'll find it!

Tell me what you think.

_GUICtrlListView.zip

Best, randall

Edited by randallc
Link to comment
Share on other sites

simply amazing...rename, delete

and so fast now

really complex code, but it works

you're a genius man ^^

maybe you can have a look on my ftp client on this forum

i'm stuck with icons for files ^^

i've used filegeticon, and _guictrlsetimage, but no way :/

maybe with your last version of _guictrllistview

c u

ps link to ftp client :

http://www.autoitscript.com/forum/index.php?showtopic=30146

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
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...