Search the Community
Showing results for tags 'line'.
-
In the autoit file, if we add multiple libraries (both internal and custom created one) When we compile the code and run the exe, some time we are getting runtime errors. But the line number of error is not showing the exact line number, might be it is including the line number count of libraries also. Can you please suggest how to get the exact error line number. So, it will be useful for debugging.
-
hello evrybody here is an example about how to split your texts using a delimiter with the ability to select how much of delimiters shows in each colum with $i_number e.g you have a long text and you want to split it in an array that evry colum have a number (n) of lines i made a function that do that for you just call it with a three params $s_text your text $i_number the number that you want to put in each col $s_siparator the siparator default is "|" here is the function with example i hope that it will be useful for you **** #include <Array.au3> $s_txt = "some text1some text2|some text3|some text4|some text5|some text6" $array = splitText($s_txt, 2) _ArrayDisplay($array) Func splitText($s_text, $i_number, $s_siparator = "|") Local $a_TXT = StringSplit($s_text, $s_siparator) Local $a_Return[$a_TXT[0] + 1] If ($a_TXT[0] <= $i_number) Or ($i_number <= 0) Then ReDim $a_Return[2] $a_Return[0] = 1 $a_Return[1] = $s_text Return $a_Return EndIf Local $i_Processed = 1, $i_arrayProcessed = 1 Do For $i = $i_Processed To ($i_Processed + $i_number) - 1 If ($a_TXT[0] < $i) Then ExitLoop If Not ($a_Return[$i_arrayProcessed]) Then $a_Return[$i_arrayProcessed] = $a_TXT[$i] Else $a_Return[$i_arrayProcessed] &= $s_siparator & $a_TXT[$i] EndIf $i_Processed += 1 Next $i_arrayProcessed += 1 Until ($a_TXT[0] < $i_Processed) ReDim $a_Return[$i_arrayProcessed] $a_Return[0] = $i_arrayProcessed - 1 Return $a_Return EndFunc ;==>splitText accept my greetings thanks to @Dan_555 for his notes
-
Happy New Year everyone! I would like to extract the color values of certain pixels in an image. This is how I picture the workflow: User opens an image of his choice. Image is shown on the screen. User draws a line into the image. This happens by marking the startpixel and the endpixel of the line The line is drawn, so the user can check visually if he is happy with the line. The following pixel based properties belonging to the line are stored in Excel: X-Coordinate Y-Coordinate Color Value Additional operations: Extracting for max- and min. color values; Statistical operations. Browsing through the helpfile of AutoIt I find plenty of functions for treating images (e.g. GDIPlus), but I am completely unsure if Autoit will get me there. Should I read the entire image into an array? Should I rather attempt to script an external image software (e.g. IrfanView, Gimp)? I would be very thankful if someone could give some recommendations and maybe list a couple of the most important commands to use. Thank you very much. Dejhost
-
Hello I have an inquiry from you I have a file path with commands line Is there a way to separate the path from the commands line? I want the result in an array for example $path = '"c:\NVDA\NVDA slav Portable 1\NVDA.exe" -r -m -path="d:\NVDA Path\Portable"' there are any method to separate this text? i want the result to be as that $array[1] = "c:\NVDA\NVDA slav Portable 1\NVDA.exe" $array[2] = '-r -m -path="d:\NVDA Path\Portable"' Thanks in advance am Waiting for your answers
-
Hello my friends I have an inquiry after your permission I found a function to get the special line commands for any operation It requires the name of the process to be searched I want to use it to know the process Is this possible with this function Here is the code Func commandLineGet($proc, $strComputer=".") dim $array[1] local $ArrayNumber local $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") local $oProcessColl = $oWMI.ExecQuery("Select * from Win32_Process where Name= " & '"'& $Proc & '"') local $Process For $Process In $oProcessColl $Process = $Process.Commandline ReDim $Array[UBound($Array)+1] $ArrayNumber = UBound($Array)-1 $array[$ArrayNumber] = $Process Next $ArrayNumber = UBound($Array)-1 $array[0] = $ArrayNumber return $array EndFunc
-
I have another AutoIT script making a Log file Sample of Log file: 2016/08/22 12:44:18 > Process: [RUNNING] [ACTIVE] 2016/08/22 12:48:35 > Process: [WAS NOT RUNNING] 2016/08/22 13:40:00 > Process: [FAILED] 2016/08/22 14:01:10 > Process: [WAS NOT RUNNING] I am looping through the Log file for the word "FAILED" I then want to get all lines that have "FAILED" and get their TIME My Current code to get this far: If FileExists($fileLog) Then $contents = FileRead($fileLog) If @error Then MsgBox(0, 'File Error', $fileLog & ' could not be read.') Else For $i = 1 To _FileCountLines($fileLog) $result = StringInStr($contents,$search) If $result >= 1 Then $filteredLine = FileReadLine($fileLog,$i) If StringInStr($filteredLine,$search) Then ConsoleWrite($filteredLine & @CRLF) ; this gets me the results I want sans the time parse EndIf Else ConsoleWrite( $search & " not found!" & @CRLF) EndIf Next EndIf EndIf For this part: If StringInStr($filteredLine,$search) Then ConsoleWrite($filteredLine & @CRLF) ; this gets me the results I want sans the time parse EndIf OUTPUT: 2016/08/22 13:40:00 > Process: [FAILED] I dont understand how I read the time in that output? I have tried _DateTimeFormat - Dont think this applies Tried _DateDiff - I dont have a the date yet so this doesnt work Would love if someone could tell me if I am thinking is the wrong direction and possibly lead me down the correct path to light side of the force
-
#include <ColorConstants.au3>; Including required files #include <GUIConstantsEx.au3> #include <file.au3> #include <Array.au3> #include <string.au3> Example() Func Example() Local $hash Local $hashes = "hash.txt" _FileReadToArray($hashes, $hash) For $i = 1 to UBound($hash) -1 $hashcheck = $hash[$i] $PDenc = "hash=" & $hashcheck & "&decrypt=Decrypt" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://URLHERE.com/", False) ; Post url $oHTTP.SetRequestHeader("Host", "URLHERE.com") $oHTTP.SetRequestHeader("Connection", "keep-aliveContent-Length: 29") $oHTTP.SetRequestHeader("Cache-Control", "max-age=0") $oHTTP.SetRequestHeader("Origin", "http://URLHERE.com") $oHTTP.SetRequestHeader("Upgrade-Insecure-Requests", "1") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") $oHTTP.SetRequestHeader("Referer", "http://URLHERE.com/") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.8") $oHTTP.Send($PDenc) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status ; Saves the body response regardless of the Response code $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists FileWrite($file, $oReceived) $read = FileRead("Received.html") ;read file $Datastring = ('</script></div><br/>') $newreadamount = _StringBetween($read, $Datastring, "</b><br/><br/>") ;read title from file $newreadamount[0] = StringReplace($newreadamount[0], '<b>', "") ; taking out the X makes it easier to compare values $file = FileOpen("decrypted.txt", 1) FileWrite($file, $newreadamount[0] & @CRLF) Next EndFunc ;==>Example I would like to read up to 500 lines in my file at a time instead of reading the one line each time. is this possible? Lets say I have 500 lines in my document and I would like to add them all to the $PDenc = "hash=" & $hashcheck & "&decrypt=Decrypt" $hashcheck variable. Right now it will only take 1 line each time until all of it is finished. But I would like it to take 500 lines each time to hasten the process. Thanks in advance.
-
Hello! When utilizing GUICtrlSetData to edit what is displayed in a GUICtrlCreateEdit field, is there a way to just make it write new lines rather than clearing what's there and writing the new information? For example ... GUICtrlSetData ($editField, "Line one"&@CRLF , "") GUICtrlSetData ($editField, "Line two"&@CRLF , "") GUICtrlSetData ($editField, "Line three"&@CRLF , "") What happens now if those three things run one after another, the Edit field displays "Line One" , then that is replaced with "Line Two" and so on with the previous information disappearing and the subsequent taking its place. I'd like for it to say all three, one after another. Any documents on how I may accomplish this? Thanks! -Reiz
- 5 replies
-
- guictrlcreateedit
- guictrlsetdata
-
(and 3 more)
Tagged with:
-
http://www.****.com/123.php?id=5|http://www.***.com/services/123.php?id=16|http://www.123.com/questions/q.php?id=5|http://123.com/researcher/view_group.php?id=995|http://www.123.com/en/contest/|http://www.123.com/club/123.php?id=77| How can I sort a file like this in to a line by line .txt file?
-
If $oStatusCode = 404 Then _FileReadToArray("email.txt", $aInput[$i]) For $i = 1 To $aInput[$i] $aInput[$i] &= "[SUCCESS]" Next _FileWriteFromArray("checked.txt", $aInput[$i], 1) EndIf I am trying to write [SUCECSS] on each line in my email.txt file and store it as "Checked.txt" I have written this code from my research here on this forum, but I just can't get it to work. I've tried different ways of using array, also tried using "FileWriteLine" functions, nothing works out for me. I hope someone can point me towards a solution and/or write the code I need with an explanation. Thanks in advance.
-
Hi, is there a way to convert this Code to an Code which can make more than one Color in one line? Func _GUICtrlRichEdit_WriteLine($hWnd, $sText, $iIncrement = 0, $sAttrib = "", $iColor = -1) ; Count the @CRLFs StringReplace(_GUICtrlRichEdit_GetText($hWnd, True), @CRLF, "") Local $iLines = @extended ; Adjust the text char count to account for the @CRLFs Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hWnd, True, True) - $iLines ; Add new text _GUICtrlRichEdit_AppendText($hWnd, $sText & @CRLF) ; Select text between old and new end points _GuiCtrlRichEdit_SetSel($hWnd, $iEndPoint, -1) ; Convert colour from RGB to BGR $iColor = Hex($iColor, 6) $iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2) ; Set colour If $iColor <> -1 Then _GuiCtrlRichEdit_SetCharColor($hWnd, $iColor) ; Set size If $iIncrement <> 0 Then _GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement) ; Set weight If $sAttrib <> "" Then _GUICtrlRichEdit_SetCharAttributes($hWnd, $sAttrib) ; Clear selection _GUICtrlRichEdit_Deselect($hWnd) EndFunc
-
How do you check a script error on a line that doesn't exist? I only have a bit more then 300 lines but the error is on line 1359. are lines from included files also counted? If so, the error is coming from a constants file. can anybody help me with this? FYI : the error only occurs when opening the exe file on a citrix session (not a normal computer) It states: AutoIt Error Line 1359 (File: "H:sdsslvpn.exe"): Error: Variable used without begin declared. If needed I can upload the script
-
How to FileWriteLine() Chinese characters?
Servant posted a topic in AutoIt General Help and Support
First, the value of my $LineArray[0] is "歌词制作 生态。破坏".. And whenever I tried to run this code: FileWriteLine($PathName, $LineArray[0] & @CRLF) The line of the created file produced the "???? ?????" null characters.. Now, what can I do to make it write the original (I think) Chinese characters? -
I have a temp file, which stores necessary variables. One of them is, how often a script was called. Now I'm searching for a way, how to increase the number in the file by one. This is what I've already got: $oldnum = FileReadLine($tempFileName, $line) FileWriteLine($tempFileName, $oldnum + 1) But FileWriteLine just adds a line at the bottom of the file. But I want to overwrite a given line (e.g. line number 7) Thanks, Reinhardt1Julian
-
Hey peeps... I've been searching for any documentation on how to get progress information from a running process and haven't been able to find anything that I can use to learn how to get it done... What am I looking for? Something that will allow me to run an external program, such as defrag or imagex from within a GUI and that will allow the progress of that program to show within the GUI I have created. Sort of like how GimageX displays the progress while it's running. Why am I looking for it? I've spent quite some time trying to find some code that I can learn from which will help me. At my last company I was trying to create a more streamlined, custom GimageX. I have also in the past had need to create a GUI for things like Defrag to simplify the process for end users (even simple can be too complex) and I'd just like to get my head around the process. Does this even exist? This is a question I'd like answering first I guess, is the reason I can't find out how to do it because you can't do it? I imagine that this may not be possible for running executables, but instead through running procedures within a DLL... Which is something else I need to get my head around. So... Can anyone point me in the right direction for tutorials (internal or external) or with some source code which I can play with to get my head around it all? Yours Gratefully.... Mallie x
-
Each time I want try a Command Line Tool I don't remember his switchs ! So I have made this little utility : Get command line parameters Utility v1.0.2.3 The difficulty is they don't answer the same way or not at all ! Script start by trying common switches by 2 ways and leaves you try manually after. You also have the possibility to use an embeded Dos Prompt instead of the edit box. In all cases you can create a text file for save infos. Type "ESC" for quit at any time. A first run compiled is needed for install a contextual menu for exefile. As usual externals files are downloaded at first execution. See Tray menu for options. Previous downloads : 628 Update 2012-06-30 Source : GetCommandLineParameters v1.0.2.3.au3 executable : GetCommandLineParameters.exe.html (Once this html file downloaded, double click on it for start the download) Sure it will help you !
- 15 replies
-
;; suggested filename: "SplitLineMerge.au3" ;; Just run(build) it on it self to test it. (SciTe4AutoIt3) ;; Generally tested. (possible rare exceptions ignored.) ;; ... Not intended to be used on none Obfuscated au3 files. ;; include these 3 lines in your source code. (with <foobar> parts adjusted to your situation.) #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #AutoIt3Wrapper_Run_After=<Filespec_To_AutoIt3.exe, (not accepting quotes:?)> /AutoIt3ExecuteScript "<Path_To>\SplitLineMerge.au3" "%in%" DebugOut('>Running: Obfuscated_SplitLineMerge, CMD: ' & $CmdLineRaw) If Not $CmdLine[0] Then DebugOut_Exit('!>No CmdLine input.', 1) If Not IsFile($CmdLine[1]) Then DebugOut_Exit('!>Target source file not found.', 3) _SplitLineMerge($CmdLine[1]) Exit Func _SplitLineMerge($sFile_Au3) If StringRight($sFile_Au3, 4) <> '.au3' Then _ DebugOut_Exit('!>Target file not a ".au3" file.', 4) Local $sFile_Source = StringTrimRight($sFile_Au3, 4) & '_Obfuscated.au3' If Not IsFile($sFile_Source) Then _ DebugOut_Exit('!>Target "*_Obfuscated.au3" file not found.', 5) Local $sCode = FileRead($sFile_Source) $sCode = StringReplace($sCode, ' _' & @CRLF, ' ', 0, 2) Local $iCount = @extended Local $sFile_Target = StringTrimRight($sFile_Source, 4) & '_MergedSplitLines.au3' If FileExists($sFile_Target) And Not FileExists($sFile_Target & '\') And Not FileDelete($sFile_Target) Then _ DebugOut_Exit('!>FileDelete "' & $sFile_Target & '" failed.', 6) If Not FileWrite($sFile_Target, $sCode) Then _ DebugOut_Exit('!>FileWrite "' & $sFile_Target & '" failed.', 7) DebugOut('+>"' & $sFile_Target & '" file written, ' & $iCount & ' lines merged.') EndFunc Func IsFile($sFile) Return FileExists($sFile) And Not FileExists($sFile & '\') EndFunc ;; --- Func DebugOut($1, $2 = 'fOObAr') If Not ($2 == 'fOObAr') Then $1 &= ' = ' & String($2) Return ConsoleWrite($1 & @CRLF) EndFunc Func DebugOut_Exit($1, $2 = 0) ConsoleWrite($1 & @CRLF) Exit $2 EndFunc(Edits: Title adjust, Title adjust 2, ...)
-
- debug
- error line
-
(and 3 more)
Tagged with: