Jump to content
Sign in to follow this  
monter

Recently used folder list

Recommended Posts

monter

I made this script, because I need to use this function (it's not a UDF function actually) recently used folder list to my another bigger script.

In this script folders are used as output places for converted files.

Posted Image

Posted Image

The folder list is sorted - the recently used - the upper position.

If selected folders are in @AppDataDir (C:\Documents And Settings\user) their names are shortend - e.g. "Desktop".

The folder list is saved in ini file.

Edit 04.29.2010 (v.0.2) - fixed bug. Most recent folder selected from combo was reset and not saved.

Edit 05.02.2010 (v.0.3) - improved ordering folder list. When you select folder from combo, then select another - without "converting" - previous order is restored. Only after "Convert..." folder list changes the order.

Edit 11.03.2010 (v.0.4) - added access checking for writing, other small improvements.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('TrayIconDebug', 1)
Global $dirTgtSel, $dirTgTmp[10], $dirTgt[10], $msgIcn
$fnScript = 'Recent Folders (example script)' ;full script name
$script = StringLeft(@ScriptName, StringInStr(@ScriptName, '.', 0, -1) - 1)
If $script <> 'RecentFolders' Then $script = 'RecentFolders' ;proper script name (if user changed it)
$sVer = 0.4
$title = $fnScript & ' ' & $sVer
$ini = @ScriptDir & '\' & $script & '.ini'
$brk = 0
$posDir = ''
OnAutoItExitRegister('OnExit')
IniFRead()

Const $wi = 338, $he = 63
#region ### START Koda GUI section ### Form=DirTgt.kxf
$frmDirTgt = GUICreate($title, $wi, $he, -1, -1)
$cboDirTgt = GUICtrlCreateCombo('', 4, 8, 265, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
DirRcntVfy()
DirRcntDisp()
$btnDirTgt = GUICtrlCreateButton('C&hange...', 272, 6, 59, 25)
GUICtrlSetTip(-1, 'Select (output) folder')
$btnCv = GUICtrlCreateButton('Convert some files...', 112, 32, 107, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetTip(-1, 'Example of some file operation. After this, the folder list will be saved')
Dim $frmDirTgt_AccelTable[1][2] = [['^h', $btnDirTgt]]
GUISetAccelerators($frmDirTgt_AccelTable)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnDirTgt
            DirRcntChkLst()
            DirTgtChng()
            If StringLen($dirTgtSel) > 0 Then
                $posDir = ''
                DirRcntShift()
            EndIf
            DirRcntDisp()
        Case $cboDirTgt
            $dirTgtSel = GUICtrlRead($cboDirTgt)
            DirFull()
            DirRcntChkLst()
            If StringLen($dirTgtSel) > 0 Then DirRcntShift()
            DirRcntDisp()
        Case $btnCv
            Convert()
            $posDir = ''
            DirRcntChkLst()
            If StringLen($dirTgtSel) > 0 Then
                $posDir = ''
                DirRcntShift()
            EndIf
            DirRcntSav()
            DirRcntDisp()
            $msgIcn = ''
    EndSwitch
WEnd

Func DirRcntVfy() ;checking folders - if doesn't exist anymore, the item is cleared and moved up
    $dirLenSum = 0
    For $i = 1 To 9
        If StringLen($dirTgTmp[$i]) > 0 And Not FileExists($dirTgTmp[$i]) Then $dirTgTmp[$i] = ''
        $dirLenSum = $dirLenSum + StringLen($dirTgTmp[$i])
    Next
    If $dirLenSum = 0 Then $dirTgTmp[1] = @AppDataDir ;if none exist - set @AppDataDir
    For $i = 1 To 9
        For $k = 9 To 2 Step -1
            If $dirTgTmp[$k - 1] = '' Then
                $dirTgTmp[$k - 1] = $dirTgTmp[$k]
                $dirTgTmp[$k] = ''
            EndIf
        Next
    Next
EndFunc   ;==>DirRcntVfy

Func DirTgtChng()
    $dirTgtSel = ''
    For $i = 0 To 9
        If $i = 0 Then
            $dirTgtSel = FileSelectFolder('Select output folder for (e.g.) converted files. (' & $i + 1 & '/10)', '', '', GUICtrlRead($cboDirTgt))
        Else
            $dirTgtSel = FileSelectFolder('Select output folder for (e.g.) converted files. (' & $i + 1 & '/10)', '', '', $dirTgTmp[$i])
        EndIf
        If StringLen($dirTgtSel) > 0 Then
            $dirAcc = DirAccess($dirTgtSel)
            If StringLen($dirAcc) > 1 Then
                MsgBox(48, $title, $dirAcc & @CRLF & @CRLF & 'Contact with Administrator or choose different target folder.', 30)
                $dirTgtSel = ''
                ContinueLoop
            EndIf
            $dirTgTmp[0] = $dirTgtSel
            ExitLoop
        EndIf
        If $i = 2 Then ExitQuery()
        If $brk = 1 Then
            $brk = 0
            ExitLoop
        EndIf
    Next
    If Not FileExists($dirTgtSel) Then $dirTgtSel = ''
EndFunc   ;==>DirTgtChng

Func DirAccess($sDir) ; checking directory access
    $errAcc = 0
    $fTmp = @TempDir & '\' & $script & '.tmp'
    $hFil = FileOpen($fTmp, 2)
    FileWrite($hFil, 'Dir write/delete access test - delete this file.')
    FileClose($hFil)
    $asDir = StringSplit($sDir, '|')
    For $i = 1 To $asDir[0]
        If Not FileExists($asDir[$i]) Then
            $errAcc = SetError(2, 0, $asDir[$i] & ' is not a valid folder.')
            ContinueLoop
        EndIf
        FileCopy($fTmp, $asDir[$i] & '\', 1)
        If Not FileExists($asDir[$i] & '\' & StringTrimLeft($fTmp, StringInStr($fTmp, '\', 0, -1))) Then
            $errAcc = SetError(1, 0, 'No write access to ' & @CRLF & $asDir[$i])
        Else
            FileDelete($asDir[$i] & '\' & StringTrimLeft($fTmp, StringInStr($fTmp, '\', 0, -1)))
            If @error Then $errAcc = SetError(2, 0, 'No delete access to ' & @CRLF & $asDir[$i])
        EndIf
    Next
    FileDelete($fTmp)
    Return $errAcc
EndFunc   ;==>DirAccess

Func DirRcntChkLst()
    If $posDir <> '' Then
        For $i = 1 To $posDir
            $dirTgTmp[$i - 1] = $dirTgTmp[$i]
        Next
        $dirTgTmp[$posDir] = $dirTgTmp[0]
        $dirTgTmp[0] = ''
    EndIf
EndFunc   ;==>DirRcntChkLst

Func DirRcntShift()
    For $i = 1 To 9
        If $dirTgtSel = $dirTgTmp[$i] Then
            $posDir = $i
            ExitLoop
        EndIf
    Next
    $dirTgTmp[0] = $dirTgtSel
    If $posDir <> '' Then
        For $i = $posDir To 1 Step -1
            $dirTgTmp[$i] = $dirTgTmp[$i - 1]
        Next
        $dirTgTmp[0] = ''
    EndIf
EndFunc   ;==>DirRcntShift

Func DirRcntSav()
    $posDif = 0
    If $dirTgTmp[0] <> '' Then $posDif = 1
    For $i = 1 To 9
        $dirTgt[$i] = $dirTgTmp[$i - $posDif]
    Next
    For $i = 1 To 9
        $dirTgTmp[$i] = $dirTgt[$i]
    Next
    $dirTgTmp[0] = ''
EndFunc   ;==>DirRcntSav

Func DirRcntDisp()
    $cboDirTgtData = ''
    $iFrom = 1
    If $dirTgtSel <> '' Then
        If $dirTgTmp[0] <> '' Then
            $dirTgTmp[0] = $dirTgtSel
            $iFrom = 0
        Else
            $dirTgTmp[1] = $dirTgtSel
        EndIf
    Else
        $dirTgtSel = $dirTgTmp[1]
    EndIf
    DirShort()
    For $i = $iFrom To 9
        If $dirTgTmp[$i] <> '' Then $cboDirTgtData = $cboDirTgtData & '|' & $dirTgTmp[$i]
    Next
    $cboDirTgtData = StringTrimLeft($cboDirTgtData, 1)
    GUICtrlSetData($cboDirTgt, '')
    GUICtrlSetData($cboDirTgt, $cboDirTgtData, $dirTgtSel)
    DirFull()
    GUICtrlSetTip($cboDirTgt, $dirTgtSel)
    $dirTgTmp[0] = ''
EndFunc   ;==>DirRcntDisp

Func Convert() ;you can insert here an action related with file/folder operation, e.g. conversion
    $msgIcn = 1
    msg('Converting done.' & @CRLF & 'Saving current recent folders order.', -2000, -1, Int(@DesktopHeight / 2) + $he + 4, $msgIcn)
EndFunc   ;==>Convert

Func DirShort()
    Dim $dirShort[11]
    For $i = 0 To 10
        If $i < 10 Then
            $dirShort[$i] = $dirTgTmp[$i]
        Else
            $dirShort[$i] = $dirTgtSel
        EndIf
        If StringLen($dirShort[$i]) > 0 Then
            If StringLeft($dirShort[$i], StringLen(@UserProfileDir)) = @UserProfileDir Then
                $dirShort[$i] = StringTrimLeft($dirShort[$i], StringLen(@UserProfileDir) + 1) ;shortened path to @UserProfileDir subdirs
                If $dirShort[$i] = '' Then $dirShort[$i] = @UserName
            EndIf
        EndIf
    Next
    For $i = 0 To 10
        If $i < 10 Then
            $dirTgTmp[$i] = $dirShort[$i]
        Else
            $dirTgtSel = $dirShort[$i]
        EndIf
    Next
EndFunc   ;==>DirShort

Func DirFull()
    Dim $dirFull[11]
    For $i = 0 To 10
        If $i < 10 Then
            $dirFull[$i] = $dirTgTmp[$i]
        Else
            $dirFull[$i] = $dirTgtSel
        EndIf
        If StringLen($dirFull[$i]) > 0 Then
            If $dirFull[$i] = @UserName Then $dirFull[$i] = @UserProfileDir
            If StringLeft($dirFull[$i], 2) <> '\\' And StringMid($dirFull[$i], 2, 2) <> ':\' Then $dirFull[$i] = @UserProfileDir & '\' & $dirFull[$i] ;restoring shortened paths
        EndIf
    Next
    For $i = 0 To 10
        If $i < 10 Then
            $dirTgTmp[$i] = $dirFull[$i]
        Else
            $dirTgtSel = $dirFull[$i]
        EndIf
    Next
EndFunc   ;==>DirFull

Func IniFRead()
    $sct = IniReadSection($ini, 'DirsTgtRcnt')
    If @error Then
        msg("Missing [DirsTgtRcnt] section or ini file doesn't exist!", -1500, -1, -1, 2)
    Else
        For $i = 1 To $sct[0][0]
            If $sct[$i][1] = '' Then IniDelete($ini, 'Main', $sct[$i][0])
        Next
    EndIf
    For $i = 1 To 9
        $dirTgt[$i] = IniRead($ini, 'DirsTgtRcnt', 'dirTgt' & $i, '')
        $dirTgTmp[$i] = $dirTgt[$i]
    Next
    If $dirTgt[1] = '' Then $dirTgTmp[1] = @AppDataDir
EndFunc   ;==>IniFRead

Func ExitQuery()
    $exitQry = MsgBox(292, $title, 'Quit with selecting output folders?', 8)
    If $exitQry = 6 Then $brk = 1
EndFunc   ;==>ExitQuery

Func OnExit()
    BlockInput(0)
    DirRcntVfy()
    For $i = 1 To 9
        IniWrite($ini, 'DirsTgtRcnt', 'dirTgt' & $i, $dirTgt[$i])
    Next
EndFunc   ;==>OnExit

Func msg($txt = '', $ms = 1500, $ttX = -1, $ttY = -2, $icn = 1, $tray = -1, $sTit = -1)
    If $ms >= 0 And $ms < 250 Then $ms = 250
    If $ms = -1 Then $ms = 1500
    $clr = 0
    If $ms < -1 Then
        $ms = Abs($ms)
        $clr = 1
    EndIf
    If $sTit = -1 Then
        $sTit = StringLeft(@ScriptName, StringInStr(@ScriptName, '.', 0, -1) - 1)
        If IsDeclared('fnScript') And IsDeclared('sVer') Then $sTit = $fnScript & ' ' & $sVer
    EndIf
    If $ttX = -1 Then $ttX = Int(@DesktopWidth / 2)
    If $ttY = -1 Then $ttY = Int(@DesktopHeight / 2)
    If $ttY = -2 Then $ttY = @DesktopHeight - 64
    If $icn = 2 Then $txt = 'Warning!' & @CRLF & $txt
    If $icn = 3 Then $txt = 'ERROR!' & @CRLF & $txt
    If $tray = -1 Then ToolTip($txt, $ttX, $ttY, $sTit, $icn, 2)
    If $tray = 1 Then TrayTip($sTit, $txt, $ms, $icn)
    Sleep($ms)
    If $clr = 1 Then ToolTip('')
EndFunc   ;==>msg

RecentFolders.au3

Edited by monter

monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Share this post


Link to post
Share on other sites
ldub

I think that it doesn't work for me (Window xp)

What does "Convert sth... " mean ? (sorry, I dont' speak english fine)

Share this post


Link to post
Share on other sites
monter

I think that it doesn't work for me (Window xp)

What does "Convert sth... " mean ? (sorry, I dont' speak english fine)

It's only an example of using recently used folders. I added "Convert sth..." (sth = abbreviation of "something"). Newly selected folders won't be remembered until you press "Convert" button.

You can implement any action related with last (output) folders...

My english is also weird ;-)

Edited by monter

monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Share this post


Link to post
Share on other sites
enaiman

Again a ridiculous rating (5*) for a script. This "smells" :idea:

1* from me just to bring it down in rating.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
monter

Again a ridiculous rating (5*) for a script. This "smells" :)

1* from me just to bring it down in rating.

I don't care about stars, that wasn't me :idea:

monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Share this post


Link to post
Share on other sites
monter

I found a bug. If recently used folder was selected from combo box, it wasn't saved into the ini file and lost. Ini entry was empty.

See => first post.


monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Share this post


Link to post
Share on other sites
logmein

Good work! It's useful for me. Thank! :idea:

To : enaiman

monter is only a newbie in AutoIT, so that script is a hard working. 4* from me! Good star would keep him excited.

Edited by logmein

Share this post


Link to post
Share on other sites
monter

Script updated (0.3). Improved ordering folder list until "Convert..." is clicked.

See => first post.

Edited by monter

monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Share this post


Link to post
Share on other sites
wakillon

Hi monter !

your script is not very practical and this reminds me an old script.

Some years ago my explorer crashed often and all my open folders disappeared ! ( in fact it still happens to him sometimes ! )

so i made this script :

#NoTrayIcon
#include <WinApi.au3>
#include <String.au3>
#include <Array.au3>
#Include <File.au3>
#include <Misc.au3>
Opt ( "WinTitleMatchMode", 4 )

Dim $_LatestOpenFolderPath = '', $_LatestOpenFolderPathArray[21], $RegKey = "HKEY_CURRENT_USER\Software\LatestOpenFolderPath", $_MinInit = @Min
Global $_List, $_LatestOpenFolder
If Not _Singleton ( @ScriptName, 1 ) Then Exit
_StartWithWindows ( "LastOpenFolder", FileGetShortName ( @ScriptFullPath ) )
If Not FileExists ( @MyDocumentsDir & '\Dir' ) Then DirCreate ( @MyDocumentsDir & '\Dir' )

While 1
    _UpDateList ( ) 
    $_Handle = _WINAPI_GETFOREGROUNDWINDOW ( )
    $_Title = _WINAPI_GETWINDOWTEXT ( $_Handle )
    ;If $_Title = "Mes documents" Then $_Title = @MyDocumentsDir
    If _IsDirectory ( $_Title ) And $_LatestOpenFolderPath <> $_Title Then 
        $_LatestOpenFolderPath = $_Title
        $_SearchIndex = _ArraySearch ( $_LatestOpenFolderPathArray, $_LatestOpenFolderPath ) 
        If $_SearchIndex < 1 Then
            $_DeleteFile = @MyDocumentsDir & '\Dir\' & _GetShortcutNameByFullPath ( $_LatestOpenFolderPathArray[1] ) & '.lnk'
            FileDelete ( $_DeleteFile ) 
            $_LatestOpenFolderPathArray[1]=''           
            _ArrayPush ( $_LatestOpenFolderPathArray, $_LatestOpenFolderPath )
            For $_I = 1 To UBound ( $_LatestOpenFolderPathArray ) - 1
                RegWrite ( $RegKey , $_I, "REG_SZ", $_LatestOpenFolderPathArray[$_I] )
            Next
        Else 
            If $_SearchIndex > 1 Then 
                For $_I = $_SearchIndex To 2 Step -1 
      $_LatestOpenFolderPathArray[$_I] = $_LatestOpenFolderPathArray[$_I-1]
    Next
            EndIf
            _ArrayPush ( $_LatestOpenFolderPathArray, $_LatestOpenFolderPath )
            For $_I = 1 To UBound ( $_LatestOpenFolderPathArray ) - 1
                RegWrite ( $RegKey , $_I, "REG_SZ", $_LatestOpenFolderPathArray[$_I] )
            Next            
        EndIf   
    EndIf
    _ReduceMemory ( ProcessExists ( @ScriptName ) ) 
    Sleep ( 200 )   
WEnd

Func _UpDateList ( )
    Global $_List = ''
    For $_I = 1 To UBound ( $_LatestOpenFolderPathArray ) - 1 
        $_LatestOpenFolderPathArray[$_I] = RegRead ( $RegKey, $_I )
        If Not @error And $_LatestOpenFolderPathArray[$_I] <> '' Then 
            $_GetShortcutNameByFullPath = _GetShortcutNameByFullPath ( $_LatestOpenFolderPathArray[$_I] )
            If $_GetShortcutNameByFullPath <> '' Then FileCreateShortcut ( $_LatestOpenFolderPathArray[$_I], @MyDocumentsDir & '\Dir\' & $_GetShortcutNameByFullPath & '.lnk' )
        EndIf   
        If $_I > 1 And $_LatestOpenFolderPathArray[$_I] <> '' Then $_List = $_List & $_LatestOpenFolderPathArray[$_I] & '|'
    Next
    $_LinkList = _FileListToArray ( @MyDocumentsDir & '\Dir', '*.lnk' )
    If Not @error And $_LinkList <> '' Then 
    For $_I = 1 To UBound ( $_LinkList ) - 1
            $_ShorcutPath = @MyDocumentsDir & '\Dir\' & $_LinkList[$_I]
            If _IsShorcutDead ( $_ShorcutPath ) Then FileDelete ( $_ShorcutPath )
        Next 
    EndIf
EndFunc ;==> _UpDateList ( )

Func _GetShortcutNameByFullPath ( $_FullPath )
    If Not FileExists ( $_FullPath ) Then Return ''
    Dim $_FileName = StringSplit ( $_FullPath, '\' )
    If Not @error And $_FileName <> '' Then 
        If $_FileName[2] = '' Then 
    Return DriveGetLabel ( $_FullPath ) & ' ' & StringReplace ( $_FullPath, ':\', '' )
        Else
    Return $_FileName[$_FileName[0]]
        EndIf
    Else    
        Return ''
    EndIf
EndFunc ;==> _GetShortcutNameByFullPath ( )

Func _IsShorcutDead ( $_ShorcutPath )
    Dim $_ShorCutDetails = FileGetShortcut ( $_ShorcutPath )
    If Not @error And $_ShorCutDetails <> '' Then 
    If Not FileExists ( $_ShorCutDetails[0] ) Or Not _IsDirectory ( $_ShorCutDetails[0] ) Then 
    Return True
    Else
    Return False
    EndIf   
    Else    
        Return True
    EndIf
EndFunc ;==> _IsShorcutDead ( )

Func _IsDirectory ( $_FilePath )
    If Not FileExists ( $_FilePath ) Then Return False
    If StringInStr ( FileGetAttrib ( $_FilePath ), "D" ) Then 
 Return True
    Else
 Return False
    EndIf
EndFunc ;==> _IsDirectory ( )

Func _StartWithWindows ( $TitleKey, $ExePath )
    RegWrite ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $TitleKey, "REG_SZ", $ExePath )
EndFunc ;==> _StartWithWindows ( )

Func _ReduceMemory ( $_PID )
    Local $hPsAPIdll = "psapi.dll", $hKernel32dll = "kernel32.dll"
    If $_PID <> -1 Then
 Local $aHandle = DllCall ( $hKernel32dll, "int", "OpenProcess", "int", 0x1f0fff, "int", False, "int", $_PID )
    Local $aReturn = DllCall ( $hPsAPIdll, "int", "EmptyWorkingSet", "long", $aHandle[0] )
 DllCall ( $hKernel32dll, "int", "CloseHandle", "int", $aHandle[0] )
    Endif
EndFunc ;==> _ReduceMemory ( )

Compile it, Run it and open several folders.

Now create a new toolbar :

Right click on taskbar

Tool bar

New Tool bar

select @MyDocumentsDir & '\Dir'

now you have a new toolbar named "dir" with the 20 last open folders links updated.

hope this will help ! Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
monter

your script is not very practical and this reminds me an old script.

[...]

Compile it, Run exe and open several folders.

Now create a new toolbar :

Right click on taskbar

Tool bar

New Tool bar

select @MyDocumentsDir & '\Dir'

now you have a new toolbar named "dir" with the 20 last open folders links updated.

hope this will help !

Your script has completely different purpose than mine :mellow:

Mine is for specific application - after some file operation (e.g. conversion) target folder is saved in the list in order of used time. Your script is prbably for whole system.


monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Share this post


Link to post
Share on other sites
monter

Script updated => v.0.4.


monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

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
Sign in to follow this  

×