AutoBert Posted September 18, 2016 Share Posted September 18, 2016 Func _fnr() $time = _Now() ;MsgBox(0, "hello", $timestr) $count = _GUICtrlListView_GetItemCount($ListView1) ;Local $logfile = $open & "\" & $time & ".log" Local $sLog = "itworks.log" MsgBox(0, "hello", $count) For $i = 0 To $count $find = _GUICtrlListView_GetItemText($ListView1, $i) ;<====== $replace = _GUICtrlListView_GetItemText($ListView1, $i, 1) ;<====== If StringStripWS($find, $STR_STRIPALL) = "" Then ContinueLoop ;$find mustn't be empty If StringStripWS($replace, $STR_STRIPALL) = "" Then ContinueLoop ;$reolace mustn't be empty MsgBox(0, "test", $find & " " & $replace) ;For $j = 1 To $FileList[0] ;don't use more than one Filelist can be added to $List1 For $j = 0 To _GUICtrlListBox_GetCount($List1) - 1 $sFile = _GUICtrlListBox_GetText($List1, $j) MsgBox(0, "hello", $sFile,2) ;_ReplaceInFile($sLog, $sFile, $find, $replace) Next Next ;MsgBox(0, "Test", $a) EndFunc ;==>_fnr Link to comment Share on other sites More sharing options...
pranaynanda Posted September 19, 2016 Author Share Posted September 19, 2016 @AutoBert Thank you a million times! Link to comment Share on other sites More sharing options...
pranaynanda Posted September 19, 2016 Author Share Posted September 19, 2016 One last help needed is with how to add parameters? I can work with cmdline[0] and other stuff but how to add options like -l,-f and others etc..? I want to be able to use it via command line where CmdLine[1]=$open, CmdLine[2]=$find Cmd[3]=$replace... Link to comment Share on other sites More sharing options...
AutoBert Posted September 19, 2016 Share Posted September 19, 2016 Read Link to comment Share on other sites More sharing options...
pranaynanda Posted September 20, 2016 Author Share Posted September 20, 2016 Thanks! Btw, I did this: If $CmdLine[0] > 0 Then Global $FileList = _FileListToArrayRec($CmdLine[1], "*.*",1,1,1,2) $sLog = @ScriptDir& "\" & $date & ".log" For $i=1 to $FileList[0] For $j=2 to $CmdLine[0] Step 1 If Mod($j,2)=0 Then ;$sFile=$CmdLine[1] $find=$CmdLine[$j] $replace=$CmdLine[$j+1] ;if @error Then ContinueLoop ;Else ; $replace=$CmdLine[$j] ; if @error Then ContinueLoop EndIf $sFile=$FileList[$i] _ReplaceInFile($sLog, $sFile, $find, $replace) Next Next Exit EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now