Jump to content

gear

Active Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by gear

  1. Thanks Jos, without the experienced user's guide, it is hard to master SciTe. By the way, SciTe is a very good editot and I believe it is the best one so far. I know basic knowledge about AutoIt, SciTe Editer for AutoIt is so good that almost no any other editer can compete with it, many computer langauges only have poor editor and the debuging environment is often too hard to achieve efficient development.
  2. It seems so far SciTe cannot change its backgroud color.
  3. SsiTe editor is the best editor I know, i have tried many editors during last year, but it seems SciTe is the perfect one. liwen zhang
  4. I find the SciTEGlobal.properties and change its content, but fail to change the backroud color, I just want a gray color so it is not too bright. the following is the code I change: # Global default styles for all languages # Default style.*.39=$(font.base) # Line number style.*.33=fore:#000000,back:#CDC5BF,$(font.base) # Brace highlight style.*.34=fore:#0000FF,bold # Brace incomplete highlight style.*.35=fore::#009933,bold # White space style.*3.0=fore:#CDC5BF,back:#CDC5BF # Control characters style.*.36= # Indentation guides style.*.37=fore:#C0C0C0,back:#FFFFFF I feel hard to be familar with SciTe's odd setting, please tell me the detail. Thank you very much! Regards, Gear
  5. I use SciTe as a Rebol language editor, How can I change the backgroud color? I cannot find any option item to do so. Regards, Gear
  6. I want to play a short wav file when I click a button, but I donot want to open the default media player to play the file. please tell me how to play a wav file without opening media player? thank you. gear
  7. If there is a program that can search the file names inside RAR file? for example, I copmress 100 files into a single RAR file, later I want to search if a file named 33.txt is in this RAR file. gear
  8. I want to konw if there is a function can detect if the middle button of mouse is wheelled? (not pressed). Gear
  9. 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. 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
  10. 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
  11. 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
  12. The setting for RGB color is strange, like 0x8080ff , how can I know what is the code for white color? Gear
  13. please try Rebol (www.rebol.com), rebol is very fast, it takes my PC 70s to run the same program with rebol, but about 3000s with Autoit3.0. rebol is aslo powerful.. you can try it. the code should be in rebol: print now ss: func [z] [x: 1 loop 100000000 [x: x + 1] ] do ss 1 print now you just need to copy the above code to rebol's console. Rebol is also powerful in many aspects, but I think its grammar is strange, it may be hard to use. but I still believe Autoit has a lot to learn from rebol. Gear
  14. I find Autoi is slow , please try the following short routine: $begin = TimerInit() $i=1 While $i<100000000 $i=$i+1 WEnd $dif = TimerDiff($begin) MsgBox(1,"",$dif)
  15. A program can find and folder in your disks, it can work because the program will search the disks and build the folder name index files and save them in a specified folder. later this program read these indexfiles and then can find any folder included in these files. normally the time to build index files is about 10 minutes, later the search time is as quickly as 1-2 seconds. ;; This program can find the folder quickly. You just need to enter the full or partial name of the folder you want to find ; then it can find it and list the matched folder in the list box, you ;click on the one you want to open, it will open the explorer. ;Pause key can hide or show the GUI window. ; This program is also a example to learn how to manipulate 1-dimension and 2-dimension Array #include <Array.au3> #include <File.au3> #include <GuiList.au3> $IdleTimeToHide = 10000;the time the window will hide after use $MaxFolderDepth = 8;how deep the folder within the disk. $Paused = 0;control toggle the window hide or show $TheFolderToSaveIndexFiles = "E:\FolderIndex\";this is the folder to save all the index files $MaxFolderInOneDisk = 10000;here only can save $MaxFolderInOneDisk folders in one disk, but it is enough normally HotKeySet("{PAUSE}", "TogglePause") #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> GUICreate("Quickly Open Folder", 848, 319, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $OpenFolderTitle = WinGetTitle("");get the GUI window title ;;$OpenFolderTitle=WinGetHandle($OpenFolderTitle); it can not work with the use of winhandle! $FolderNameInput = GUICtrlCreateLabel("The folder you want to find:", 560, 10, 350, 30) $FolderNameToSearch = GUICtrlCreateInput("", 570, 30, 180, 30) GUICtrlSetTip(-1, "Can be full or partial of the name you want to find, " & @CRLF & "but cannot include driver name and backlash") $DriverName = GUICtrlCreateLabel(" Driver:", 20, 30, 60, 20) $FolderDepthLabel = GUICtrlCreateLabel("Folder Depth:", 160, 30, 100, 20) $FolderDepth = GUICtrlCreateInput("5", 260, 30, 40, 20) $DriverCombo = GUICtrlCreateCombo("", 90, 30, 50, 22) $AllDisk = DriveGetDrive("all") Dim $AllEnableDisk[1] = [0];all enabled disks For $i = 1 To $AllDisk[0] If DriveStatus($AllDisk[$i]) == "READY" Then _ArrayAdd($AllEnableDisk, $AllDisk[$i]) $AllEnableDisk[0] = $AllEnableDisk[0] + 1 EndIf Next $ShowDisksString = _ArrayToString($AllEnableDisk, "|", 1) GUICtrlSetData(-1, $ShowDisksString, "C:") $FolderResult = GUICtrlCreateList("", 30, 100, 780, 174) $Foldernumber = GUICtrlCreateInput("", 25, 68, 30, 23) $MatchLabelInput = GUICtrlCreateLabel(" folders matched:", 55, 70, 200, 20) $ToFind = GUICtrlCreateButton("Find!", 370, 70, 90, 30) $MandatoryToFind = GUICtrlCreateButton("FullyFind!", 370, 35, 90, 30) GUICtrlSetTip(-1, "completely search the disk, you must click Find!" & @CRLF & " button after pressing this button.") $HideWindow = GUICtrlCreateButton("Hide Window", 370, 280, 90, 30) GUISetState() Dim $AllFolderList[1] = [1] Dim $DiskFolderWithDirArray[$AllEnableDisk[0] + 1][$MaxFolderInOneDisk] Dim $DiskFolderWithoutDirArray[$AllEnableDisk[0] + 1][$MaxFolderInOneDisk] $SearchAllDisk = "";it controls which doisk is selected, when no selection, use all disks If (Not FileExists("E:\FolderIndex")) Then DirCreate("E:\FolderIndex") EndIf $HowEnDisks = $AllEnableDisk[0] + 1; how many items in $AllEnableDisk GenerateOrGetFolderArray($SearchAllDisk) MsgBox(1, "Ready", "You can search Folder now.", 2) $TimeToHideWindow = 0;first time not to hide the window ;----------------------------------------------------- While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $MandatoryToFind Beep(750, 250) $YorN = MsgBox(4, "Confirmation Inquiry", "Do you reaaly try to relist all the folders in all disks? It may need 10-30 minutes.") If $YorN == 6 Then;if YES is selected, program will scan this disk completely. $SearchAllDisk = GUICtrlRead($DriverCombo) GenerateOrGetFolderArray($SearchAllDisk);only scan this disk Beep(500, 1000) EndIf Case $msg = $ToFind If GUICtrlRead($FolderNameToSearch) <> "" Then $UserInputFolderName = GUICtrlRead($FolderNameToSearch) $UserInputDriverName = GUICtrlRead($DriverCombo) $UserInputFolderDepth = Number(GUICtrlRead($FolderDepth)) $SearchDriverLocation = _ArraySearch($AllEnableDisk, $UserInputDriverName) $HowMany = $DiskFolderWithoutDirArray[$SearchDriverLocation][0] Dim $TempArrayWithout[$HowMany];in order to extract the 2-dimension array to use For $i = 0 To $HowMany - 1 $TempArrayWithout[$i] = $DiskFolderWithoutDirArray[$SearchDriverLocation][$i] Next Dim $TempArrayWith[$HowMany] For $i = 0 To $HowMany - 1 $TempArrayWith[$i] = $DiskFolderWithDirArray[$SearchDriverLocation][$i] Next $ReturnTwoPara = FindFoldersMatched($UserInputFolderName, $TempArrayWithout);find which index the $UserInputFolderName is located in, then return its full name GUICtrlSetData($Foldernumber, $ReturnTwoPara[0]) GUICtrlSetData($FolderResult, "|" & $ReturnTwoPara[1]) Beep(200, 500) $TimeToHideWindow = TimerInit();begin to count how long thw window will hide Else MsgBox(1, "", "The folder name cannot be empty.") EndIf Case $msg = $HideWindow GUISetState(@SW_HIDE, $OpenFolderTitle) Case $msg = $FolderResult $retFolderFullName = _GUICtrlListGetText($FolderResult, _GUICtrlListSelectedIndex($FolderResult)) If ($retFolderFullName == $LB_ERR) Then MsgBox(16, "Error", "Unknown error from _GUICtrlListGetText") Else ShellExecute($retFolderFullName);it can open folder EndIf ;;; EndSelect $dif = TimerDiff($TimeToHideWindow);check if it is time to hide window If $TimeToHideWindow > 0 And $dif > $IdleTimeToHide Then;when after first time use, if the window is not used for over 10 seconds, it will hide itself. GUISetState(@SW_HIDE, $OpenFolderTitle) EndIf WEnd #endregion --- GuiBuilder generated code End --- ;Find which folder name match with rhe name you try to find, and then use its index to find the full name of the folder. Func FindFoldersMatched($FolderNameIWantToFind, $DriverToSearchArray) ToolTip("Running, please wait.") $PositionOfFolder = 0;the index of the folder you want to find in the $FolderNameToOpen array Dim $AllFolderSearched[1] = [0] $iStart = 0 While 1 $PositionOfFolder = _ArraySearch($DriverToSearchArray, $FolderNameIWantToFind, $iStart, 0, 0, True) If @error == 6 Or $PositionOfFolder == -1 Then ExitLoop;fail to find the folder name or error occurs _ArrayAdd($AllFolderSearched, $TempArrayWith[$PositionOfFolder]);find the full name $AllFolderSearched[0] = $AllFolderSearched[0] + 1 $iStart = $PositionOfFolder + 1;from the nest index to search the folder name WEnd $FolderFoundInString = _ArrayToString($AllFolderSearched, "|");trasnfer the array to string so that it is easy to display $TotalFolderFound = $AllFolderSearched[0];howmany folders found $AllFolderNamesList = StringMid($FolderFoundInString, StringInStr($FolderFoundInString, "|") + 1);remove the first element, which is a number Dim $ResultFinal[2] = [$TotalFolderFound, $AllFolderNamesList];construct an simple array to return the search result ToolTip("");cancel the tooltip Return $ResultFinal EndFunc ;==>FindFoldersMatched ; list all folders within the specified folder, including all sub-folders Func ListAllFolder($Folder, $MaxFolderDepth) $FolderList = _FileListToArray($Folder, "*", 2);only finf folders If IsArray($FolderList) And $FolderList[0] >= 1 Then For $j = 1 To $FolderList[0] _ArrayAdd($AllFolderList, $Folder & "\" & $FolderList[$j]) $AllFolderList[0] = $AllFolderList[0] + 1 Next EndIf $FolderCountDepth = StringReplace($Folder, "\", "");test how deep of the current folder depth $DepthNumber = StringLen($Folder) - StringLen($FolderCountDepth);count the folder depth If IsArray($FolderList) And $FolderList[0] >= 1 And $DepthNumber <= $MaxFolderDepth Then For $j = 1 To $FolderList[0] ListAllFolder($Folder & "\" & $FolderList[$j], $MaxFolderDepth) Next EndIf Return $AllFolderList EndFunc ;==>ListAllFolder ;hide or show the window by PAUSE Func TogglePause() Sleep(25) If $Paused == 0 Then;toggle the hide or show GUISetState(@SW_SHOW, $OpenFolderTitle) $TimeToHideWindow = 0;donot let the window hide when you show it. $Paused = $Paused + 1 Else GUISetState(@SW_HIDE, $OpenFolderTitle) $Paused = $Paused - 1 EndIf EndFunc ;==>TogglePause ; scan the disks and save the full folders name and patial names into TXT file. ;when there is no indexfiles saved or $SearchAllDisk is the specified disk Func GenerateOrGetFolderArray($SearchAllDisk) For $j = 1 To $HowEnDisks - 1 $WhichDriver = $AllEnableDisk[$j] $FolderWithDir = $TheFolderToSaveIndexFiles & StringReplace($WhichDriver, ":", "") & "DiskwithIndex.txt";save all folders with directory name $FolderWithoutDir = $TheFolderToSaveIndexFiles & StringReplace($WhichDriver, ":", "") & "DiskwithoutIndex.txt";save the folders without the directory name If (Not FileExists($FolderWithDir)) Or (Not FileExists($FolderWithoutDir)) Or $SearchAllDisk == $WhichDriver Then $CurrentDiskFolder = ListAllFolder($WhichDriver, $MaxFolderDepth) ReDim $AllFolderList[1] $AllFolderList[0] = 1 _FileWriteFromArray($FolderWithDir, $CurrentDiskFolder) $FoldersNumberInDisk = UBound($CurrentDiskFolder) For $r = 0 To $FoldersNumberInDisk - 1 $DiskFolderWithDirArray[$j][$r] = $CurrentDiskFolder[$r] Next ;save the array into a two diension array later it is easy to get it out ;extract out the directory from $CurrentDiskFolder Dim $FolderNameToOpen[1] = [1];save the folder name without driver and backlash If IsArray($CurrentDiskFolder) And $CurrentDiskFolder[0] >= 1 Then For $i = 1 To $CurrentDiskFolder[0] - 1 $AFolderName = $CurrentDiskFolder[$i] $Position = StringInStr($AFolderName, "\", 0, -1);only find the last backlash position from the right $FolderNameFinal = StringMid($AFolderName, $Position + 1) _ArrayAdd($FolderNameToOpen, $FolderNameFinal) $FolderNameToOpen[0] = $FolderNameToOpen[0] + 1 Next EndIf _FileWriteFromArray($FolderWithoutDir, $FolderNameToOpen) $FoldersNumberInDisk = UBound($FolderNameToOpen) For $r = 0 To $FoldersNumberInDisk - 1 $DiskFolderWithoutDirArray[$j][$r] = $FolderNameToOpen[$r] Next ;save the array into a two diension array later it is easy to get it out Else;the files alreay exist Dim $TempArray _FileReadToArray($FolderWithDir, $TempArray) For $r = 0 To UBound($TempArray) - 1 $DiskFolderWithDirArray[$j][$r] = $TempArray[$r] Next Dim $TempArray _FileReadToArray($FolderWithoutDir, $TempArray) For $r = 0 To UBound($TempArray) - 1 $DiskFolderWithoutDirArray[$j][$r] = $TempArray[$r] Next EndIf Next EndFunc ;==>GenerateOrGetFolderArray
  16. The following is the function to find all the folders within a specified directory, including all the sub-folders at any sub-levels. if you also want to get all the files, you just need to change or add a little code to the function. Func ListAllFolder($Folder, $MaxFolderDepth) $FolderList = _FileListToArray($Folder, "*", 2);only finf folders If IsArray($FolderList) And $FolderList[0] >= 1 Then For $j = 1 To $FolderList[0] _ArrayAdd($AllFolderList, $Folder & "\" & $FolderList[$j]) $AllFolderList[0] = $AllFolderList[0] + 1 Next EndIf $FolderCountDepth = StringReplace($Folder, "\", "");test how deep of the current folder depth $DepthNumber = StringLen($Folder) - StringLen($FolderCountDepth);count the folder depth If $DepthNumber <= $MaxFolderDepth Then $rrr = 999 If IsArray($FolderList) And $FolderList[0] >= 1 And $DepthNumber <= $MaxFolderDepth Then For $j = 1 To $FolderList[0] ListAllFolder($Folder & "\" & $FolderList[$j], $MaxFolderDepth) Next EndIf EndFunc gear
  17. If someone has the script to transfer HTML file to TXT file. I believe Autoit can do it well. Gear
  18. ;=============================================================================== ; ; Function Name: RenameAndCombFileWithFirstLine ; Description:: Rename the files with its first line, if the first line is only spaces or blank, find the next line. ;if there are some spaces between words, all the spaces except one single space will be removed. ;Remove all the lines that are only spaces or blank line ; Parameter(s): $Folder - A folder name, the files within it will be renamed ; $FileExtention - The exstention of the file to be renamed, default is *.txt ; $NumberOnHeadOrEnd - Number, it determines where the file number will be placed in the file name, if it is 1, at the head of file name, else at the end of name . defaule is 1. ; Requirement(s): #include <File.au3>,#include <Array.au3>,#include <Misc.au3> ; Author(s): Gear ;Notes: If there is(are) files is failed to be renamed or combed, the file name will be wrote to console and the Beep sound will remind program runner. ; Example: RenameFileWithFirstLine("c:\3") ; ;=============================================================================== ; #include <File.au3> #include <Array.au3> #include <Misc.au3> RenameFileWithFirstLine("c:\3") Func RenameFileWithFirstLine($Folder, $FileExtention = "*.txt", $NumberOnHeadOrEnd = 1) $FileList = _FileListToArray($Folder, $FileExtention, 1) $FileEx = StringReplace($FileExtention, "*", "") If IsArray($FileList) And $FileList[0] >= 1 Then; when there is no file within $Folder, $FileList is not a array. $FileRenameNumber = 0;count how many files are renamed within a folder ;so $FileList[0] leads to error For $j = 1 To $FileList[0] Dim $FileContentNoBlank[1] = [0];for saving the combed file lines one by one Dim $FileContent $CurrentFile = $Folder & "\" & $FileList[$j] $fileOpen = _FileReadToArray($CurrentFile, $FileContent) If $fileOpen Then $NotFound = 1;the tag for if the line for file name is found For $WhichLine = 1 To $FileContent[0];extract the line one by one from the array $linecontOringinal = $FileContent[$WhichLine] $TheUnWelcomeCharacterInFileName = '<|>|?|:|*|\|/|"|  |  |  | ';these are the unacceptable characters in file name $AfterStripName0 = _StringRemove($linecontOringinal, $TheUnWelcomeCharacterInFileName, "|") $AfterStripName1 = _StringRemove($AfterStripName0, " | ", "|") $Len0 = StringLen($AfterStripName0) $Len1 = StringLen($AfterStripName1) While $Len1 <> $Len0;it can remove all the white space betwwen strings but still ramians the single one betwwen strings if there is(are) spaces originally. $Len0 = $Len1 $AfterStripName1 = StringReplace($AfterStripName1, " ", " ") $AfterStripName1 = StringReplace($AfterStripName1, "  ", " ") $Len1 = StringLen($AfterStripName1) WEnd If ($AfterStripName1 <> "" And $AfterStripName1 <> " " Or $AfterStripName1 <> " ") Then $NotFound = 0;the line for file name is found ExitLoop EndIf Next If $NotFound == 0 Then;only when the line for file name is found then continue to comb the file line by line $FileRenameNumber = $FileRenameNumber + 1 Select;in order to let the renamed files can be arranged according its original sequence, you can put the number ahead of file name Case $FileRenameNumber >= 0 And $FileRenameNumber < 10 $FileRenameNumberString = "000" & String($FileRenameNumber) Case $FileRenameNumber >= 10 And $FileRenameNumber < 100 $FileRenameNumberString = "00" & String($FileRenameNumber) Case Else $FileRenameNumberString = "0" & String($FileRenameNumber) EndSelect If $NumberOnHeadOrEnd = 1 Then;the number is ahead $NumberHead = $FileRenameNumberString & " " $NumberEnd = "" Else $NumberHead = "";the number is at the end $NumberEnd = " " & $FileRenameNumberString EndIf $name = $Folder & "\" & $NumberHead & $AfterStripName1 & $NumberEnd & $FileEx For $WhichLine = 1 To $FileContent[0] $linecontOringinal = $FileContent[$WhichLine] $linecont = StringReplace($linecontOringinal, " ", "") $linecont = StringReplace($linecont, " ", "") If $linecont <> "" Then _ArrayAdd($FileContentNoBlank, $linecontOringinal);if the line is not only spaces, then add the original one to array, without any change $FileContentNoBlank[0] = $FileContentNoBlank[0] + 1;$FileContentNoBlank[0] saves the total line of the new file EndIf Next If $name <> $CurrentFile Then $IfWriteGood = _FileWriteFromArray($name, $FileContentNoBlank, 1) If $IfWriteGood Then $IfDel = FileDelete($CurrentFile) Else $FileRenameNumber=$FileRenameNumber-1 Beep(200, 100) ConsoleWrite("Fail to Rename and comb file: " & $CurrentFile & @CRLF) EndIf EndIf If $name == $CurrentFile Then;when the old name and new name is the same, delete the old file will also delete the new file $WholeOriginalFile = FileRead($CurrentFile); ready for the situation that if fails to write the ccombed file If @error <> 1 Then;check if the file is read out successfully $IfDel = FileDelete($CurrentFile);in order to avoid later delete the two files which are with the same name, so here delete the old file first $IfWriteGood = _FileWriteFromArray($name, $FileContentNoBlank, 1) If $IfWriteGood == 0 And $IfDel == 1 Then;if delete the old file but fail to write the new file $FileRenameNumber=$FileRenameNumber-1 $file = FileOpen($CurrentFile, 10);try to rewrite the old file to disk $IfRewriteGood = FileWrite($file, $WholeOriginalFile) If $IfRewriteGood == 0 Then;fail to rewrite the old file to disk so this file is lost Beep(500, 1000) ConsoleWrite("Attention!" & $CurrentFile & " is deleted and lost!" & @CRLF) Else;old file is rewrote to disk Beep(500, 200) ConsoleWrite("Attention! Fail to Rename and comb file: " & $CurrentFile & @CRLF) EndIf EndIf If $IfWriteGood == 0 And $IfDel == 0 Then;fail to delete the old file and fail to write the new one to disk $FileRenameNumber=$FileRenameNumber-1 Beep(500, 200) ConsoleWrite("Attention! Fail to Rename and comb file: " & $CurrentFile & @CRLF) EndIf If $IfWriteGood == 1 And $IfDel == 0 Then;write the new file to disk but fail to delete the old file Beep(500, 200) ConsoleWrite("Attention! Fail to delete the old file: " & $CurrentFile & @CRLF) EndIf Else;fail to open the old file and stop to write the new one just for the consideration of file security $FileRenameNumber=$FileRenameNumber-1 Beep(500, 200) ConsoleWrite("Attention! Fail to Rename and comb file: " & $CurrentFile & @CRLF) EndIf EndIf Else;fail to find the line to be the file name and stop renaming and combing this file Beep(500, 200) ConsoleWrite("Attention! Fail to Rename and comb file: " & $CurrentFile & @CRLF) EndIf Else;fail to open the file to read its content Beep(500, 200) ConsoleWrite("Attention! Fail to Rename and comb file: " & $CurrentFile & @CRLF) EndIf Next Else;no file ConsoleWrite("There is no file within " & $Folder & @CRLF) EndIf ;if there is(are) sub-folder within $Folder, try to recursively rename and comb the file within them $FolderList = _FileListToArray($Folder, "*", 2);when within folder there is no file and folder, $FolderList is not an array. If IsArray($FolderList) And $FolderList[0] >= 1 Then;when within folder there is(are) files but no child folder, For $i = 1 To $FolderList[0]; $FolderList is an array but $FolderList[0] is nothing(but not 0), so here must use $FolderList[0] >= 1 RenameFileWithFirstLine($Folder & "\" & $FolderList[$i], $FileExtention, $NumberOnHeadOrEnd) Next Else;no sub-folder ConsoleWrite("There is no child folder within " & $Folder & @CRLF) EndIf EndFunc ;==>RenameFileWithFirstLine ;=============================================================================== ; ; Function Name: _StringRemove ; Description:: Removes certain characters or phrases from a string ; Parameter(s): $s_string - String ; $s_remove - Characters to be removed (separated by $s_delim) ; $s_delim[optional] (delimiter '|' by default) ; Requirement(s): None ; Return Value(s): On Success - String with removed characters ; On Failure - 0 ; Author(s): RazerM ; Notes: Only useful when removing lots of characters ; Example: MsgBox(0,0,_StringRemove("102.3040506.0700...80900.", "0|.")) ; ;=============================================================================== ; Func _StringRemove($s_string, $s_remove, $s_delim = "|") $s_remove = StringSplit($s_remove, $s_delim) If @error Then Return 0 For $i = 1 To $s_remove[0] $s_string = StringReplace($s_string, $s_remove[$i], " ") If @error Then Return 0 Next Return $s_string EndFunc ;==>_StringRemove
  19. ;=============================================================================== ; ; Function Name: RenameFileWithFirstLine ; Description:: Rename the files with its first line, if the first line is only spaces or blank, find the next line. ;if there are some spaces between words, only all the spaces except one single space will be removed. ; Parameter(s): $Folder - A folder name, the files within it will be renamed ; $FileExtention - The exstention of the file to be renamed, default is *.txt ; Requirement(s): #include <File.au3>,#include <Array.au3>,#include <Misc.au3> ; Author(s): Gear ;Notes: If there is(are) files is failed to be renamed, the file name will be wrote to console and the Beep sound will remind program runner. ; Example: RenameFileWithFirstLine("c:\1") ; ;=============================================================================== ; Func RenameFileWithFirstLine($Folder, $FileExtention = "*.txt") $FileList = _FileListToArray($Folder, $FileExtention, 1) $FileEx = StringReplace($FileExtention, "*", "") If IsArray($FileList) And $FileList[0] >= 1 Then; when there is no file within $Folder, $FileList is not a array. For $j = 1 To $FileList[0];so $FileList[0] leads to error $CurrentFile = $Folder & "\" & $FileList[$j] $fileOpen = FileOpen($CurrentFile, 0) $FileContent = FileRead($fileOpen) If $fileOpen Then $WhichLine = 1 $NotFound = 1 $LineContent = FileReadLine($fileOpen, $WhichLine) While ($NotFound And @error <> -1 And IsString($LineContent)) $TheUnWelcomeCharacterInFileName = '<|>|?|:|*|\|/|"|  |  |  | ';these are the unacceptable characters in file name $AfterStripName0 = _StringRemove($LineContent, $TheUnWelcomeCharacterInFileName, "|") $AfterStripName1 = _StringRemove($AfterStripName0, " | ", "|") $Len0 = StringLen($AfterStripName0) $Len1 = StringLen($AfterStripName1) While $Len1 <> $Len0;it can remove all the white space betwwen strings but still ramians the only one betwwen strings if there is(are) spaces originally. $Len0 = $Len1 $AfterStripName1 = _StringRemove($AfterStripName1, " | ", "|") $Len1 = StringLen($AfterStripName1) WEnd If ($AfterStripName1 == "" Or $AfterStripName1 == " " Or $AfterStripName1 == " ") Then $WhichLine = $WhichLine + 1 $LineContent = FileReadLine($fileOpen, $WhichLine) Else $NotFound = 0 EndIf WEnd $IfClose = FileClose($fileOpen) If $NotFound == 0 Then $name = $Folder & "\" & $AfterStripName1 & $FileEx If $name <> $CurrentFile Then $file = FileOpen($name, 10) $ifgood = FileWrite($file, $FileContent) $IfClose = FileClose($file) If ($ifgood And $IfClose) Then $IfDel = FileDelete($CurrentFile) Else Beep(200, 100) ConsoleWrite("Fail to Rename file: " & $CurrentFile & @CRLF) EndIf EndIf EndIf Else Beep(500, 100) ConsoleWrite("Fail to open file: " & $CurrentFile & @CRLF) EndIf Next Else ConsoleWrite("There is no file within " & $Folder & @CRLF) EndIf $FolderList = _FileListToArray($Folder, "*", 2);when within folder there is no file and folder, $FolderList is not an array. If IsArray($FolderList) And $FolderList[0] >= 1 Then;when within folder there is(are) files but no child folder, For $i = 1 To $FolderList[0]; $FolderList is an array but $FolderList[0] is nothing(but not 0), so here must use $FolderList[0] >= 1 RenameFileWithFirstLine($Folder & "\" & $FolderList[$i], $FileExtention) Next Else ConsoleWrite("There is no child folder within " & $Folder & @CRLF) EndIf EndFunc ;==>RenameFileWithFirstLine ;=============================================================================== ; ; Function Name: _StringRemove ; Description:: Removes certain characters or phrases from a string ; Parameter(s): $s_string - String ; $s_remove - Characters to be removed (separated by $s_delim) ; $s_delim[optional] (delimiter '|' by default) ; Requirement(s): None ; Return Value(s): On Success - String with removed characters ; On Failure - 0 ; Author(s): RazerM ; Notes: Only useful when removing lots of characters ; Example: MsgBox(0,0,_StringRemove("102.3040506.0700...80900.", "0|.")) ; ;=============================================================================== ; Func _StringRemove($s_string, $s_remove, $s_delim = "|") $s_remove = StringSplit($s_remove, $s_delim) If @error Then Return 0 For $i = 1 To $s_remove[0] $s_string = StringReplace($s_string, $s_remove[$i], " ") If @error Then Return 0 Next Return $s_string EndFunc ;==>_StringRemove
  20. I copy a string from a file, the string in the file is: this is a "line" of text since I cannot change the " to be ' mannully, so the string will be $str1="this is a "line" of text" Now I want to repalce the " to space, I use: $str1="this is a "line" of text" $text = StringReplace($str1, """, " ") but it fails. How can I do it? Gear
  21. Today I improve the program yesterday I posted, now it is much better. you append the text to the previous file if neccessary. Always welcome for comment and suggestion, correction. Gear ;; This program is for copying the text and save it as a TXT file. ;;1. Ctr+Alt+Left Mouse button creats new file; ;;2. Ctrl+left mouse button append the selected text to the last created file ;;3. Shift+left mouse buuton delete the last created file or delete the section appended to the last file ;;4. at first both 1 and 2 can creat new file, once a new file has been created, only 1 can created new file ;;5. only the last created file or last section appended can be deleted ;;there are some webpages that can be copied by Ctrl+LeftMouse clikc to get the ;;selected window text, so just use Ctrl+left mouse click this program copy the text to the specified folder ;;in order to copy the file text, you should first press ctrl and click left mouse button, then release the Ctrl key, ;; the program will quickly copy the whole page file txt to the specified folder as TXT file. ;; if you just want to copy the selected window txt, please delete Send("^a"), the nthe program ;; will just copy the text inside the window you select with the Ctrl and left mouse button. ;; sometimes you may copy the wrong text, or due to other reason, you donot want to copy this page text to your folder, you ;;want to delete the last created TXT file, you can press left mouse button and sgift to do so. ;; but you only can delete the last one, you cannot comtinuely delete more files. ;;you can know if the file is copied to your folder or fail to copy the text or if the last is deleted successfully by listening to the Beep sound Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d #include <Misc.au3> #Include <File.au3> #Include <Array.au3> ;select or creat a new folder to save the copied files in. $TheFolderToSaveFiles = "" While $TheFolderToSaveFiles == "" $TheFolderToSaveFiles = FileSelectFolder("Please Choose or creat a folder to save your copy files:", "", 1) If @error == 1 Then Exit WEnd $FileLocation = $TheFolderToSaveFiles & "\" $i = 0;how many files you save to folder the default first TXT file created is 0, you change it following ;;Try to avoid rewrite the old files within the folder, you can reenter a new file nmuber as the beginnig TXT file name $FileList = _FileListToArray($FileLocation, "*.txt", 1);find all the TXT files within this folder, if the folder does not exist, it will return 0 but not error message If UBound($FileList) > 0 Then;it means the folder exists and there is(are) some TXT files already within this folder $LastCreatedFile = $FileList[UBound($FileList) - 1];;all files names are put into an array $UseTheNewBeginingNumberAsFileName = "1. If you would like to use a new number as the file name, please press OK Button." $IWantToViewTheExistingFileList = "2. If you would like to view the existing files list, please press NO Button." $IDonotCare = "3. Go on, I donot care! Please press Cancel button." $ReEnterFileNumber = 6; control if you would like to enter a new number as the file name While $ReEnterFileNumber == 6 Or $ReEnterFileNumber == 7 $ReEnterFileNumber = MsgBox(3, "Avoid Rewriting the old files", $UseTheNewBeginingNumberAsFileName & @CR & $IWantToViewTheExistingFileList & @CR & $IDonotCare) If $ReEnterFileNumber == 6 Then $NewFileNameNum = InputBox("Please enter a new file number as the first-created TXT file name", "The number can be like:0,1,2,3,.....500,if better, donot be bigger than 10000") $i = Number($NewFileNameNum) $ReEnterFileNumber = 0 EndIf If $ReEnterFileNumber == 7 Then _ArrayDisplay($FileList, "$FileList"); list all the existing files so the user can know the detailed info about the existing TXT files If $ReEnterFileNumber == 2 Then ExitLoop; exit this program WEnd EndIf ;; At present all the preparation work for avoiding rewriting old files has been finished $TheFirstCreatedFileNameNumber = $i Global $FileName = TheFullPathFileName() $TheLastCreatedTXTFile = $FileName;; The user may use try to delete the file before he creats any new file here avoids the error of delete the unexisting filename variable $CreatOrAppend = "No";; before creat any new file, no permit to try to delete and file or section $BeforeAppendFileSize = -100; avoid try to delete the appending section While 1 ;; if you want to delete the last created TXT file, you can Press shift key and left mouse button ;;Sometimes the program may fail to react to this operation, so only when the messagebox popup means the file is delted successfully. ;;in order to increase the possibility, you can first press left mouse button then press the shift key. If (_IsPressed(10) And _IsPressed(01) And $CreatOrAppend == "Creat") Then DeleteLastCreatedFile();delete the last created file EndIf If (_IsPressed(10) And _IsPressed(01) And $CreatOrAppend == "Append" And $BeforeAppendFileSize > 0) Then DeleteLastAppendedSectionFromTheFile();delete the last created file EndIf If (_IsPressed(11) And _IsPressed(01) And _IsPressed(12)) Then CopyAndCreatNewFile();the last element is the file name of the just created file name EndIf ;; Try to use Ctrl+Left mouse key to copy some text and append to its previous file If (_IsPressed(11) And _IsPressed(01) And (Not _IsPressed(12))) Then CopyAndAppendToFile();;the last element is bytes foe the file before appending EndIf WEnd ;;copy the text and creat a new file to save the text, the return array's first element tells if the operation is OK. Func CopyAndCreatNewFile() ;;$TryToCopy = 1; it means you try to copy some text and creat a new file to save it $begin = TimerInit();control the time interval you press the key $TooLong = 0 While (_IsPressed(11) Or _IsPressed(12));only when you release the Ctrl and Alt key the program begins to try to copy the text Sleep(50) $dif = TimerDiff($begin) If $dif >= 1500 Then Beep(500, 250);; it means you press the Ctrl key too long. when you try to abandon this time's text copy, you can use this manner $TooLong = 1; it means you press the Ctrl+Alt key too long, the copy text operarion fails ExitLoop; it means you press the Ctrl key too long and program begin another time's text-copy EndIf WEnd While (_IsPressed(11) Or _IsPressed(12));;it waits you release both the Ctrl and Alt keyes so that another time text-copy can begin Sleep(50);; without this section, your long-time pressing Ctrl+Alt key will fail to abandon this-time's text-copy operation WEnd If $TooLong == 0 Then Send("^a");select all the text Sleep(500) Send("^c");copy the selected text to clipboard Sleep(200) $TextFromExplorer = ClipGet() $i = $i + 1;; only here the program can increase $i $FileName = TheFullPathFileName() $file = FileOpen($FileName, 10);write the text to file, if it doesnot exist, creats it. FileWrite($file, $TextFromExplorer) $IfTheFileGood = FileClose($file) If $IfTheFileGood == 1 Then Beep(100, 150);;it means the success of copying the text to TXT file $TheLastCreatedTXTFile = $FileName;record the last created TXT file so that you can press Shift key and left mouse button to delete it $BeforeAppendFileSize = -100;; once a new file is created, try to delete the appending section to the last file will be not available $CreatOrAppend = "Creat";; it is useful when you try to delete the last created file later Else $i = $i - 1;;the current last created name is still the one before $i = $i + 1 at the previous step Beep(2000, 2000);;it means fail to copy the text to file EndIf EndIf EndFunc ;==>CopyAndCreatNewFile ;;copy the text and append the text to the previous file, the return array's first element tells if the operation is OK. Func CopyAndAppendToFile() ;;$TryToCopy = 2; it means you try to copy some text and cappend to its previous file $begin = TimerInit();control the time interval you press the key $TooLong = 0 While _IsPressed(11);only when you release the Ctrl key the program begins to try to copy the text Sleep(50) $dif = TimerDiff($begin) If $dif >= 1500 Then Beep(500, 250);; it means you press the Ctrl key too long. when you try to abandon this time's text copy, you can use this manner $TooLong = 1; it means you press the Ctrl+Alt key too long, the copy text operarion fails ExitLoop; it means you press the Ctrl key too long and program begin another time's text-copy EndIf WEnd While _IsPressed(11);;it waits you release the Ctrl key so that another time text-copy can begin Sleep(50);; without this section, your long-time pressing Ctrl+Alt key will fail to abandon this-time's text-copy operation WEnd If $TooLong == 0 Then Send("^a");select all the text Sleep(500) Send("^c");copy the selected text to clipboard Sleep(200) $TextFromExplorer = ClipGet() $file = FileOpen($FileName, 9);write the text to file, if it doesnot exist, creats it. Global $BeforeAppendFileSize = FileGetSize($FileName) ConsoleWrite($BeforeAppendFileSize) ConsoleWrite(@CR) FileWrite($file, $TextFromExplorer) $IfTheFileGood = FileClose($file) If $IfTheFileGood == 1 Then Beep(100, 150);;it means the success of copying the text to TXT file ;; since there is no new file is created, so it is no need to refresh the $TheLastCreatedTXTFile $CreatOrAppend = "Append";;it is useful when youtry to delete the last section you append to the last file Else Beep(2000, 2000);;it means fail to copy the text to file EndIf EndIf EndFunc ;==>CopyAndAppendToFile ;thansfer the filename that will be created to the full path one Func TheFullPathFileName() If 1000 < $i Then $FileName = $FileLocation & String($i) & ".txt" If 100 < $i <= 1000 Then $FileName = $FileLocation & "0" & String($i) & ".txt";; it can list all files accoeding to their name order If 10 < $i <= 100 Then $FileName = $FileLocation & "00" & String($i) & ".txt" If 0 <= $i < 10 Then $FileName = $FileLocation & "000" & String($i) & ".txt" Return ($FileName) EndFunc ;==>TheFullPathFileName Func DeleteLastCreatedFile() $IfSuccess = FileDelete($TheLastCreatedTXTFile);;only the last file can be deleted If $IfSuccess == 1 Then MsgBox(1, "File Deleted", "OK! The last created TXT file has been deleted successfully!") For $FileDelete = 1 To 5 Beep(50, 100) Sleep(50) Next $i = $i - 1 EndIf While (_IsPressed(10) Or _IsPressed(01)); wait the user to release the shift key and left mouse button, otherwise program stop here to wait Sleep(50);; without this section, the program will try to delete the last created TXT file again and again WEnd;; we donot hope such occasion happens. but this section is not always neccessary, since the last created file has been deleted no useful operation will happen ;;Try to use Ctrl+Left mouse key to copy some text and creat a new file to save it EndFunc ;==>DeleteLastCreatedFile Func DeleteLastAppendedSectionFromTheFile() $file = FileOpen($TheLastCreatedTXTFile, 0) $WholeFile = FileRead($TheLastCreatedTXTFile);read the whole file FileClose($file) $BeforeAppendFile = StringMid($WholeFile, 1, $BeforeAppendFileSize) $file = FileOpen($TheLastCreatedTXTFile, 2) $ifWrite = FileWrite($file, $BeforeAppendFile) $Ifclose = FileClose($file) If $ifWrite And $Ifclose Then For $FileDelete = 1 To 5 Beep(50, 100) Sleep(50) Next EndIf $BeforeAppendFileSize = -100;; avoid the next time to try to delete the appending section EndFunc ;==>DeleteLastAppendedSectionFromTheFile Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Func ShowMessage() $Howmanyfilecreated = $i - $TheFirstCreatedFileNameNumber $totalFiles = "So far you creat " & String($Howmanyfilecreated) & " files." MsgBox(1, "Files Created", $totalFiles) EndFunc ;==>ShowMessage
  22. With the use of _IsPressed() we can know if certain key is pressed at present, but how to know only this key is pressed and no any other key is pressed? Gear
  23. AutoIt 3.0 is a very good software, but it seems the website linking speed is too slow, perhpas it is because it is completely free-ware. If the financial state of www.autoitscript.com is not as good as its software's performance, I am glad to donate some money to better its hardware equipments, as long as it really needs the help from all the people who love AutoIt . Gear
  24. When I press Ctrl+Alt+B , why no bookmark is added? Except the LUA scripts, other all hotkey can work peoperly, like Ctrl+1,Ctrl+T,Alt+W ,etc. Including Ctrl+J,,Ctrl+Shift+D all LUA commands fail. What is the trouble? Gear
  25. If you want to know more about math functions, you can go to http://functions.wolfram.com, there are almost all the functions you want to learn and use. Gear
×
×
  • Create New...