Sign in to follow this  
Followers 0
gear

Quick Access List

5 posts in this topic

This program can quickly open the file or folder, a webpage, website or a program.

;This program can quickly open the file or folder, a webpage, website or a program.
;In order to let user recoed more about the items saved, it  also enable commentation for every item.
; Pause Key to hide or show window. The page and catalogy to save is unlimited.
;You can add, delete or modify the name of catalogy, clear whole page items.
;In future the search feature may be added in.
;Author: Gear  2007-2-9

#include <GUIConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <Math.au3>
#Include <GuiCombo.au3>
$Paused = 0;control toggle the window hide or show
HotKeySet("{PAUSE}", "TogglePause")
$HowManyInput = 20;every page will display $HowManyInput items
;$HowManyPages = 20;you can scroll 100 pages of the file or URL or folder name for quick open
;$TotalAddress = $HowManyInput * $HowManyPages
$TheFolderStoreAllInfo = "C:\QuickOpenIndexFolder"
$TheFileSaveInfo = $TheFolderStoreAllInfo & "\IndexFull.txt"

$IfExist0 = FileExists($TheFolderStoreAllInfo)
$IfExist1 = FileExists($TheFileSaveInfo)
Dim $Catalogy[1] = [0];save the catalogy name list
If $IfExist0 And $IfExist1 Then
    Dim $FullPath
    $IfRead = _FileReadToArray($TheFileSaveInfo, $FullPath)
    If $IfRead == 0 Then
        MsgBox(1, "", "fail to read the indexfile.")
        Exit
    Else
        _ArrayDelete($FullPath, 0)
        Dim $PurePath[UBound($FullPath) ], $ItemComment[UBound($FullPath) ]
        For $i = 0 To UBound($FullPath) - 1
            $PureNameLocation = StringInStr($FullPath[$i], "||", 0, 1)
            $ItemCommentLocation = StringInStr($FullPath[$i], "||", 0, 2)
            If $PureNameLocation > 0 Then $PurePath[$i] = StringMid($FullPath[$i], $PureNameLocation + 2, ($ItemCommentLocation - 1) - ($PureNameLocation + 1))
            If $ItemCommentLocation > 0 Then $ItemComment[$i] = StringMid($FullPath[$i], $ItemCommentLocation + 2)
            If StringInStr($FullPath[$i], "#CataloyName#") > 0 Then;this is the catalogy name
                _ArrayAdd($Catalogy, StringMid($FullPath[$i], 14))
                $Catalogy[0] = $Catalogy[0] + 1
            EndIf
        Next
        
    EndIf
Else
    DirCreate($TheFolderStoreAllInfo)
    Dim $FullPath[1], $PurePath[1], $ItemComment[1]
EndIf

$Addresstop = 10
$Height = 20

$TotalHeight = 30 + $HowManyInput * 20 + 10 + 20
$RunButtonwidth = 55
$AddressLen = 300
$CommentLeft = 5
$CommentButtonwidth = $RunButtonwidth / 3
$Addressleft = 5 + $CommentLeft + $CommentButtonwidth

$TotalLen = 365 + $CommentLeft + $CommentButtonwidth + 15

$NextButtonWidth = $RunButtonwidth * 2
$PreviousButtonLeft = $CommentLeft + $NextButtonWidth + 5
$CatalogyComboLeft = $PreviousButtonLeft + $NextButtonWidth + 5
$CatalogyComboWidth = $RunButtonwidth * 3

$AddPageLeft = $CommentLeft
$ClearPageLeft = $CommentLeft + $NextButtonWidth + 5
$AddCatalogyLeft = $ClearPageLeft + $NextButtonWidth + 5
$AddCatalogyButtonWidth = $NextButtonWidth / 2 - 3

Dim $Addresstop[$HowManyInput + 1] = [$HowManyInput], $RunButtontop[$HowManyInput + 1] = [$HowManyInput], $Address[$HowManyInput + 1] = [$HowManyInput], $RunButton[$HowManyInput + 1] = [$HowManyInput], $CommentButton[$HowManyInput + 1] = [$HowManyInput]
Dim $CommentButtontop[$HowManyInput + 1] = [$HowManyInput]
$Addresstop[0] = 10
$IntervalDistance = $Addresstop[0] * 2
$NextOrPreviousClickedTimes = 0;record how many times these two button(Next and Previous buttons) are clicked


GUICreate("Quick Open Lists", $TotalLen, $TotalHeight, @DesktopWidth / 3, @DesktopHeight / 8, -1, 0x00000018)
For $i = 1 To $HowManyInput
    If $i = 1 Then
        $Addresstop[$i] = $Addresstop[0]
    Else
        $Addresstop[$i] = $Addresstop[0] + $IntervalDistance* ($i - 1)
    EndIf
    $CommentButtontop[$i] = $Addresstop[$i]
    $CommentButton[$i] = GUICtrlCreateButton("C", $CommentLeft, $CommentButtontop[$i], $CommentButtonwidth, $Height)
    $Address[$i] = GUICtrlCreateInput("", $Addressleft, $Addresstop[$i], $AddressLen, $Height)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    If $NextOrPreviousClickedTimes > 0 Then
        GUICtrlSetData(-1, $PurePath[$i])
    Else
    EndIf
    
    
    $RunButtontop[$i] = $Addresstop[$i]
    $RunButton[$i] = GUICtrlCreateButton("Run", $AddressLen + $Addressleft + 1, $RunButtontop[$i], $RunButtonwidth, $Height)
Next


$NextButtontop = $Addresstop[1] + $IntervalDistance* ($i) - $IntervalDistance + 5
$NextButton = GUICtrlCreateButton("Next", $CommentLeft, $NextButtontop, $NextButtonWidth, $Height)
$PreviousButton = GUICtrlCreateButton("Previous", $PreviousButtonLeft, $NextButtontop, $NextButtonWidth, $Height)


$CatalogyCombo = GUICtrlCreateCombo("", $CatalogyComboLeft, $NextButtontop, $CatalogyComboWidth, $Height)
If UBound($Catalogy) > 1 Then;when there are catalogy list, dispaly it
    $CatalogyList = _ArrayToString($Catalogy, "|", 1)
    GUICtrlSetData(-1, $CatalogyList, $Catalogy[1])
    $CurrentCatalogy = $Catalogy[1];the current catalogy name dispalyed
    $StartDisplayPosition = 0;this is the catalogy name's position
    RefleshPage()
Else
    While 1;must input a new catalogy name if there is no one
        $FirstCatalogy = InputBox("Creata new catalogy", "Please enter your first catalogy name:", "My Collection")
        If StringLen($FirstCatalogy) > 0 Then
            $FullPath[0] = "#CataloyName#" & $FirstCatalogy
            GUICtrlSetData($CatalogyCombo, $FirstCatalogy, $FirstCatalogy)
            For $i = 1 To $HowManyInput
                _ArrayAdd($FullPath, "")
                _ArrayAdd($PurePath, "")
                _ArrayAdd($ItemComment, "")
            Next
            $StartDisplayPosition = 0;this is the catalogy name's position
            $CurrentCatalogy = $FirstCatalogy
            RefleshPage()
            ExitLoop
        EndIf
    WEnd
EndIf



$AddPageButtonTop = $NextButtontop + $Height + 5
$AddPageButton = GUICtrlCreateButton("Add_Pg", $CommentLeft, $AddPageButtonTop, $NextButtonWidth, $Height)
$ClearPageButton = GUICtrlCreateButton("Clear_Pg", $ClearPageLeft, $AddPageButtonTop, $NextButtonWidth, $Height)




$AddCatalogyButton = GUICtrlCreateButton("Add", $AddCatalogyLeft, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)
$ChangeCatalogyButton = GUICtrlCreateButton("Change", $AddCatalogyLeft + $AddCatalogyButtonWidth + 5, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)
$DeleteCatalogyButton = GUICtrlCreateButton("Delete", ($AddCatalogyLeft + $AddCatalogyButtonWidth + 5) + $AddCatalogyButtonWidth + 5, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)

GUISetState()
$IndexWin = WinGetTitle("")

$msg = 0
While 1
    $msg = GUIGetMsg()
    For $i = 1 To $HowManyInput
        $InputName = GUICtrlRead($Address[$i])
        $result1 = StringInStr($InputName, "\", 0, -1);if it is a new name then replace or add this new name to $FullPath[] array
        $result2 = StringInStr($InputName, "http", 0, -1) - 1
        $result3 = StringInStr($InputName, "www", 0, -1) - 1
        If $result1 > 0 Or $result2 > 0 Or $result3 > 0 Then
            $FullPath[$StartDisplayPosition + $i] = $InputName
            If $result1 > 0 Then $result = $result1
            If $result2 > 0 Then $result = $result2
            If $result3 > 0 Then $result = $result3
            $PurePath[$StartDisplayPosition + $i] = StringMid($InputName, $result + 1)
            $FullPath[$StartDisplayPosition + $i] = $FullPath[$StartDisplayPosition + $i] & "||" & $PurePath[$StartDisplayPosition + $i]
            GUICtrlSetData($Address[$i], $PurePath[$StartDisplayPosition + $i])
        EndIf
        
    Next
    $RunButtonLocation = _ArraySearch($RunButton, $msg); find whivh run button is clicked
;$CursorLocationArray=GUIGetCursorInfo ("")
;If IsArray($CursorLocationArray) Then $CursorLocationID=$CursorLocationArray[4]
;If $CursorLocationID<>0 Then GUICtrlSetTip ($CursorLocationID, "------------------------------")
    $CommentButtonLocation = _ArraySearch($CommentButton, $msg)
    
    
    
    
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            $IfWrite = _FileWriteFromArray($TheFileSaveInfo, $FullPath)
            If $IfWrite <> 1 Then MsgBox(1, "", "Fail to write the exsiting Index to file.")
            ExitLoop
        Case $msg = $NextButton
            $NextPosition = $StartDisplayPosition + $HowManyInput + 1
            If $NextPosition >= UBound($FullPath) Or StringMid($FullPath[$NextPosition], 1, 13) == "#CataloyName#" Then
                GUICtrlSetState($NextButton, $GUI_DISABLE);stop enabling the next page state
            Else
                $StartDisplayPosition = $NextPosition - 1
                GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                RefleshPage()
            EndIf
            
            
        Case $msg = $PreviousButton
            If Not (StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition], 14) == $CurrentCatalogy) Then
                $PreviousPosition = $StartDisplayPosition - $HowManyInput
                Select
                    Case $PreviousPosition > 0 And StringMid($FullPath[$PreviousPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$PreviousPosition], 14) <> $CurrentCatalogy
                        GUICtrlSetState($PreviousButton, $GUI_DISABLE);stop enabling the next page state
                    Case $PreviousPosition >= 0 And StringMid($FullPath[$PreviousPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$PreviousPosition], 14) == $CurrentCatalogy
                        $StartDisplayPosition = $PreviousPosition
                        GUICtrlSetState($NextButton, $GUI_ENABLE)
                        RefleshPage()
                    Case $PreviousPosition > 0 And StringMid($FullPath[$PreviousPosition], 1, 13) <> "#CataloyName#"
                        $StartDisplayPosition = $PreviousPosition
                        GUICtrlSetState($NextButton, $GUI_ENABLE)
                        RefleshPage()
                    Case $PreviousPosition < 0
                        GUICtrlSetState($PreviousButton, $GUI_DISABLE)
                EndSelect
            Else
                GUICtrlSetState($PreviousButton, $GUI_DISABLE)
            EndIf
            
            
            
            
        Case $CommentButtonLocation <> -1 And StringLen($FullPath[$StartDisplayPosition + $CommentButtonLocation]) <> 0;check if the mouse click on the Comment button and if the content of this Input box is empty
            WinSetState($IndexWin, "", @SW_HIDE)
            $MyComment = InputBox("Comment", "Please input your comment for this item:", $ItemComment[$StartDisplayPosition + $CommentButtonLocation])
            If $MyComment <> "" Then $ItemComment[$StartDisplayPosition + $CommentButtonLocation] = $MyComment
            WinSetState($IndexWin, "", @SW_SHOW)
            
            $CommentRemoveLocation = StringInStr($FullPath[$StartDisplayPosition + $CommentButtonLocation], "||", 0, 2)
            If $CommentRemoveLocation > 0 Then
                $OriginalFullName = StringMid($FullPath[$StartDisplayPosition + $CommentButtonLocation], 1, $CommentRemoveLocation)
            Else
                $OriginalFullName = $FullPath[$StartDisplayPosition + $CommentButtonLocation]
            EndIf
            
            If StringLen($MyComment) > 0 Then $FullPath[$StartDisplayPosition + $CommentButtonLocation] = $OriginalFullName & "||" & $MyComment
            
        Case $RunButtonLocation <> -1 And StringLen($FullPath[$StartDisplayPosition + $RunButtonLocation]) <> 0
            $PureNameLocation = StringInStr($FullPath[$StartDisplayPosition + $RunButtonLocation], "||", 0, 1)
            $FullExcuteName = StringMid($FullPath[$StartDisplayPosition + $RunButtonLocation], 1, $PureNameLocation - 1)
            WinSetState($IndexWin, "", @SW_HIDE)
            ShellExecute($FullExcuteName)
            
            
        Case $msg = $AddCatalogyButton
            WinSetState($IndexWin, "", @SW_HIDE)
            $NewCatalogy = InputBox("Add New Catalogy", "Please input the new catalogy name:")
            WinSetState($IndexWin, "", @SW_SHOW)
            If $NewCatalogy <> "" Then
                GUICtrlSetData($CatalogyCombo, $NewCatalogy, $NewCatalogy)
                _ArrayAdd($FullPath, "#CataloyName#" & $NewCatalogy)
                ReDim $FullPath[UBound($FullPath) + $HowManyInput];add a new blank page to the $FullPath array
                ReDim $PurePath[UBound($FullPath) + $HowManyInput]
                ReDim $ItemComment[UBound($FullPath) + $HowManyInput]
                $StartDisplayPosition = UBound($FullPath) - $HowManyInput - 1
                $CurrentCatalogy = $NewCatalogy
                RefleshPage();flesh the page content to the new page
            EndIf
        Case $msg = $AddPageButton
            $IfBlank = 0
            For $i = 1 To $HowManyInput;check if this is ablank page, if it is, then remind user to use this page
                $InputName = GUICtrlRead($Address[$i])
                If StringLen($InputName) > 0 Then
                    $IfBlank = 1
                    ExitLoop
                EndIf
            Next
            
            
            If $IfBlank == 1 Then;only this page has certain meaningful info then user can user a new page
                For $i = 1 To $HowManyInput
                    _ArrayInsert($FullPath, $StartDisplayPosition + $HowManyInput + $i, "")
                    _ArrayInsert($PurePath, $StartDisplayPosition + $HowManyInput + $i, "")
                    _ArrayInsert($ItemComment, $StartDisplayPosition + $HowManyInput + $i, "")
                Next
                $StartDisplayPosition = $StartDisplayPosition + $HowManyInput
                GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                RefleshPage()
            Else
                WinSetState($IndexWin, "", @SW_HIDE)
                MsgBox(1, "", "This a blank page,please use this page.")
                WinSetState($IndexWin, "", @SW_SHOW)
            EndIf
        Case $msg = $CatalogyCombo
            $FreshCatalogyName = GUICtrlRead($CatalogyCombo)
            If $CurrentCatalogy <> $FreshCatalogyName Then;a new catalogy name is selected or added
                $IfFoundCat = _ArraySearch($FullPath, "#CataloyName#" & $FreshCatalogyName, 0, 0, 0, False);only $FullPath includes the catalogy name
                If $IfFoundCat <> -1 Then
                    $StartDisplayPosition = $IfFoundCat
                    $CurrentCatalogy = $FreshCatalogyName
                    GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                    GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                    RefleshPage()
                Else
                    MsgBox(1, "", "This catalogy cannot be found in database.")
                EndIf
            EndIf
            
        Case $msg = $ChangeCatalogyButton;try to change the name of the current catalogy name
            $InputName = GUICtrlRead($CatalogyCombo)
            WinSetState($IndexWin, "", @SW_HIDE)
            $NewName = InputBox("Change Name", "Please enter a new name for current catalogy:", $InputName)
            WinSetState($IndexWin, "", @SW_SHOW)
            If $NewName <> "" Then
                $SearchStart = 0
                While 1
                    
                    $Location = _ArraySearch($FullPath, "#CataloyName#" & $InputName, $SearchStart, 0, 0, False)
                    If $Location <> -1 Then
                        $FullPath[$Location] = "#CataloyName#" & $NewName
                        $SearchStart = $Location
                    Else
                        $iIndex = _ArraySearch($Catalogy, $InputName)
                        $Catalogy[$iIndex] = $NewName
                        $CurrentCatalogy = $NewName
                        GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $NewName);destroy the previous combo list and flesh with the new list
                        ExitLoop;all current catalogy name in FuullPath have been replaced by $newname
                    EndIf
                WEnd
            EndIf
            RefleshPage()
        Case $msg = $DeleteCatalogyButton; try to delete this catalogy and all the items within it
            #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Default Button=Second, Icon=Critical
            If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
            WinSetState($IndexWin, "", @SW_HIDE)
            $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! All the items within this catalogy will be delete!")
            WinSetState($IndexWin, "", @SW_SHOW)
            Select
                Case $iMsgBoxAnswer = 6;yes
                    WinSetState($IndexWin, "", @SW_HIDE)
                    $IfOK = MsgBox(1, "Confirmation", "Are you really want to delete this catalogy? All the items within it will be deleted.")
                    WinSetState($IndexWin, "", @SW_SHOW)
                    If $IfOK == 1 Then;all the items will be delelted.
                        $InputName = GUICtrlRead($CatalogyCombo)
                        $Location = _ArraySearch($FullPath, "#CataloyName#" & $InputName, 0, 0, 0, False)
                        _ArrayDelete($FullPath, $Location)
                        While 1
                            If StringMid($FullPath[$Location], 1, 13) == "#CataloyName#" Then ExitLoop
                            If $Location == UBound($FullPath) - 1 Then
                                _ArrayDelete($FullPath, $Location)
                                ExitLoop
                            Else
                                _ArrayDelete($FullPath, $Location)
                                _ArrayDelete($PurePath, $Location)
                                _ArrayDelete($ItemComment, $Location)
                            EndIf
                        WEnd
                    EndIf
                    _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                    GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                    $StartDisplayPosition = 0
                    $CurrentCatalogy = $Catalogy[1]
                    GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                    GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                    RefleshPage()
                Case $iMsgBoxAnswer = 7;No
            EndSelect
            #EndRegion --- CodeWizard generated code End ---
        Case $msg = $ClearPageButton ;try to delete all the items in this page
            WinSetState($IndexWin, "", @SW_HIDE)
            $iMsgBoxAnswer = MsgBox(4, "Page Delete", "Attention! All the items within this page will be delete!")
            WinSetState($IndexWin, "", @SW_SHOW)
            If $iMsgBoxAnswer = 6 Then
                For $i = 1 To $HowManyInput
                    _ArrayDelete($FullPath, $StartDisplayPosition + 1)
                    _ArrayDelete($PurePath, $StartDisplayPosition + 1)
                    _ArrayDelete($ItemComment, $StartDisplayPosition + 1)
                Next
                
                If $StartDisplayPosition + 1 < UBound($FullPath) Then
                    If StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition + 1], 1, 13) == "#CataloyName#" Then; the next catalogy will appear
                        WinSetState($IndexWin, "", @SW_HIDE)
                        $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! This catalogy is empty, do you want to delete this catalogy at the same time?")
                        WinSetState($IndexWin, "", @SW_SHOW)
                        Select
                            Case $iMsgBoxAnswer = 6;Yes
                                _ArrayDelete($FullPath, $StartDisplayPosition)
                                _ArrayDelete($PurePath, $StartDisplayPosition)
                                _ArrayDelete($ItemComment, $StartDisplayPosition)
                                $InputName = GUICtrlRead($CatalogyCombo)
                                $Ifgood = _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                                GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                                $CurrentCatalogy = $Catalogy[1]
                                $StartDisplayPosition = 0
                            Case $iMsgBoxAnswer = 7;NO
                                For $i = 1 To $HowManyInput;insert a new blank page fot this catalogy
                                    _ArrayInsert($FullPath, $StartDisplayPosition + $i, "")
                                    _ArrayInsert($PurePath, $StartDisplayPosition + $i, "")
                                    _ArrayInsert($ItemComment, $StartDisplayPosition + $i, "")
                                Next
                        EndSelect
                    EndIf
                    If StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition + 1], 1, 13) <> "#CataloyName#" Then
                        $StartDisplayPosition = $StartDisplayPosition
                    EndIf;the first page of this catalogy is cleared, then display its original second page of this catatlogy
                Else ;the end of FullPath array appears
                    Select
                        Case StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#"
                            WinSetState($IndexWin, "", @SW_HIDE)
                            $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! This catalogy is empty, do you want to delete this catalogy at the same time?")
                            WinSetState($IndexWin, "", @SW_SHOW)
                            Select
                                Case $iMsgBoxAnswer = 6;OK
                                    _ArrayDelete($FullPath, $StartDisplayPosition)
                                    _ArrayDelete($PurePath, $StartDisplayPosition)
                                    _ArrayDelete($ItemComment, $StartDisplayPosition)
                                    $InputName = GUICtrlRead($CatalogyCombo)
                                    _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                                    GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                                    $CurrentCatalogy = $Catalogy[1]
                                    $StartDisplayPosition = 0
                                Case $iMsgBoxAnswer = 7;NO
                                    For $i = 1 To $HowManyInput;insert a new blank page fot this catalogy
                                        _ArrayInsert($FullPath, $StartDisplayPosition + $i, "")
                                        _ArrayInsert($PurePath, $StartDisplayPosition + $i, "")
                                        _ArrayInsert($ItemComment, $StartDisplayPosition + $i, "")
                                    Next
                            EndSelect
                        Case StringMid($FullPath[$StartDisplayPosition], 1, 13) <> "#CataloyName#";the last page of this catalogy is cleared, then display its original previous page
                            $StartDisplayPosition = $StartDisplayPosition - $HowManyInput
                    EndSelect
                EndIf
            EndIf
            RefleshPage()
    EndSelect
    Sleep(20)
WEnd



;hide or show the window by PAUSE
Func TogglePause()
    Sleep(50)
    If $Paused == 0 Then;toggle the hide or show
        GUISetState(@SW_SHOW, $IndexWin)
        $TimeToHideWindow = 0;donot let the window hide when you show it.
        $Paused = $Paused + 1
    Else
        GUISetState(@SW_HIDE, $IndexWin)
        $Paused = $Paused - 1
    EndIf
    
EndFunc  ;==>TogglePause


Func RefleshPage()
    For $i = 1 To $HowManyInput
        $PureName = $PurePath[$StartDisplayPosition + $i]
        GUICtrlSetData($Address[$i], $PureName)
    Next
EndFunc  ;==>RefleshPage

Share this post


Link to post
Share on other sites



Sorry, the first one cannot work, I update to the following one.Suggestion is always welcome.

;Thsi program can quickly open the file or folder, a webpage, website or a program.
;In order to let user recoed more about the items saved, it  also enable commentation for every item.
; Pause Key to hide or show window. The page and catalogy to save is unlimited.
;You can add, delete or modify the name of catalogy, clear whole page items.
;When user close the window by cliking the top-right X symbol, the program will save all the data into the spesified file.
; the next user start this program, all data will be restored.
;In future the search feature may be added in.
;Author: Gear  2007-2-9

#include <GUIConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <Math.au3>
#Include <GuiCombo.au3>
$Paused = 0;control toggle the window hide or show
HotKeySet("{PAUSE}", "TogglePause")
$HowManyInput = 20;every page will display $HowManyInput items
;$HowManyPages = 20;you can scroll 100 pages of the file or URL or folder name for quick open
;$TotalAddress = $HowManyInput * $HowManyPages
$TheFolderStoreAllInfo = "C:\QuickOpenIndexFolder"
$TheFileSaveInfo = $TheFolderStoreAllInfo & "\IndexFull.txt"

$IfExist0 = FileExists($TheFolderStoreAllInfo)
$IfExist1 = FileExists($TheFileSaveInfo)
Dim $Catalogy[1] = [0];save the catalogy name list
If $IfExist0 And $IfExist1 Then
    Dim $FullPath
    $IfRead = _FileReadToArray($TheFileSaveInfo, $FullPath)
    If $IfRead == 0 Then
        MsgBox(1, "", "fail to read the indexfile.")
        Exit
    Else
        _ArrayDelete($FullPath, 0)
        Dim $PurePath[UBound($FullPath) ], $ItemComment[UBound($FullPath) ]
        For $i = 0 To UBound($FullPath) - 1
            $PureNameLocation = StringInStr($FullPath[$i], "||", 0, 1)
            $ItemCommentLocation = StringInStr($FullPath[$i], "||", 0, 2)
            If $PureNameLocation > 0 Then $PurePath[$i] = StringMid($FullPath[$i], $PureNameLocation + 2, ($ItemCommentLocation - 1) - ($PureNameLocation + 1))
            If $ItemCommentLocation > 0 Then $ItemComment[$i] = StringMid($FullPath[$i], $ItemCommentLocation + 2)
            If StringInStr($FullPath[$i], "#CataloyName#") > 0 Then;this is the catalogy name
                _ArrayAdd($Catalogy, StringMid($FullPath[$i], 14))
                $Catalogy[0] = $Catalogy[0] + 1
            EndIf
        Next
        
    EndIf
Else
    DirCreate($TheFolderStoreAllInfo)
    Dim $FullPath[1], $PurePath[1], $ItemComment[1]
EndIf

$Addresstop = 10
$Height = 20

$TotalHeight = 30 + $HowManyInput * 20 + 10 + 20
$RunButtonwidth = 55
$AddressLen = 300
$CommentLeft = 5
$CommentButtonwidth = $RunButtonwidth / 3
$Addressleft = 5 + $CommentLeft + $CommentButtonwidth

$TotalLen = 365 + $CommentLeft + $CommentButtonwidth + 15

$NextButtonWidth = $RunButtonwidth * 2
$PreviousButtonLeft = $CommentLeft + $NextButtonWidth + 5
$CatalogyComboLeft = $PreviousButtonLeft + $NextButtonWidth + 5
$CatalogyComboWidth = $RunButtonwidth * 3

$AddPageLeft = $CommentLeft
$ClearPageLeft = $CommentLeft + $NextButtonWidth + 5
$AddCatalogyLeft = $ClearPageLeft + $NextButtonWidth + 5
$AddCatalogyButtonWidth = $NextButtonWidth / 2 - 3

Dim $Addresstop[$HowManyInput + 1] = [$HowManyInput], $RunButtontop[$HowManyInput + 1] = [$HowManyInput], $Address[$HowManyInput + 1] = [$HowManyInput], $RunButton[$HowManyInput + 1] = [$HowManyInput], $CommentButton[$HowManyInput + 1] = [$HowManyInput]
Dim $CommentButtontop[$HowManyInput + 1] = [$HowManyInput]
$Addresstop[0] = 10
$IntervalDistance = $Addresstop[0] * 2
$NextOrPreviousClickedTimes = 0;record how many times these two button(Next and Previous buttons) are clicked


GUICreate("Quick Open Lists", $TotalLen, $TotalHeight, @DesktopWidth / 3, @DesktopHeight / 8, -1, 0x00000018)
For $i = 1 To $HowManyInput
    If $i = 1 Then
        $Addresstop[$i] = $Addresstop[0]
    Else
        $Addresstop[$i] = $Addresstop[0] + $IntervalDistance* ($i - 1)
    EndIf
    $CommentButtontop[$i] = $Addresstop[$i]
    $CommentButton[$i] = GUICtrlCreateButton("C", $CommentLeft, $CommentButtontop[$i], $CommentButtonwidth, $Height)
    $Address[$i] = GUICtrlCreateInput("", $Addressleft, $Addresstop[$i], $AddressLen, $Height)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    If $NextOrPreviousClickedTimes > 0 Then
        GUICtrlSetData(-1, $PurePath[$i])
    Else
    EndIf
    
    
    $RunButtontop[$i] = $Addresstop[$i]
    $RunButton[$i] = GUICtrlCreateButton("Run", $AddressLen + $Addressleft + 1, $RunButtontop[$i], $RunButtonwidth, $Height)
Next


$NextButtontop = $Addresstop[1] + $IntervalDistance* ($i) - $IntervalDistance + 5
$NextButton = GUICtrlCreateButton("Next", $CommentLeft, $NextButtontop, $NextButtonWidth, $Height)
$PreviousButton = GUICtrlCreateButton("Previous", $PreviousButtonLeft, $NextButtontop, $NextButtonWidth, $Height)


$CatalogyCombo = GUICtrlCreateCombo("", $CatalogyComboLeft, $NextButtontop, $CatalogyComboWidth, $Height)
If UBound($Catalogy) > 1 Then;when there are catalogy list, dispaly it
    $CatalogyList = _ArrayToString($Catalogy, "|", 1)
    GUICtrlSetData(-1, $CatalogyList, $Catalogy[1])
    $CurrentCatalogy = $Catalogy[1];the current catalogy name dispalyed
    $StartDisplayPosition = 0;this is the catalogy name's position
    RefleshPage()
Else
    While 1;must input a new catalogy name if there is no one
        $FirstCatalogy = InputBox("Creata new catalogy", "Please enter your first catalogy name:", "My Collection")
        If StringLen($FirstCatalogy) > 0 Then
            $FullPath[0] = "#CataloyName#" & $FirstCatalogy
            GUICtrlSetData($CatalogyCombo, $FirstCatalogy, $FirstCatalogy)
            _ArrayAdd($Catalogy, $FirstCatalogy)
            $Catalogy[0] = $Catalogy[0] + 1
            For $i = 1 To $HowManyInput
                _ArrayAdd($FullPath, "")
                _ArrayAdd($PurePath, "")
                _ArrayAdd($ItemComment, "")
            Next
            $StartDisplayPosition = 0;this is the catalogy name's position
            $CurrentCatalogy = $FirstCatalogy
            RefleshPage()
            ExitLoop
        EndIf
    WEnd
EndIf

$AddPageButtonTop = $NextButtontop + $Height + 5
$AddPageButton = GUICtrlCreateButton("Add_Pg", $CommentLeft, $AddPageButtonTop, $NextButtonWidth, $Height)
$ClearPageButton = GUICtrlCreateButton("Clear_Pg", $ClearPageLeft, $AddPageButtonTop, $NextButtonWidth, $Height)




$AddCatalogyButton = GUICtrlCreateButton("Add", $AddCatalogyLeft, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)
$ChangeCatalogyButton = GUICtrlCreateButton("Change", $AddCatalogyLeft + $AddCatalogyButtonWidth + 5, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)
$DeleteCatalogyButton = GUICtrlCreateButton("Delete", ($AddCatalogyLeft + $AddCatalogyButtonWidth + 5) + $AddCatalogyButtonWidth + 5, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)

GUISetState()
$IndexWin = WinGetTitle("")

$msg = 0
While 1
    $msg = GUIGetMsg()
    For $i = 1 To $HowManyInput
        $InputName = GUICtrlRead($Address[$i])
        $result1 = StringInStr($InputName, "\", 0, -1);if it is a new name then replace or add this new name to $FullPath[] array
        $result2 = StringInStr($InputName, "http", 0, -1) - 1
        $result3 = StringInStr($InputName, "www", 0, -1) - 1
        If $result1 > 0 Or $result2 > 0 Or $result3 > 0 Then
            $FullPath[$StartDisplayPosition + $i] = $InputName
            If $result1 > 0 Then $result = $result1
            If $result2 > 0 Then $result = $result2
            If $result3 > 0 Then $result = $result3
            $PurePath[$StartDisplayPosition + $i] = StringMid($InputName, $result + 1)
            $FullPath[$StartDisplayPosition + $i] = $FullPath[$StartDisplayPosition + $i] & "||" & $PurePath[$StartDisplayPosition + $i]
            GUICtrlSetData($Address[$i], $PurePath[$StartDisplayPosition + $i])
        EndIf
        
    Next
    $RunButtonLocation = _ArraySearch($RunButton, $msg); find whivh run button is clicked
;$CursorLocationArray=GUIGetCursorInfo ("")
;If IsArray($CursorLocationArray) Then $CursorLocationID=$CursorLocationArray[4]
;If $CursorLocationID<>0 Then GUICtrlSetTip ($CursorLocationID, "------------------------------")
    $CommentButtonLocation = _ArraySearch($CommentButton, $msg)
    
    
    
    
    
    Select
        Case $msg = $GUI_EVENT_CLOSE;save all the data to the specified TXT file within the specified folder.
            WinSetState($IndexWin, "", @SW_HIDE)
            $IfWrite = _FileWriteFromArray($TheFileSaveInfo, $FullPath)
            If $IfWrite <> 1 Then MsgBox(1, "", "Fail to write the exsiting data into file.")
            ExitLoop
        Case $msg = $NextButton
            $NextPosition = $StartDisplayPosition + $HowManyInput + 1
            If $NextPosition >= UBound($FullPath) Or StringMid($FullPath[$NextPosition], 1, 13) == "#CataloyName#" Then
                GUICtrlSetState($NextButton, $GUI_DISABLE);stop enabling the next page state
            Else
                $StartDisplayPosition = $NextPosition - 1
                GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                RefleshPage()
            EndIf
            
            
        Case $msg = $PreviousButton
            If Not (StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition], 14) == $CurrentCatalogy) Then
                $PreviousPosition = $StartDisplayPosition - $HowManyInput
                Select
                    Case $PreviousPosition > 0 And StringMid($FullPath[$PreviousPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$PreviousPosition], 14) <> $CurrentCatalogy
                        GUICtrlSetState($PreviousButton, $GUI_DISABLE);stop enabling the next page state
                    Case $PreviousPosition >= 0 And StringMid($FullPath[$PreviousPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$PreviousPosition], 14) == $CurrentCatalogy
                        $StartDisplayPosition = $PreviousPosition
                        GUICtrlSetState($NextButton, $GUI_ENABLE)
                        RefleshPage()
                    Case $PreviousPosition > 0 And StringMid($FullPath[$PreviousPosition], 1, 13) <> "#CataloyName#"
                        $StartDisplayPosition = $PreviousPosition
                        GUICtrlSetState($NextButton, $GUI_ENABLE)
                        RefleshPage()
                    Case $PreviousPosition < 0
                        GUICtrlSetState($PreviousButton, $GUI_DISABLE)
                EndSelect
            Else
                GUICtrlSetState($PreviousButton, $GUI_DISABLE)
            EndIf
            
            
            
            
        Case $CommentButtonLocation <> -1 And StringLen($FullPath[$StartDisplayPosition + $CommentButtonLocation]) <> 0;check if the mouse click on the Comment button and if the content of this Input box is empty
            WinSetState($IndexWin, "", @SW_HIDE)
            $MyComment = InputBox("Comment", "Please input your comment for this item:", $ItemComment[$StartDisplayPosition + $CommentButtonLocation])
            If $MyComment <> "" Then $ItemComment[$StartDisplayPosition + $CommentButtonLocation] = $MyComment
            WinSetState($IndexWin, "", @SW_SHOW)
            
            $CommentRemoveLocation = StringInStr($FullPath[$StartDisplayPosition + $CommentButtonLocation], "||", 0, 2)
            If $CommentRemoveLocation > 0 Then
                $OriginalFullName = StringMid($FullPath[$StartDisplayPosition + $CommentButtonLocation], 1, $CommentRemoveLocation)
            Else
                $OriginalFullName = $FullPath[$StartDisplayPosition + $CommentButtonLocation]
            EndIf
            
            If StringLen($MyComment) > 0 Then $FullPath[$StartDisplayPosition + $CommentButtonLocation] = $OriginalFullName & "||" & $MyComment
            
        Case $RunButtonLocation <> -1 And StringLen($FullPath[$StartDisplayPosition + $RunButtonLocation]) <> 0
            $PureNameLocation = StringInStr($FullPath[$StartDisplayPosition + $RunButtonLocation], "||", 0, 1)
            $FullExcuteName = StringMid($FullPath[$StartDisplayPosition + $RunButtonLocation], 1, $PureNameLocation - 1)
            WinSetState($IndexWin, "", @SW_HIDE)
            ShellExecute($FullExcuteName)
            
            
        Case $msg = $AddCatalogyButton
            While 1;check if the name has been existing
                WinSetState($IndexWin, "", @SW_HIDE)
                $NewCatalogy = InputBox("Add New Catalogy", "Please input the new catalogy name:")
                WinSetState($IndexWin, "", @SW_SHOW)
                If _ArraySearch($Catalogy, $NewCatalogy) == -1 Then
                    ExitLoop
                Else
                    WinSetState($IndexWin, "", @SW_HIDE)
                    MsgBox(1, "", "The name is existing, please enter a new one.")
                    WinSetState($IndexWin, "", @SW_SHOW)
                EndIf
            WEnd
            If $NewCatalogy <> "" Then;olny accept the unblank name
                _ArrayAdd($Catalogy, $NewCatalogy)
                $CatalogyList = _ArrayToString($Catalogy, "|", 1)
                GUICtrlSetData($CatalogyCombo, "|" & $CatalogyList, $NewCatalogy)
                _ArrayAdd($FullPath, "#CataloyName#" & $NewCatalogy)
                ReDim $FullPath[UBound($FullPath) + $HowManyInput];add a new blank page to the $FullPath array
                ReDim $PurePath[UBound($FullPath) + $HowManyInput]
                ReDim $ItemComment[UBound($FullPath) + $HowManyInput]
                $StartDisplayPosition = UBound($FullPath) - $HowManyInput - 1
                $CurrentCatalogy = $NewCatalogy
                RefleshPage();flesh the page content to the new page
            EndIf
        Case $msg = $AddPageButton
            $IfBlank = 0
            For $i = 1 To $HowManyInput;check if this is ablank page, if it is, then remind user to use this page
                $InputName = GUICtrlRead($Address[$i])
                If StringLen($InputName) > 0 Then
                    $IfBlank = 1
                    ExitLoop
                EndIf
            Next
            
            
            If $IfBlank == 1 Then;only this page has certain meaningful info then user can user a new page
                For $i = 1 To $HowManyInput
                    _ArrayInsert($FullPath, $StartDisplayPosition + $HowManyInput + $i, "")
                    _ArrayInsert($PurePath, $StartDisplayPosition + $HowManyInput + $i, "")
                    _ArrayInsert($ItemComment, $StartDisplayPosition + $HowManyInput + $i, "")
                Next
                $StartDisplayPosition = $StartDisplayPosition + $HowManyInput
                GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                RefleshPage()
            Else
                WinSetState($IndexWin, "", @SW_HIDE)
                MsgBox(1, "", "This a blank page,please use this page.")
                WinSetState($IndexWin, "", @SW_SHOW)
            EndIf
        Case $msg = $CatalogyCombo
            $FreshCatalogyName = GUICtrlRead($CatalogyCombo)
            If $CurrentCatalogy <> $FreshCatalogyName Then;a new catalogy name is selected or added
                $IfFoundCat = _ArraySearch($FullPath, "#CataloyName#" & $FreshCatalogyName, 0, 0, 0, False);only $FullPath includes the catalogy name
                If $IfFoundCat <> -1 Then
                    $StartDisplayPosition = $IfFoundCat
                    $CurrentCatalogy = $FreshCatalogyName
                    GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                    GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                    RefleshPage()
                Else
                    MsgBox(1, "", "This catalogy cannot be found in database.")
                EndIf
            EndIf
            
        Case $msg = $ChangeCatalogyButton;try to change the name of the current catalogy name
            $InputName = GUICtrlRead($CatalogyCombo)
            WinSetState($IndexWin, "", @SW_HIDE)
            $NewName = InputBox("Change Name", "Please enter a new name for current catalogy:", $InputName)
            WinSetState($IndexWin, "", @SW_SHOW)
            If $NewName <> "" Then
                $SearchStart = 0
                While 1
                    
                    $Location = _ArraySearch($FullPath, "#CataloyName#" & $InputName, $SearchStart, 0, 0, False)
                    If $Location <> -1 Then
                        $FullPath[$Location] = "#CataloyName#" & $NewName
                        $SearchStart = $Location
                    Else
                        ExitLoop;all current catalogy name in FuullPath have been replaced by $newname
                    EndIf
                WEnd
                $iIndex = _ArraySearch($Catalogy, $InputName)
                $Catalogy[$iIndex] = $NewName
                $CurrentCatalogy = $NewName
                GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $NewName);destroy the previous combo list and flesh with the new list
            EndIf
            RefleshPage()
        Case $msg = $DeleteCatalogyButton; try to delete this catalogy and all the items within it
            #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Default Button=Second, Icon=Critical
            If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
            WinSetState($IndexWin, "", @SW_HIDE)
            $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! All the items within this catalogy will be delete!")
            WinSetState($IndexWin, "", @SW_SHOW)
            Select
                Case $iMsgBoxAnswer = 6;yes
                    WinSetState($IndexWin, "", @SW_HIDE)
                    $IfOK = MsgBox(1, "Confirmation", "Are you really want to delete this catalogy? All the items within it will be deleted.")
                    WinSetState($IndexWin, "", @SW_SHOW)
                    If $IfOK == 1 Then;all the items will be delelted.
                        $InputName = GUICtrlRead($CatalogyCombo)
                        $Location = _ArraySearch($FullPath, "#CataloyName#" & $InputName, 0, 0, 0, False)
                        _ArrayDelete($FullPath, $Location)
                        While 1
                            If StringMid($FullPath[$Location], 1, 13) == "#CataloyName#" Then ExitLoop
                            If $Location == UBound($FullPath) - 1 Then
                                _ArrayDelete($FullPath, $Location)
                                ExitLoop
                            Else
                                _ArrayDelete($FullPath, $Location)
                                _ArrayDelete($PurePath, $Location)
                                _ArrayDelete($ItemComment, $Location)
                            EndIf
                        WEnd
                    EndIf
                    _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                    GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                    $StartDisplayPosition = 0
                    $CurrentCatalogy = $Catalogy[1]
                    GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                    GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                    RefleshPage()
                Case $iMsgBoxAnswer = 7;No
            EndSelect
            #EndRegion --- CodeWizard generated code End ---
        Case $msg = $ClearPageButton ;try to delete all the items in this page
            WinSetState($IndexWin, "", @SW_HIDE)
            $iMsgBoxAnswer = MsgBox(4, "Page Delete", "Attention! All the items within this page will be delete!")
            WinSetState($IndexWin, "", @SW_SHOW)
            If $iMsgBoxAnswer = 6 Then
                For $i = 1 To $HowManyInput
                    _ArrayDelete($FullPath, $StartDisplayPosition + 1)
                    _ArrayDelete($PurePath, $StartDisplayPosition + 1)
                    _ArrayDelete($ItemComment, $StartDisplayPosition + 1)
                Next
                
                If $StartDisplayPosition + 1 < UBound($FullPath) Then
                    If StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition + 1], 1, 13) == "#CataloyName#" Then; the next catalogy will appear
                        WinSetState($IndexWin, "", @SW_HIDE)
                        $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! This catalogy is empty, do you want to delete this catalogy at the same time?")
                        WinSetState($IndexWin, "", @SW_SHOW)
                        Select
                            Case $iMsgBoxAnswer = 6;Yes
                                _ArrayDelete($FullPath, $StartDisplayPosition)
                                _ArrayDelete($PurePath, $StartDisplayPosition)
                                _ArrayDelete($ItemComment, $StartDisplayPosition)
                                $InputName = GUICtrlRead($CatalogyCombo)
                                $Ifgood = _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                                GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                                $CurrentCatalogy = $Catalogy[1]
                                $StartDisplayPosition = 0
                            Case $iMsgBoxAnswer = 7;NO
                                For $i = 1 To $HowManyInput;insert a new blank page fot this catalogy
                                    _ArrayInsert($FullPath, $StartDisplayPosition + $i, "")
                                    _ArrayInsert($PurePath, $StartDisplayPosition + $i, "")
                                    _ArrayInsert($ItemComment, $StartDisplayPosition + $i, "")
                                Next
                        EndSelect
                    EndIf
                    If StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition + 1], 1, 13) <> "#CataloyName#" Then
                        $StartDisplayPosition = $StartDisplayPosition
                    EndIf;the first page of this catalogy is cleared, then display its original second page of this catatlogy
                Else ;the end of FullPath array appears
                    Select
                        Case StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#"
                            WinSetState($IndexWin, "", @SW_HIDE)
                            $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! This catalogy is empty, do you want to delete this catalogy at the same time?")
                            WinSetState($IndexWin, "", @SW_SHOW)
                            Select
                                Case $iMsgBoxAnswer = 6;OK
                                    _ArrayDelete($FullPath, $StartDisplayPosition)
                                    _ArrayDelete($PurePath, $StartDisplayPosition)
                                    _ArrayDelete($ItemComment, $StartDisplayPosition)
                                    $InputName = GUICtrlRead($CatalogyCombo)
                                    _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                                    GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                                    $CurrentCatalogy = $Catalogy[1]
                                    $StartDisplayPosition = 0
                                Case $iMsgBoxAnswer = 7;NO
                                    For $i = 1 To $HowManyInput;insert a new blank page fot this catalogy
                                        _ArrayInsert($FullPath, $StartDisplayPosition + $i, "")
                                        _ArrayInsert($PurePath, $StartDisplayPosition + $i, "")
                                        _ArrayInsert($ItemComment, $StartDisplayPosition + $i, "")
                                    Next
                            EndSelect
                        Case StringMid($FullPath[$StartDisplayPosition], 1, 13) <> "#CataloyName#";the last page of this catalogy is cleared, then display its original previous page
                            $StartDisplayPosition = $StartDisplayPosition - $HowManyInput
                    EndSelect
                EndIf
            EndIf
            RefleshPage()
    EndSelect
    Sleep(20)
WEnd



;hide or show the window by PAUSE
Func TogglePause()
    Sleep(50)
    If $Paused == 0 Then;toggle the hide or show
        GUISetState(@SW_SHOW, $IndexWin)
        $TimeToHideWindow = 0;donot let the window hide when you show it.
        $Paused = $Paused + 1
    Else
        GUISetState(@SW_HIDE, $IndexWin)
        $Paused = $Paused - 1
    EndIf
    
EndFunc  ;==>TogglePause


Func RefleshPage()
    For $i = 1 To $HowManyInput
        $PureName = $PurePath[$StartDisplayPosition + $i]
        GUICtrlSetData($Address[$i], $PureName)
    Next
EndFunc  ;==>RefleshPage

Share this post


Link to post
Share on other sites

Hmm, first of all, i use a laptop for work.. my PAUSE key can only be used if i press the "function" key at the same time.. so it makes the window show / hide which is all good.

Not a bad idea actually.. though, it took me a second to work it out...

first attempt was to add the dir "c:\temp\" i use it a lot.. but, i started typing and the script instantly acepted input when i hit "\" seemed that i couldnt actually go any further than that..

if i drag and drop (which is a great idea, it was my next train of thought over direct input) then it all works fine..

seems like a great concept, not something i would personally use (my list of apps fits just fine in a quick launch), however i can see a lot of people wanting something like this.

all in all, great work !!

ps: perhapsn it could have gone in the examples section.. as it seems complete.. or is there something not quite right you wanted help with?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

In the future you should probably edit your post if you update :whistle: It makes the post ALOT shorter :)

EDIT: Just like i did mine.. :lol:

Edited by bert

Share this post


Link to post
Share on other sites

This is the Version1.03, it is not easy to compose this program, I need more to think and improve this program. It is easy to hide many error in your program and you need time to expose them. I am sorry I cannot konw how edit my post, so so far you must scroll up and wown this long post. :whistle:

Gear

;Thsi program can quickly open the file or folder, a webpage, website or a program.
;In order to let user recoed more about the items saved, it  also enable commentation for every item.
; Pause Key to hide or show window. The page and catalogy to save is unlimited.
;You can add, delete or modify the name of catalogy, clear whole page items.
;User can drag and drop the file and folder name into the input area. or user can save other info into input area. the size of these info in unlimited

;When user close the window by cliking the top-right X symbol, the program will save all the data into the spesified file.
; the next user start this program, all data will be restored.
;In future the search feature may be added in; user may be able to rearrange how many items in a single pages
;user may be able to quickly copy info into the input area.
;Author: Gear  2007-2-9
;Version: 1.03
#include <GUIConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <Math.au3>
#Include <GuiCombo.au3>
$Paused = 0;control toggle the window hide or show
HotKeySet("{PAUSE}", "TogglePause")
$HowManyInput = 20;every page will display $HowManyInput items
$TheFolderStoreAllInfo = "C:\QuickOpenIndexFolder"
$TheFileSaveInfo = $TheFolderStoreAllInfo & "\IndexFull.txt"

$IfExist0 = FileExists($TheFolderStoreAllInfo)
$IfExist1 = FileExists($TheFileSaveInfo)
Dim $Catalogy[1] = [0];save the catalogy name list
If $IfExist0 And $IfExist1 Then
    Dim $FullPath
    $IfRead = _FileReadToArray($TheFileSaveInfo, $FullPath)
    If $IfRead == 0 Then
        MsgBox(1, "", "fail to read the indexfile.")
        Exit
    Else
        _ArrayDelete($FullPath, 0)
        Dim $PurePath[UBound($FullPath) ], $ItemComment[UBound($FullPath) ]
        For $i = 0 To UBound($FullPath) - 1
            $PureNameLocation = StringInStr($FullPath[$i], "||", 0, 1)
            $ItemCommentLocation = StringInStr($FullPath[$i], "||", 0, 2)
            If $PureNameLocation > 0 Then $PurePath[$i] = StringMid($FullPath[$i], $PureNameLocation + 2, ($ItemCommentLocation - 1) - ($PureNameLocation + 1))
            If $ItemCommentLocation > 0 Then $ItemComment[$i] = StringMid($FullPath[$i], $ItemCommentLocation + 2)
            If StringInStr($FullPath[$i], "#CataloyName#") > 0 Then;this is the catalogy name
                _ArrayAdd($Catalogy, StringMid($FullPath[$i], 14))
                $Catalogy[0] = $Catalogy[0] + 1
            EndIf
        Next
        
    EndIf
Else
    DirCreate($TheFolderStoreAllInfo)
    Dim $FullPath[1], $PurePath[1], $ItemComment[1]
EndIf

$Addresstop = 10
$Height = 20

$TotalHeight = 30 + $HowManyInput * 20 + 10 + 20
$RunButtonwidth = 55
$AddressLen = 300
$CommentLeft = 5
$CommentButtonwidth = $RunButtonwidth / 3
$Addressleft = 5 + $CommentLeft + $CommentButtonwidth

$TotalLen = 365 + $CommentLeft + $CommentButtonwidth + 15

$NextButtonWidth = $RunButtonwidth * 2
$PreviousButtonLeft = $CommentLeft + $NextButtonWidth + 5
$CatalogyComboLeft = $PreviousButtonLeft + $NextButtonWidth + 5
$CatalogyComboWidth = $RunButtonwidth * 3

$AddPageLeft = $CommentLeft
$ClearPageLeft = $CommentLeft + $NextButtonWidth + 5
$AddCatalogyLeft = $ClearPageLeft + $NextButtonWidth + 5
$AddCatalogyButtonWidth = $NextButtonWidth / 2 - 3

Dim $Addresstop[$HowManyInput + 1] = [$HowManyInput], $RunButtontop[$HowManyInput + 1] = [$HowManyInput], $Address[$HowManyInput + 1] = [$HowManyInput], $RunButton[$HowManyInput + 1] = [$HowManyInput], $CommentButton[$HowManyInput + 1] = [$HowManyInput]
Dim $CommentButtontop[$HowManyInput + 1] = [$HowManyInput]
$Addresstop[0] = 10
$IntervalDistance = $Addresstop[0] * 2
$NextOrPreviousClickedTimes = 0;record how many times these two button(Next and Previous buttons) are clicked


GUICreate("Quick Access Lists", $TotalLen, $TotalHeight, @DesktopWidth / 3, @DesktopHeight / 8, -1, 0x00000018)
For $i = 1 To $HowManyInput
    If $i = 1 Then
        $Addresstop[$i] = $Addresstop[0]
    Else
        $Addresstop[$i] = $Addresstop[0] + $IntervalDistance* ($i - 1)
    EndIf
    $CommentButtontop[$i] = $Addresstop[$i]
    $CommentButton[$i] = GUICtrlCreateButton("C", $CommentLeft, $CommentButtontop[$i], $CommentButtonwidth, $Height)
    $Address[$i] = GUICtrlCreateInput("", $Addressleft, $Addresstop[$i], $AddressLen, $Height,$ES_AUTOHSCROLL); user can input long text here
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    If $NextOrPreviousClickedTimes > 0 Then
        GUICtrlSetData(-1, $PurePath[$i])
    Else
    EndIf
    
    
    $RunButtontop[$i] = $Addresstop[$i]
    $RunButton[$i] = GUICtrlCreateButton("Run", $AddressLen + $Addressleft + 1, $RunButtontop[$i], $RunButtonwidth, $Height)
Next


$NextButtontop = $Addresstop[1] + $IntervalDistance* ($i) - $IntervalDistance + 5
$NextButton = GUICtrlCreateButton("Next", $CommentLeft, $NextButtontop, $NextButtonWidth, $Height)
$PreviousButton = GUICtrlCreateButton("Previous", $PreviousButtonLeft, $NextButtontop, $NextButtonWidth, $Height)


$CatalogyCombo = GUICtrlCreateCombo("", $CatalogyComboLeft, $NextButtontop, $CatalogyComboWidth, $Height)
If UBound($Catalogy) > 1 Then;when there are catalogy list, dispaly it
    $CatalogyList = _ArrayToString($Catalogy, "|", 1)
    GUICtrlSetData(-1, $CatalogyList, $Catalogy[1])
    $CurrentCatalogy = $Catalogy[1];the current catalogy name dispalyed
    $StartDisplayPosition = 0;this is the catalogy name's position
    RefleshPage()
Else
    While 1;must input a new catalogy name if there is no one
        $FirstCatalogy = InputBox("Creata new catalogy", "Please enter your first catalogy name:", "My Collection")
        If StringLen($FirstCatalogy) > 0 Then
            $FullPath[0] = "#CataloyName#" & $FirstCatalogy
            GUICtrlSetData($CatalogyCombo, $FirstCatalogy, $FirstCatalogy)
            _ArrayAdd($Catalogy, $FirstCatalogy)
            $Catalogy[0] = $Catalogy[0] + 1
            For $i = 1 To $HowManyInput
                _ArrayAdd($FullPath, "")
                _ArrayAdd($PurePath, "")
                _ArrayAdd($ItemComment, "")
            Next
            $StartDisplayPosition = 0;this is the catalogy name's position
            $CurrentCatalogy = $FirstCatalogy
            RefleshPage()
            ExitLoop
        EndIf
    WEnd
EndIf

$AddPageButtonTop = $NextButtontop + $Height + 5
$AddPageButton = GUICtrlCreateButton("Add_Pg", $CommentLeft, $AddPageButtonTop, $NextButtonWidth, $Height)
$ClearPageButton = GUICtrlCreateButton("Clear_Pg", $ClearPageLeft, $AddPageButtonTop, $NextButtonWidth, $Height)




$AddCatalogyButton = GUICtrlCreateButton("Add", $AddCatalogyLeft, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)
$ChangeCatalogyButton = GUICtrlCreateButton("Change", $AddCatalogyLeft + $AddCatalogyButtonWidth + 5, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)
$DeleteCatalogyButton = GUICtrlCreateButton("Delete", ($AddCatalogyLeft + $AddCatalogyButtonWidth + 5) + $AddCatalogyButtonWidth + 5, $AddPageButtonTop, $AddCatalogyButtonWidth, $Height)

GUISetState()
$IndexWin = WinGetTitle("")

$msg = 0
While 1
    $msg = GUIGetMsg()
    For $i = 1 To $HowManyInput
        $InputName = GUICtrlRead($Address[$i])
        $result = StringInStr($InputName, "\", 0, -1);if it is a new name then replace or add this new name to $FullPath[] array
        If $PurePath[$StartDisplayPosition + $i] <> $InputName Then;only update the new data both in array and display
            $FullPath[$StartDisplayPosition + $i] = $InputName
            $PurePath[$StartDisplayPosition + $i] = StringMid($InputName, $result + 1)
            $FullPath[$StartDisplayPosition + $i] = $FullPath[$StartDisplayPosition + $i] & "||" & $PurePath[$StartDisplayPosition + $i]
            GUICtrlSetData($Address[$i], $PurePath[$StartDisplayPosition + $i])
        EndIf
    Next
; find which run button is clicked
;$CursorLocationArray=GUIGetCursorInfo ("")
;If IsArray($CursorLocationArray) Then $CursorLocationID=$CursorLocationArray[4]
;If $CursorLocationID<>0 Then GUICtrlSetTip ($CursorLocationID, "------------------------------")
    
    $RunButtonLocation = _ArraySearch($RunButton, $msg, 1); find which run button is clicked
    $CommentButtonLocation = _ArraySearch($CommentButton, $msg, 1); the search must be from 1, otherwise one button cannot work, foe the button ID is the same as the array's 0 content so the answer will be 0
    Select
        Case $msg = $GUI_EVENT_CLOSE;save all the data to the specified TXT file within the specified folder.
            WinSetState($IndexWin, "", @SW_HIDE)
            $IfWrite = _FileWriteFromArray($TheFileSaveInfo, $FullPath)
            If $IfWrite <> 1 Then MsgBox(1, "", "Fail to write the exsiting data into file.")
            ExitLoop
        Case $msg = $NextButton
            $NextPosition = $StartDisplayPosition + $HowManyInput + 1
            If $NextPosition >= UBound($FullPath) Or StringMid($FullPath[$NextPosition], 1, 13) == "#CataloyName#" Then
                GUICtrlSetState($NextButton, $GUI_DISABLE);stop enabling the next page state
            Else
                $StartDisplayPosition = $NextPosition - 1
                GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                RefleshPage()
            EndIf
            
            
        Case $msg = $PreviousButton
            If Not (StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition], 14) == $CurrentCatalogy) Then
                $PreviousPosition = $StartDisplayPosition - $HowManyInput
                Select
                    Case $PreviousPosition > 0 And StringMid($FullPath[$PreviousPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$PreviousPosition], 14) <> $CurrentCatalogy
                        GUICtrlSetState($PreviousButton, $GUI_DISABLE);stop enabling the next page state
                    Case $PreviousPosition >= 0 And StringMid($FullPath[$PreviousPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$PreviousPosition], 14) == $CurrentCatalogy
                        $StartDisplayPosition = $PreviousPosition
                        GUICtrlSetState($NextButton, $GUI_ENABLE)
                        RefleshPage()
                    Case $PreviousPosition > 0 And StringMid($FullPath[$PreviousPosition], 1, 13) <> "#CataloyName#"
                        $StartDisplayPosition = $PreviousPosition
                        GUICtrlSetState($NextButton, $GUI_ENABLE)
                        RefleshPage()
                    Case $PreviousPosition < 0
                        GUICtrlSetState($PreviousButton, $GUI_DISABLE)
                EndSelect
            Else
                GUICtrlSetState($PreviousButton, $GUI_DISABLE)
            EndIf
            
            
            
        Case $CommentButtonLocation <> -1 And StringLen($PurePath[$CommentButtonLocation]) <> 0;the buuton is found and the content in the inputbox must be not empty
            WinSetState($IndexWin, "", @SW_HIDE)
            $MyComment = InputBox("Comment", "Please input your comment for this item:", $ItemComment[$StartDisplayPosition + $CommentButtonLocation])
            WinSetState($IndexWin, "", @SW_SHOW)
            If StringLen($MyComment) > 0 Then
                $ItemComment[$StartDisplayPosition + $CommentButtonLocation] = $MyComment
                $CommentRemoveLocation = StringInStr($FullPath[$StartDisplayPosition + $CommentButtonLocation], "||", 0, 2);it is the old comment location now try to replace it with the new comment
                If $CommentRemoveLocation > 0 Then;the comment head is found
                    $OriginalFullName = StringMid($FullPath[$StartDisplayPosition + $CommentButtonLocation], 1, $CommentRemoveLocation); from fiest character to the head of old comment
                Else;before there is no any comment for this address
                    $OriginalFullName = $FullPath[$StartDisplayPosition + $CommentButtonLocation]
                EndIf
                $FullPath[$StartDisplayPosition + $CommentButtonLocation] = $OriginalFullName & "||" & $MyComment;only add or modify with the unblank comment
            EndIf


            
        Case $RunButtonLocation <> -1 And StringLen($PurePath[$RunButtonLocation]) <> 0
            $PureNameLocation = StringInStr($FullPath[$StartDisplayPosition + $RunButtonLocation], "||", 0, 1);try to find the end or the sart of full name in FullPath array list
            $FullExcuteName = StringMid($FullPath[$StartDisplayPosition + $RunButtonLocation], 1, $PureNameLocation - 1)
            WinSetState($IndexWin, "", @SW_HIDE)
            ShellExecute($FullExcuteName)
            



        Case $msg = $AddCatalogyButton
            While 1;check if the name has been existing
                WinSetState($IndexWin, "", @SW_HIDE)
                $NewCatalogy = InputBox("Add New Catalogy", "Please input the new catalogy name:")
                WinSetState($IndexWin, "", @SW_SHOW)
                If _ArraySearch($Catalogy, $NewCatalogy) == -1 Then
                    ExitLoop
                Else
                    WinSetState($IndexWin, "", @SW_HIDE)
                    MsgBox(1, "", "The name is existing, please enter a new one.")
                    WinSetState($IndexWin, "", @SW_SHOW)
                EndIf
            WEnd
            If $NewCatalogy <> "" Then;olny accept the unblank name
                _ArrayAdd($Catalogy, $NewCatalogy)
                $CatalogyList = _ArrayToString($Catalogy, "|", 1)
                GUICtrlSetData($CatalogyCombo, "|" & $CatalogyList, $NewCatalogy)
                _ArrayAdd($FullPath, "#CataloyName#" & $NewCatalogy)
                ReDim $FullPath[UBound($FullPath) + $HowManyInput];add a new blank page to the $FullPath array
                ReDim $PurePath[UBound($FullPath) + $HowManyInput]
                ReDim $ItemComment[UBound($FullPath) + $HowManyInput]
                $StartDisplayPosition = UBound($FullPath) - $HowManyInput - 1
                $CurrentCatalogy = $NewCatalogy
                RefleshPage();flesh the page content to the new page
            EndIf
        Case $msg = $AddPageButton
            $IfBlank = 0
            For $i = 1 To $HowManyInput;check if this is ablank page, if it is, then remind user to use this page
                $InputName = GUICtrlRead($Address[$i])
                If StringLen($InputName) > 0 Then
                    $IfBlank = 1
                    ExitLoop
                EndIf
            Next
            
            
            If $IfBlank == 1 Then;only this page has certain meaningful info then user can user a new page
                For $i = 1 To $HowManyInput
                    _ArrayInsert($FullPath, $StartDisplayPosition + $HowManyInput + $i, "")
                    _ArrayInsert($PurePath, $StartDisplayPosition + $HowManyInput + $i, "")
                    _ArrayInsert($ItemComment, $StartDisplayPosition + $HowManyInput + $i, "")
                Next
                $StartDisplayPosition = $StartDisplayPosition + $HowManyInput
                GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                RefleshPage()
            Else
                WinSetState($IndexWin, "", @SW_HIDE)
                MsgBox(1, "", "This a blank page,please use this page.")
                WinSetState($IndexWin, "", @SW_SHOW)
            EndIf
        Case $msg = $CatalogyCombo
            $FreshCatalogyName = GUICtrlRead($CatalogyCombo)
            If $CurrentCatalogy <> $FreshCatalogyName Then;a new catalogy name is selected or added
                $IfFoundCat = _ArraySearch($FullPath, "#CataloyName#" & $FreshCatalogyName, 0, 0, 0, False);only $FullPath includes the catalogy name
                If $IfFoundCat <> -1 Then
                    $StartDisplayPosition = $IfFoundCat
                    $CurrentCatalogy = $FreshCatalogyName
                    GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                    GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                    RefleshPage()
                Else
                    MsgBox(1, "", "This catalogy cannot be found in database.")
                EndIf
            EndIf
            
        Case $msg = $ChangeCatalogyButton;try to change the name of the current catalogy name
            $InputName = GUICtrlRead($CatalogyCombo)
            WinSetState($IndexWin, "", @SW_HIDE)
            $NewName = InputBox("Change Name", "Please enter a new name for current catalogy:", $InputName)
            WinSetState($IndexWin, "", @SW_SHOW)
            If $NewName <> "" Then
                $SearchStart = 0
                While 1
                    
                    $Location = _ArraySearch($FullPath, "#CataloyName#" & $InputName, $SearchStart, 0, 0, False)
                    If $Location <> -1 Then
                        $FullPath[$Location] = "#CataloyName#" & $NewName
                        $SearchStart = $Location
                    Else
                        ExitLoop;all current catalogy name in FuullPath have been replaced by $newname
                    EndIf
                WEnd
                $iIndex = _ArraySearch($Catalogy, $InputName)
                $Catalogy[$iIndex] = $NewName
                $CurrentCatalogy = $NewName
                GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $NewName);destroy the previous combo list and flesh with the new list
            EndIf
            RefleshPage()
        Case $msg = $DeleteCatalogyButton; try to delete this catalogy and all the items within it
            #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Default Button=Second, Icon=Critical
            If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
            WinSetState($IndexWin, "", @SW_HIDE)
            $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! All the items within this catalogy will be delete!")
            WinSetState($IndexWin, "", @SW_SHOW)
            Select
                Case $iMsgBoxAnswer = 6;yes
                    WinSetState($IndexWin, "", @SW_HIDE)
                    $IfOK = MsgBox(1, "Confirmation", "Are you really want to delete this catalogy? All the items within it will be deleted.")
                    WinSetState($IndexWin, "", @SW_SHOW)
                    If $IfOK == 1 Then;all the items will be delelted.
                        $InputName = GUICtrlRead($CatalogyCombo)
                        $Location = _ArraySearch($FullPath, "#CataloyName#" & $InputName, 0, 0, 0, False)
                        _ArrayDelete($FullPath, $Location)
                        While 1
                            If StringMid($FullPath[$Location], 1, 13) == "#CataloyName#" Then ExitLoop
                            If $Location == UBound($FullPath) - 1 Then
                                _ArrayDelete($FullPath, $Location)
                                ExitLoop
                            Else
                                _ArrayDelete($FullPath, $Location)
                                _ArrayDelete($PurePath, $Location)
                                _ArrayDelete($ItemComment, $Location)
                            EndIf
                        WEnd
                    EndIf
                    _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                    GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                    $StartDisplayPosition = 0
                    $CurrentCatalogy = $Catalogy[1]
                    GUICtrlSetState($NextButton, $GUI_ENABLE);stop enabling the next page state
                    GUICtrlSetState($PreviousButton, $GUI_ENABLE)
                    If UBound($FullPath) > 1 Then RefleshPage();onlt reflesh the display when there is item to display
                    
                    
                Case $iMsgBoxAnswer = 7;No
            EndSelect
            #EndRegion --- CodeWizard generated code End ---
        Case $msg = $ClearPageButton ;try to delete all the items in this page
            WinSetState($IndexWin, "", @SW_HIDE)
            $iMsgBoxAnswer = MsgBox(4, "Page Delete", "Attention! All the items within this page will be delete!")
            WinSetState($IndexWin, "", @SW_SHOW)
            If $iMsgBoxAnswer = 6 Then
                For $i = 1 To $HowManyInput
                    _ArrayDelete($FullPath, $StartDisplayPosition + 1)
                    _ArrayDelete($PurePath, $StartDisplayPosition + 1)
                    _ArrayDelete($ItemComment, $StartDisplayPosition + 1)
                Next
                
                If $StartDisplayPosition + 1 < UBound($FullPath) Then
                    If StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition + 1], 1, 13) == "#CataloyName#" Then; the next catalogy will appear
                        WinSetState($IndexWin, "", @SW_HIDE)
                        $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! This catalogy is empty, do you want to delete this catalogy at the same time?")
                        WinSetState($IndexWin, "", @SW_SHOW)
                        Select
                            Case $iMsgBoxAnswer = 6;Yes
                                _ArrayDelete($FullPath, $StartDisplayPosition)
                                _ArrayDelete($PurePath, $StartDisplayPosition)
                                _ArrayDelete($ItemComment, $StartDisplayPosition)
                                $InputName = GUICtrlRead($CatalogyCombo)
                                $Ifgood = _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                                GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                                $CurrentCatalogy = $Catalogy[1]
                                $StartDisplayPosition = 0
                            Case $iMsgBoxAnswer = 7;NO
                                For $i = 1 To $HowManyInput;insert a new blank page fot this catalogy
                                    _ArrayInsert($FullPath, $StartDisplayPosition + $i, "")
                                    _ArrayInsert($PurePath, $StartDisplayPosition + $i, "")
                                    _ArrayInsert($ItemComment, $StartDisplayPosition + $i, "")
                                Next
                        EndSelect
                    EndIf
                    If StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#" And StringMid($FullPath[$StartDisplayPosition + 1], 1, 13) <> "#CataloyName#" Then
                        $StartDisplayPosition = $StartDisplayPosition
                    EndIf;the first page of this catalogy is cleared, then display its original second page of this catatlogy
                Else ;the end of FullPath array appears
                    Select
                        Case StringMid($FullPath[$StartDisplayPosition], 1, 13) == "#CataloyName#"
                            WinSetState($IndexWin, "", @SW_HIDE)
                            $iMsgBoxAnswer = MsgBox(4, "Catalogy Delete", "Attention! This catalogy is empty, do you want to delete this catalogy at the same time?")
                            WinSetState($IndexWin, "", @SW_SHOW)
                            Select
                                Case $iMsgBoxAnswer = 6;OK
                                    _ArrayDelete($FullPath, $StartDisplayPosition)
                                    _ArrayDelete($PurePath, $StartDisplayPosition)
                                    _ArrayDelete($ItemComment, $StartDisplayPosition)
                                    $InputName = GUICtrlRead($CatalogyCombo)
                                    _ArrayDelete($Catalogy, _ArraySearch($Catalogy, $InputName))
                                    GUICtrlSetData($CatalogyCombo, "|" & _ArrayToString($Catalogy, "|", 1), $Catalogy[1])
                                    $CurrentCatalogy = $Catalogy[1]
                                    $StartDisplayPosition = 0
                                Case $iMsgBoxAnswer = 7;NO
                                    For $i = 1 To $HowManyInput;insert a new blank page fot this catalogy
                                        _ArrayInsert($FullPath, $StartDisplayPosition + $i, "")
                                        _ArrayInsert($PurePath, $StartDisplayPosition + $i, "")
                                        _ArrayInsert($ItemComment, $StartDisplayPosition + $i, "")
                                    Next
                            EndSelect
                        Case StringMid($FullPath[$StartDisplayPosition], 1, 13) <> "#CataloyName#";the last page of this catalogy is cleared, then display its original previous page
                            $StartDisplayPosition = $StartDisplayPosition - $HowManyInput
                    EndSelect
                EndIf
            EndIf
            RefleshPage()
    EndSelect
    Sleep(20)
    $msg = 0
WEnd



;hide or show the window by PAUSE
Func TogglePause()
    Sleep(50)
    If $Paused == 0 Then;toggle the hide or show
        GUISetState(@SW_SHOW, $IndexWin)
        $TimeToHideWindow = 0;donot let the window hide when you show it.
        $Paused = $Paused + 1
    Else
        GUISetState(@SW_HIDE, $IndexWin)
        $Paused = $Paused - 1
    EndIf
    
EndFunc  ;==>TogglePause


Func RefleshPage()
    For $i = 1 To $HowManyInput
        $PureName = $PurePath[$StartDisplayPosition + $i]
        GUICtrlSetData($Address[$i], $PureName)
    Next
EndFunc  ;==>RefleshPage

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  
Followers 0