Jump to content

Ashalshaikh

Active Members
  • Posts

    96
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Ashalshaikh's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. Hi I just wrote small function which can helps you to make small box easly. _ChooseBox Show box with choices and button Pictures :- Function with two examples : - #include <GuiTreeView.au3> #include <GuiImageList.au3> ;--- Examples ------------------------- Global $ChooseList[4][3] $ChooseList[0][0] = 'Choose 1' $ChooseList[0][1] = 'shell32.dll' $ChooseList[0][2] = '5' $ChooseList[1][0] = 'Choose 2' $ChooseList[1][1] = 'shell32.dll' $ChooseList[1][2] = '8' $ChooseList[2][0] = 'Choose 3' $ChooseList[2][1] = 'shell32.dll' $ChooseList[2][2] = '200' $ChooseList[3][0] = 'Choose 4' $ChooseList[3][1] = 'shell32.dll' $ChooseList[3][2] = '150' $result = _ChooseBox($ChooseList) If @error Then MsgBox(16, '', 'You Click X Button') Else MsgBox(64, '', 'Selected : ' & $result & @CRLF & _ ' Array Index = ' & @extended) EndIf $result = _ChooseBox($ChooseList, 'Example', 300, 100, 50, 150) If @error Then MsgBox(16, '', 'You Click X Button') Else MsgBox(64, '', 'Selected : ' & $result & @CRLF & _ ' Array Index = ' & @extended) EndIf ;--- End - Examples --------------------- ;-------------- _ChoosBox ---------------------- ; Name...........: _ChooseBox ; Description ...: Show box with choices and button ; Tested On .....: AutoIt Version : 3.3.6.1 ; Syntax.........: _ChooseBox($ChooseList[, $Title = 'ChooseBox'[, $Width = 100[, $Height = 200[, $Left = -1[, $Top = -1[, $Parent = '']]]]]]) ; Parameters ....: $ChooseList - The array of choices and icons ; The array must be two dimensions .Like This: ; $Array[X][0] = Choice Text ; $Array[X][1] = Choice Icon File ; $Array[X][2] = Choice Icon Index ; X = Number of choice ; $Title - Title of ChooseBox GUI [Default = ChooseBox] ; $Width - Width of ChooseBox GUI [Default = 100] ; $Height - Height of ChooseBox GUI [Default = 200] ; $Left - Left postion of ChooseBox GUI [Default = -1] ; $Top - Top postion of ChooseBox GUI [Default = -1] ; $Parent - Parent of ChooseBox GUI [Default = ''] ; Return values .: Success - The Choosen Text ; @Extended = Index of choosen choice at the array ; Failure - 0 ; Remarks .......: If User click X button (Close) , @Error will be 1 ; Author ........: Ahmad Alshaikh (Ashalshaikh) ; Link ..........: http://www.autoitscript.com/forum/index.php?showtopic=120920 ; ====================================================================================================== Func _ChooseBox($ChooseList, $Title = 'ChooseBox', $Width = 100, $Height = 200, $Left = -1, $Top = -1, $Parent = '') Local $GUI = GUICreate($Title, $Width, $Height, $Left, $Top, Default, Default, $Parent) Local $ChooseBtn = GUICtrlCreateButton('Choose', 5, $Height - 40 + 10, $Width - 10, 25) Local $TreeView = _GUICtrlTreeView_Create($GUI, 5, 5, $Width - 10, $Height - 40) Local $IList = _GUIImageList_Create(16, 16, 5), $ILtmp _GUICtrlTreeView_SetNormalImageList($TreeView, $IList) GUISetState() For $i = 0 To UBound($ChooseList) - 1 $ILtmp = _GUIImageList_AddIcon($IList, $ChooseList[$i][1], $ChooseList[$i][2]) _GUICtrlTreeView_Add($TreeView, 0, $ChooseList[$i][0], $ILtmp, $ILtmp) Next _GUICtrlTreeView_SelectItem($TreeView, _GUICtrlTreeView_GetFirstItem($TreeView), 0) While 1 Switch GUIGetMsg() Case -3 _GUIImageList_Destroy($IList) GUIDelete($GUI) Return SetError(1, 0, 0) ExitLoop Case $ChooseBtn Local $tmp = _GUICtrlTreeView_GetText($TreeView, _GUICtrlTreeView_GetSelection($TreeView)) For $t = 0 To UBound($ChooseList) - 1 If $tmp = $ChooseList[$t][0] Then _GUIImageList_Destroy($IList) GUIDelete($GUI) Return SetExtended($t, $tmp) ExitLoop EndIf Next EndSwitch WEnd EndFunc ;==>_ChooseBox Note : It needs include (GuiTreeView.au3 | GuiImageList.au3) to work. I hope to be useful to someone.
  2. Great tool . Very useful I think this UDF will helps you to make Au3DB controls SciTE SciTE UDF : http://www.autoitscript.com/forum/index.php?showtopic=119912 Thnak you ..
  3. WOW , Great addtions , That will be in the next release..Thanks a lot. I am learning hard , but you know the difficulty of learning new language , especially grammar . I appreciate this. ------------ I stopped the development of the tool until now but I will continue the work, starting from now
  4. It works for me !! Thanks. thanks .. I used the varibles , but like this : For $x = 1 To 15 GUICtrlSetState(Execute('$IcnLbl' & $x), $GUI_Disable) Next For $x = 1 To 5 GUICtrlSetState(Execute('$IcnIdxInp' & $x), $GUI_Disable) Next For $x = 1 To 5 GUICtrlSetState(Execute('$IcnFLInp' & $x), $GUI_Disable) Next Execute('$IcnFLInp' & $x) thank you
  5. Melb32 Thanks Very nice .. Thank you .. This explanation is very great Has been applied and worked Excellent I'm planning to add a button to do this It will be in the Help File later
  6. Hi .. First! I started learning English in the past few months ... If there are some mistakes , Excuse me for this ... SciTE UDF Control and Get information 18 Functions !! ## General :- _SciTEWinGetEditId _SciTEWinGetHandle _SciTESave _SciTE_Send_Command --> By : Snippet Holder Authors _SciTEGetEditPos _SciTEFind ## File :- _SciTEIsFileSaved _SciTEIsFileOpened _SciTEGetCorrentFile ## Tabs :- _SciTETabCommand _SciTETabsCount _SciTECorrentTabNum ## Edit Control :- _SciTEEditSend _SciTEEditCommand _SciTEGoToLine _SciTEInsertText --> By : Snippet Holder Authors _SciTEEditGetCurrentLine _SciTEEditGetCurrentCol Download :- SciTE UDF.au3 Thanks !!
  7. Thanks for test .. yes .. This happens because of the use of variables in some other way :- For $x = 1 To 15 GUICtrlSetState(Execute('$IcnLbl' & $x), $GUI_Disable) Next For $x = 1 To 5 GUICtrlSetState(Execute('$IcnIdxInp' & $x), $GUI_Disable) Next For $x = 1 To 5 GUICtrlSetState(Execute('$IcnFLInp' & $x), $GUI_Disable) Next It work like 25 line !! just remove #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 to fix it !!
  8. Updated the first post in 19 September 2010 Version 0.1!! thanks - becouse : Jump twice to the same anchor زز - Been Fixed in the new version !! thanks .. Thank you for reporting Been Fixed in the new version !!
  9. I just forgot about that Now, the Hopper has become better Thanks .. thank for suggestion .. I was planning to do this in the end But I will do it now .. Thanks! I hope so
  10. Your suggestions Make (The Jumper ) Better !! Please, if you remembered any other idea , write it here this will make Hopper easier to use .. Good !! I will try to do this .. But not by the window borders New version pictures http://img245.imageshack.us/img245/7866/20100913173401.gif http://img442.imageshack.us/img442/6437/20100913174007.gif Very Soon ------------------------------------ thanks ! Sure !! I will not know this .. Amazing That is simple and practical solution !! Sure . I will use Send("{END}") !! I will try some ideas .. Thanks M23
  11. Hi .. First! I started learning English in the past few months ... If there are some mistakes , Excuse me for this ... File Line UDF It's very useful UDF !! Functions :- ; _StringInLine ; _FileLineDownByText ; _FileLineDownByNum ; _FileLineUpByText ; _FileLineUpByNum ; _FileLineSwap ; _FileLineSort ; _FileLineIsEmpty ; _FileLineStripWS ; _FileLineExists ; _FileLineGetLonger ; _FileLineGetShorter ; _FileLineMove ; _FileLineDelete ; _FileLineAddNumbers ; _FileLineAddStart ; _FileLineAddEnd ; _FileLineDisplay ; _FileLineGetRefined ; _FileLineLen ; _FileLineReplace ; _FileLineMerge ; _FileLineGetInfo #include-once ;=== UDF Info ============================================== ; UDF Name : File Line UDF. ; UDF Description : To control and Get informations. ; Author : Ashalshaikh : Ahmad Alshaikh. ; الســــــعودية ; Functions : ; _StringInLine ; _FileLineDownByText ; _FileLineDownByNum ; _FileLineUpByText ; _FileLineUpByNum ; _FileLineSwap ; _FileLineSort ; _FileLineIsEmpty ; _FileLineStripWS ; _FileLineExists ; _FileLineGetLonger ; _FileLineGetShorter ; _FileLineMove ; _FileLineDelete ; _FileLineAddNumbers ; _FileLineAddStart ; _FileLineAddEnd ; _FileLineDisplay ; _FileLineGetRefined ; _FileLineLen ; _FileLineReplace ; _FileLineMerge ; _FileLineGetInfo ; _IsFileOpen ;functions not completed ; _FileLineCenter ;Special Thanks : ; Alzri2 ; AutoIt Forums ; Zyzoom.org/vb ; And You ^_^ ;=== UDF Info ================= End ======================== ;======== #Include ========= #include <File.au3> #include <Array.au3> ;======= Functions ========= ; #FUNCTION# ==================================================================================================================== ; Name...........: _StringInLine ; Description ...: Find Some String In File Lines And Return Lines Nuber In Array ; Syntax.........: _StringInLine (FilePath,String,[CompreType]) ; Parameters ....: FilePath - Path Of File. ; String - String ; CompreType - 0 => Find If String In Line (StringInStr) :: 1=> Find If String=Line ; Return values .: Success - Lines Numbers In Array ; Failure - First Row In Array = 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _StringInLine($FilePath, $String, $CompreType = 0) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf Local $ReSult = "", $swd = "" If $CompreType <> 0 And $CompreType <> 1 Then $CompreType = 0 $LineNum = _FileCountLines($FilePath) For $i = 1 To $LineNum Step 1 $Read = FileReadLine($FilePath, $i) If $CompreType = 1 Then If $Read = $String Then $ReSult &= $swd & $i $swd = "|" EndIf Else If StringInStr($Read, $String) Then $ReSult &= $swd & $i $swd = "|" EndIf EndIf Next If Not $Read = $String Then Return 0 If $ReSult = "" Then Return StringSplit($ReSult, "") Else Return StringSplit($ReSult, "|") EndIf EndFunc ;==>_StringInLine ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineDownByText ; Description ...: Down Line In File ; Syntax.........: _FileLineDownByText (FilePath,FullTextOnLine,[Flag]) ; Parameters ....: FilePath - Path Of File. ; FullTextOnLine - Text In That Line ; Flag - 0 -> Down All Lines = FullTextOnLine ; 1,2,3,n-> First Line = FullTextOnLine , Second Line = FullTextOnLine , Nth Line = FullTextOnLine ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Flag Is Wrong ; Remarks .......: Must FullTextOnLine=Line completely ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineDownByText($FilePath, $FullTextOnLine, $Flag = 0) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If $Flag <> 0 And Not _FileLineExists($FilePath, $Flag) Then SetError(2) Return 0 EndIf $LineNum = _StringInLine($FilePath, $FullTextOnLine, 1) If $LineNum[0] = 0 Then Return 0 Else If $Flag = 0 Then Local $RES = "" For $x = 1 To $LineNum[0] $RES &= "|" & _FileLineSwap($FilePath, $LineNum[$x], $LineNum[$x] + 1) Next Return StringTrimLeft($RES, 1) Else Return _FileLineSwap($FilePath, $LineNum[$Flag], $LineNum[$Flag] + 1) EndIf EndIf EndFunc ;==>_FileLineDownByText ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineUpByText ; Description ...: Up Line In File ; Syntax.........: _FileLineUpByText (FilePath,FullTextOnLine,[Flag]) ; Parameters ....: FilePath - Path Of File. ; FullTextOnLine - Text In That Line ; Flag - 0 -> Down All Lines = FullTextOnLine ; 1,2,3,n-> First Line = FullTextOnLine , Second Line = FullTextOnLine , Nth Line = FullTextOnLine ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Flag Is Wrong ; Remarks .......: Must FullTextOnLine=Line completely ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineUpByText($FilePath, $FullTextOnLine, $Flag = 0) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If $Flag <> 0 And Not _FileLineExists($FilePath, $Flag) Then SetError(2) Return 0 EndIf $LineNum = _StringInLine($FilePath, $FullTextOnLine, 1) If $LineNum[0] = 0 Then Return 0 Else If $Flag = 0 Then Local $RES = "" For $x = 1 To $LineNum[0] $RES &= "|" & _FileLineSwap($FilePath, $LineNum[$x], $LineNum[$x] - 1) Next Return StringTrimLeft($RES, 1) Else Return _FileLineSwap($FilePath, $LineNum[$Flag], $LineNum[$Flag] - 1) EndIf EndIf EndFunc ;==>_FileLineUpByText ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineSwap ; Description ...: Swaps two Lines. ; Syntax.........: _FileLineSwap(FilePath, Line1Num, Line2Num) ; Parameters ....: FilePath - Path Of File. ; Line1Num - Number Of First Line ; Line2Num - Number Of Second Line ; Return values .: Success - 1 ; Failure - 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineSwap($FilePath, $Line1Num, $Line2Num) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If Not _FileLineExists($FilePath, $Line1Num) Or Not _FileLineExists($FilePath, $Line2Num) Then Return 0 Local $Line1 = FileReadLine($FilePath, $Line1Num) If @error Then Return 0 Local $Line2 = FileReadLine($FilePath, $Line2Num) If @error Then Return 0 _FileWriteToLine($FilePath, $Line1Num, $Line2, 1) If @error Then Return 0 _FileWriteToLine($FilePath, $Line2Num, $Line1, 1) If @error Then Return 0 Return 1 EndFunc ;==>_FileLineSwap ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineSort ; Description ...: Sort Lines ; Syntax.........: _FileLineSort (FilePath,[iDescending=0]) ; Parameters ....: FilePath - Path Of File. ; iDescending - [optional] If set to 1, sort descendingly ; Return values .: Success - 1 ; Failure - 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineSort($FilePath, $iDescending = 0) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If $iDescending > 1 And $iDescending < 0 Then $iDescending = 0 Local $Arr _FileReadToArray($FilePath, $Arr) _ArrayDelete($Arr, 0) _ArraySort($Arr, $iDescending) Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 0 To UBound($Arr) - 1 FileWriteLine($FO, $Arr[$x]) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineSort ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineIsEmpty ; Description ...: Check If Line IS Empty ; Syntax.........: _FileLineIsEmpty(FilePath, LineNum) ; Parameters ....: FilePath - Path Of File. ; LineNum - Number Of Line ; Return values .: Success - 1 ; Failure - 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = LineNum > _FileCountLines ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineIsEmpty($FilePath, $LineNum) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If Not _FileLineExists($FilePath, $LineNum) Then SetError(2) Return 0 EndIf If StringStripWS(FileReadLine($FilePath, $LineNum), 3) = "" Then Return True Return False EndFunc ;==>_FileLineIsEmpty ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineStripWS ; Description ...: Strip Spaces In Lines ; Syntax.........: _FileLineStripWS(FilePath) ; Parameters ....: FilePath - Path Of File. ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineStripWS($FilePath) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf Local $Arr _FileReadToArray($FilePath, $Arr) _ArrayDelete($Arr, 0) Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 0 To UBound($Arr) - 1 If StringStripWS($Arr[$x], 3) = "" Then ContinueLoop FileWriteLine($FO, StringStripWS($Arr[$x], 3)) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineStripWS ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineExists ; Description ...: Check If Line Exists ; Syntax.........: _FileLineExists(FilePath,LineNum) ; Parameters ....: FilePath - Path Of File. ; LineNum - Number Of Line ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineExists($FilePath, $LineNum) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf Local $CL = _FileCountLines($FilePath) If @error Then SetError(1) Return 0 EndIf If $LineNum > $CL Then Return False If $LineNum <= 0 Then Return False Return True EndFunc ;==>_FileLineExists ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineCenter ; Description ...: Makes all the lines in the center ; Syntax.........: _FileLineCenter(FilePath, [Chr]) ; Parameters ....: FilePath - Path Of File. ; Chr - [optional] The reference to fill in the blanks [Default=" "]. ; Return values .: Success - 1 ; Failure - 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineCenter($FilePath, $Chr = " ") If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf $Longer = _FileLineGetLonger($FilePath) Local $Arr _FileReadToArray($FilePath, $Arr) If @error Then SetError(@error) Return 0 EndIf _ArrayDelete($Arr, 0) Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 0 To UBound($Arr) - 1 $diff = $Longer[1] - StringLen($Arr[$x]) For $e = 1 To $diff / 2 / StringLen($Chr) $Arr[$x] = $Chr & $Arr[$x] & $Chr Next FileWriteLine($FO, $Arr[$x]) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineCenter ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineGetLonger ; Description ...: Get Longer Line In File ; Syntax.........: _FileLineGetLonger(FilePath) ; Parameters ....: FilePath - Path Of File. ; Return values .: Success - Array (Row 0 : Line Numbeer , Row 1 : length Of Longer Line ) ; Failure - Arrau Row 0 : 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Unable to Split the file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineGetLonger($FilePath) Local $Err[1] = [0] If Not _IsFileOpen($FilePath) Then SetError(1) Return $Err EndIf Local $Arr _FileReadToArray($FilePath, $Arr) If @error Then SetError(@error) Return $Err EndIf _ArrayDelete($Arr, 0) Local $Longer = 0, $Line = 0 For $x = 0 To UBound($Arr) - 1 If StringLen($Arr[$x]) > $Longer Then $Longer = StringLen($Arr[$x]) $Line = $x + 1 EndIf Next Local $RES[2] = [$Line, $Longer] Return $RES EndFunc ;==>_FileLineGetLonger ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineGetShorter ; Description ...: Get Shorter Line In File ; Syntax.........: _FileLineGetShorter(FilePath) ; Parameters ....: FilePath - Path Of File. ; Return values .: Success - Array (Row 0 : Line Numbeer , Row 1 : length Of Shorter Line ) ; Failure - Arrau Row 0 : 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Unable to Split the file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineGetShorter($FilePath) Local $Err[1] = [0] If Not _IsFileOpen($FilePath) Then SetError(1) Return $Err EndIf Local $Arr _FileReadToArray($FilePath, $Arr) If @error Then SetError(@error) Return $Err EndIf _ArrayDelete($Arr, 0) Local $REP = _FileLineGetLonger($FilePath) Local $Shorter = $REP[1], $Line = 0 For $x = 0 To UBound($Arr) - 1 If StringLen($Arr[$x]) < $Shorter Then $Shorter = StringLen($Arr[$x]) $Line = $x + 1 EndIf Next Local $RES[2] = [$Line, $Shorter] Return $RES EndFunc ;==>_FileLineGetShorter ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineMove ; Description ...: Move Line ; Syntax.........: _FileLineMove(FilePath, From, TO) ; Parameters ....: FilePath - Path Of File. ; From - Number Of Line ; From - New Number Of Line ; Return values .: Success - 1 ; Failure - 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Unable to Split the file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineMove($FilePath, $From, $TO) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If Not _FileLineExists($FilePath, $From) Or Not _FileLineExists($FilePath, $TO) Then SetError(2) Return 0 EndIf Local $Arr _FileReadToArray($FilePath, $Arr) If @error Then SetError(@error) Return 0 EndIf If $From > $TO Then For $x = $From To $TO + 1 Step -1 _ArraySwap($Arr[$x], $Arr[$x - 1]) Next Else For $x = $From To $TO - 1 Step 1 _ArraySwap($Arr[$x], $Arr[$x + 1]) Next EndIf Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 1 To UBound($Arr) - 1 FileWriteLine($FO, $Arr[$x]) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineMove ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineDisplay ; Description ...: Display File Lindes (Like : _ArrayDisplay) ; Syntax.........: _ArrayDisplay($FilePath [, $sTitle = "File Lines : ListView Display"[, $iItemLimit = -1[, $iTranspose = 0[, $sSeparator = ""[, $sReplace = "|"]]]]]) ; Parameters ....: FilePath - Path Of File. ; $sTitle - [optional] Title to use for window ; $iItemLimit - [optional] Maximum number of listview items (rows) to show ; $iTranspose - [optional] If set differently than default, will transpose the array if 2D ; $sSeparator - [optional] Change Opt("GUIDataSeparatorChar") on-the-fly ; $sReplace - [optional] String to replace any occurrence of $sSeparator with in each array element ; Return values .: Success - 1 ; Failure - 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Unable to Split the file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineDisplay($FilePath, $sTitle = "File Lines : ListView Display", $iItemLimit = -1, $iTranspose = 0, $sSeparator = "", $sReplace = "|") Local $Arr _FileReadToArray($FilePath, $Arr) If @error Then SetError(@error) Return 0 EndIf Return _ArrayDisplay($Arr, $sTitle, $iItemLimit, $iTranspose, $sSeparator, $sReplace) EndFunc ;==>_FileLineDisplay ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineDelete ; Description ...: Delete Line By Num. ; Syntax.........: _FileLineDelete(FilePath,LineNum) ; Parameters ....: FilePath - Path Of File. ; LineNum - Number Of Line. ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineDelete($FilePath, $LineNum) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf Local $Arr _FileReadToArray($FilePath, $Arr) Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 1 To UBound($Arr) - 1 If $x = $LineNum Then ContinueLoop FileWriteLine($FO, $Arr[$x]) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineDelete ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineAddNumbers ; Description ...: Add Numbers at Lines ; Syntax.........: _FileLineAddNumbers($FilePath, [$StartWork = 1, [$EndWork = -1, [$StartNum = 1, [$AfterNum = " "]]]]) ; Parameters ....: FilePath - Path Of File. ; StartWork - LineNum Of Start Add Numbers ; EndWork - LineNum Of End Add Numbers ; StartNum - Number which begins by numbering ; AfterNum - Any Thing Add After Num ::: For Example " - " Because Num To Be " 1 - Line " , " 222 - Line". ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineAddNumbers($FilePath, $StartWork = 1, $EndWork = -1, $StartNum = 1, $AfterNum = " ") If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If $EndWork = -1 Then $EndWork = _FileCountLines($FilePath) Local $Arr _FileReadToArray($FilePath, $Arr) Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 1 To UBound($Arr) - 1 If $x >= $StartWork Then If $x <= $EndWork Then $Arr[$x] = $StartNum & $AfterNum & $Arr[$x] $StartNum += 1 EndIf EndIf Next For $x = 1 To UBound($Arr) - 1 FileWriteLine($FO, $Arr[$x]) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineAddNumbers ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineUpByNum ; Description ...: Up Line By Its Number. ; Syntax.........: _FileLineUpByNum(FilePath, LineNum) ; Parameters ....: FilePath - Path Of File. ; LineNum - Number Of Line ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Line Not Found. ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineUpByNum($FilePath, $LineNum) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If Not _FileLineExists($FilePath, $LineNum) Then SetError(2) Return 0 EndIf Return _FileLineSwap($FilePath, $LineNum, $LineNum - 1) EndFunc ;==>_FileLineUpByNum ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineDownByNum ; Description ...: Down Line By Its Number. ; Syntax.........: _FileLineDownByNum(FilePath, LineNum) ; Parameters ....: FilePath - Path Of File. ; LineNum - Number Of Line ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; 2 = Line Not Found. ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineDownByNum($FilePath, $LineNum) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If Not _FileLineExists($FilePath, $LineNum) Then SetError(2) Return 0 EndIf Return _FileLineSwap($FilePath, $LineNum, $LineNum + 1) EndFunc ;==>_FileLineDownByNum ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineAddStart ; Description ...: Add String For Start Of Lines. ; Syntax.........: _FileLineAddStart($FilePath, $String, [$StartWork = 1, [$EndWork = -1]]) ; Parameters ....: FilePath - Path Of File. ; $String - String Which Add it. ; $StartWork - [optional] Number Of Line Which Start Adding From It. :{Default = 1} ; $EndWork - [optional] Number Of Line Which End Adding From It. :{Default = -1 , to End File} ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineAddStart($FilePath, $String, $StartWork = 1, $EndWork = -1) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If $EndWork = -1 Then $EndWork = _FileCountLines($FilePath) Local $Arr _FileReadToArray($FilePath, $Arr) Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 1 To UBound($Arr) - 1 If $x >= $StartWork Then If $x <= $EndWork Then $Arr[$x] = $String & $Arr[$x] EndIf EndIf Next For $x = 1 To UBound($Arr) - 1 FileWriteLine($FO, $Arr[$x]) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineAddStart ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineAddEnd ; Description ...: Add String For End Of Lines. ; Syntax.........: _FileLineAddEnd($FilePath, $String, [$StartWork = 1, [$EndWork = -1]]) ; Parameters ....: FilePath - Path Of File. ; $String - String Which Add it. ; $StartWork - [optional] Number Of Line Which Start Adding From It. :{Default = 1} ; $EndWork - [optional] Number Of Line Which End Adding From It. :{Default = -1 , to End File} ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineAddEnd($FilePath, $String, $StartWork = 1, $EndWork = -1) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If $EndWork = -1 Then $EndWork = _FileCountLines($FilePath) Local $Arr _FileReadToArray($FilePath, $Arr) Local $FO = FileOpen($FilePath, 2) If $FO = -1 Then SetError(1) Return 0 EndIf For $x = 1 To UBound($Arr) - 1 If $x >= $StartWork Then If $x <= $EndWork Then $Arr[$x] = $Arr[$x] & $String EndIf EndIf Next For $x = 1 To UBound($Arr) - 1 FileWriteLine($FO, $Arr[$x]) Next FileClose($FO) Return 1 EndFunc ;==>_FileLineAddEnd ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineGetRefined ; Description ...: Get Refined Lines. ; Syntax.........: _FileLineAddEnd($FilePath) ; Parameters ....: FilePath - Path Of File. ; Return values .: Success - [Array] Refined Lines Number .. Like : 1+3+9 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineGetRefined($FilePath) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf Local $Arr _FileReadToArray($FilePath, $Arr) Local $RES = "" For $e = 1 To UBound($Arr) - 1 $RES &= "#" & $e For $w = $e + 1 To UBound($Arr) - 1 If $Arr[$e] = $Arr[$w] Then $RES &= "+" & $w Next Next $RES = StringSplit(StringTrimLeft($RES, 1), "#") $r = 1 While UBound($RES) - 1 >= $r If Not StringInStr($RES[$r], "+") Then _ArrayDelete($RES, $r) $r -= 1 EndIf $r += 1 WEnd $RES[0] = UBound($RES) - 1 Return $RES EndFunc ;==>_FileLineGetRefined ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineLen ; Description ...: Returns the number of characters in a Line ; Syntax.........: _FileLineLen($FilePath, $LineNum) ; Parameters ....: FilePath - Path Of File. ; LineNum - Number Of Line. ; Return values .: Success - the length of the Line. ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineLen($FilePath, $LineNum) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If Not _FileLineExists($FilePath, $LineNum) Then SetError(2) Return 0 EndIf Local $Arr _FileReadToArray($FilePath, $Arr) Return StringLen($Arr[$LineNum]) EndFunc ;==>_FileLineLen ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineReplace ; Description ...: Replace Line By New Text. ; Syntax.........: _FileLineReplace($FilePath, $LineNum, $NewText) ; Parameters ....: FilePath - Path Of File. ; LineNum - Number Of Line. ; NewText - New Text For Replace Line. ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineReplace($FilePath, $LineNum, $NewText) If Not _IsFileOpen($FilePath) Then SetError(1) Return 0 EndIf If Not _FileLineExists($FilePath, $LineNum) Then SetError(2) Return 0 EndIf Return _FileWriteToLine($FilePath, $LineNum, $NewText, 1) EndFunc ;==>_FileLineReplace ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileLineMerge ; Description ...: Merge Tow Files In 1st File. ; Syntax.........: _FileLineMerge($FilePath_1, $FilePath_2) ; Parameters ....: FilePath_1 - Path Of 1st File. ; FilePath_1 - Path Of 2ed File. ; Return values .: Success - Return 1 ; Failure - Return 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineMerge($FilePath_1, $FilePath_2) If Not _IsFileOpen($FilePath_1) Then SetError(1) Return 0 EndIf If Not _IsFileOpen($FilePath_2) Then SetError(2) Return 0 EndIf $FO1 = FileOpen($FilePath_1, 1) If $FO1 = -1 Then SetError(1) Return 0 EndIf $FO2 = FileOpen($FilePath_2, 0) If $FO2 = -1 Then SetError(2) Return 0 EndIf Local $S = FileWriteLine($FO1, FileRead($FO2)) FileClose($FO1) FileClose($FO2) Return $S EndFunc ;==>_FileLineMerge ; #FUNCTION# ==================================================================================================================== ; Name...........: FileLineGetInfo ; Description ...: Get Info About File Lines. ; Syntax.........: _FileLineGetInfo($FilePath) ; Parameters ....: FilePath - Path Of File. ; Return values .: Success - [Array] An 6 Column : ; 0 Col = Line Number ; 1 Col = Line Text ; 2 Col = Line Len ; 4 Col = Line Upped ; 5 Col = Line Lowed ; 5 Col = Check Line Is Empty ; Failure - [Array] = 0Row = 0 ; @Error = ; 0 = NoError ; 1 = Error opening specified file ; Author ........: Ashalshaikh : Ahmad Alshaikh ; =============================================================================================================================== Func _FileLineGetInfo($FilePath) Local $Err[1] = [0] If Not _IsFileOpen($FilePath) Then SetError(1) Return $Err EndIf Local $RES[_FileCountLines($FilePath) + 1][6] $RES[0][0] = "Line Num." $RES[0][1] = "Line Text" $RES[0][2] = "Line Len" $RES[0][3] = "Line Up" $RES[0][4] = "Line Low" $RES[0][5] = "Line IsEmpty" Local $Arr _FileReadToArray($FilePath, $Arr) For $x = 1 To $Arr[0] $RES[$x][0] = $x $RES[$x][1] = $Arr[$x] $RES[$x][2] = StringLen($Arr[$x]) $RES[$x][3] = StringUpper($Arr[$x]) $RES[$x][4] = StringLower($Arr[$x]) $RES[$x][5] = _FileLineIsEmpty($FilePath, $x) Next Return $RES EndFunc ;==>_FileLineGetInfo Func _IsFileOpen($FilePath) Local $D = FileOpen($FilePath, 0) FileClose($D) If $D = -1 Then Return 0 EndIf Return 1 EndFunc ;==>_IsFileOpen Examples File Line UDF Examples.au3 Thanks ..
  12. Of course .. Such a great idea I will add this in the new version For test 3 is the best version until now
  13. SciTE Hopper .. For test 3 to see all features : ----SciTE Hopper .. For test 1 ----SciTE Hopper .. For test 2 Major mistakes have been fixed :- -------- This problem#15 ---------------- Occur if there is no User Anchors ------------------------ Thanks guinness -------- Jumping to User Anchors does not work Now the search for anchors work very well (( Now just for test )) ;======================================================= ;SciTE Hopper for test 3 ;now you can jump to any line by 1 click !! ;By : Ashalshaikh : Ahmad Alshaikh" ;Thanks to : ; CodeWizard Author : for SciTE Control Functions" ; Koda(form designer) Authors ; Melba23 :: now it's faster !! ; wakillon ; guinness ;tested with Autoit v3.3.6.1 ;link : http://www.autoitscript.com/forum/index.php?showtopic=119544 ;======================================================= SciTE Hopper.au3
  14. thanks .. yes . it's Major error !! I Fix it And two others ..Now I write the new version Reply Thanks Again
  15. New SciTE Hopper : for test 2 !! Changes :- -------- it's much more faster !! ---------------- changed : method of reading au3 file ------------------------ Thanks Melba23 ---------------- changed : method of jumping with Func Anchors -------- Fixed : this problem #12 #13 ---------------- now it checks SciTE Window State !! ------------------------ Thanks wakillon -------- Added : Search box !! ---------------- search for Anchor !! ---------------- Auto Search. ---------------- Problem : with search results !! I will solve it with test 3 -------- Added : Refresh Button (( R )) ---------------- you can use it After searching -------- Added : List Icons ---------------- I know it is ugly , but I will change it later ---------------- I will add enable/disable option pics : New SciTE Hopper : for test 3 !! Major mistakes have been fixed ;======================================================= ;SciTE Hopper for test 2 ;now you can jump to any line by 1 click !! ;By : Ashalshaikh : Ahmad Alshaikh" ;Thanks to : ; CodeWizard Author : for SciTE Control Functions" ; Koda(form designer) Authors ; Melba23 :: now it's faster !! ; wakillon ;tested with Autoit v3.3.6.1 ;link : http://www.autoitscript.com/forum/index.php?showtopic=119544 ;=======================================================(( Now just for test )) Deleted Thanks .. !!
×
×
  • Create New...