Docfxit Posted July 5, 2023 Posted July 5, 2023 With this code: Local $text = WinGetText("", "") MsgBox($MB_SYSTEMMODAL, "", "Full text read is: " & $text) When it pops up on the screen the window is larger than screen so I can't read all the text. Is there a way to remove all the blank lines?
Andreik Posted July 5, 2023 Posted July 5, 2023 Hardly to believe since MsgBox() has mechanisms that prevents being larger than working area. For blank lines you can use StringStripWS() but what blank lines? Show us a picture with the MsgBox() overflowing the working area. I used the code below to display in MsgBox() 80k chars and still couldn't do that. Local $text For $i = 1 To 80000 $text &= Chr(Random(97, 122, 1)) Next MsgBox(4096, "", "Full text read is: " & $text)
Andreik Posted July 5, 2023 Posted July 5, 2023 (edited) That's because the string contain multiple lines. You can replace the CRLF with a space or something else and optionally you can strip leading, trailing and multiple white spaces. This will produce a string that will never overflow the working area and if it's too long the string will be automatically trimmed. Local $text For $i = 1 To 10000 $text &= 'Some line ' & $i & @CRLF Next MsgBox(4096, "", "Full text read is: " & $text) MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace($text, @CRLF, ' '), 7)) Or you can use a custom GUI to display the message like a MsgBox(). Edited July 5, 2023 by Andreik
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 That helped a bunch. I still can't read what I'm looking for.
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 (edited) I'm getting an error. I don't understand why my script won't catch it. This is my full script: expandcollapse popupOpt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) Opt("TrayAutoPause", 0) #include "Notify.au3" #include "StringSize.au3" #include <MsgBoxConstants.au3> AutoItSetOption("TrayIconDebug", 1) ;0-off ; Set so that tray displays current line number ; Press ESC to exit script HotKeySet("{ESC}", "_Exit") Dim $ErrorCount, $textLine ; Register message for click event _Notify_RegMsg() ; Set notification location _Notify_Locate(0) _Notify_Set(Default) ; Show notifications Global $aNotCID[5] ;$aNotCID[1] = _Notify_Show(0, "", "Message 2" & @CRLF & "more Message 2") ;$aNotCID[4] = _Notify_Show(0, "DAZzle 3", "Auto-retract", 1) While 1 WinExists("DAZzle Professional") If Not WinActive("DAZzle Professional", "") Then WinActivate("DAZzle Professional", "") Local $title = WinGetTitle("DAZzle Professional", "") MsgBox($MB_SYSTEMMODAL, "", "Full title read is: " & $title) Local $text = WinGetText("", "") ;MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace($text, @CRLF, ' '), 7)) MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace(StringReplace($text, Chr(0), ''), @CRLF, ' '), 7)) ;ConsoleWrite ( StringStripWS(StringReplace($text, @CRLF, ' '), 7)) $file = FileOpen("\Dnload\DazzleErrorFix.txt", 2) FileWrite($file, StringStripWS(StringReplace($text, @CRLF, ' '), 7)) FileClose($file) If $title = "DAZzle Professional" And $text = "The file DAZzle Prof" Then $ErrorCount = $ErrorCount + 1 $aNotCID[1] = _Notify_Show(0, "DAZzle 2", "The file DAZzle Prof") Send("{ENTER}") EndIf If $title = "Error" And $text = "The remote server re" Then $ErrorCount = $ErrorCount + 1 $aNotCID[2] = _Notify_Show(0, "DAZzle 3", "The remote server" & @CRLF & "more Message 4") Send("{ENTER}") EndIf If $title = "Error" And $text = "The remote server returned" Then $ErrorCount = $ErrorCount + 1 $aNotCID[3] = _Notify_Show(0, "DAZzle 4", "The remote server") Send("{ENTER}") EndIf If $title = "DAZzle Professional" And $text = "Error from CreateLab" Then $ErrorCount = $ErrorCount + 1 $aNotCID[4] = _Notify_Show(0, "DAZzle 5", "Error from CreateLab" & @CRLF & "more Message 4") Send("{ENTER}") EndIf If $title = "DAZzle Professional" And $text = "Failed to complete t" Then $ErrorCount = $ErrorCount + 1 $aNotCID[5] = _Notify_Show(0, "DAZzle 6", "Failed to complete" & @CRLF & "more Message 4") Send("{ENTER}") EndIf If $ErrorCount > 0 Then $aNotCID[0] = _Notify_Show(0, "DAZzle 1", "Errors Found: " & $ErrorCount, 8) EndIf Sleep(8000) ; For debug purposes only For $i = 0 To 4 $sRet = _CheckRetractionMethod($aNotCID[$i]) If $sRet Then ConsoleWrite("Notification " & $i + 1 & ": " & $sRet & @CRLF) EndIf Next WEnd Func _CheckRetractionMethod($hWnd) Local $sRet = "" ; Check if notification was the last clicked Local $aFuncRet = _Notify_RetractCheck($hWnd) ; Determine method of retraction Switch $aFuncRet[0] Case 0 ; Do nothing - notification either still visible or already retracted Case 1 $sRet = "Title clicked :: " & $aFuncRet[1] Case 2 $sRet = "Message clicked :: " & $aFuncRet[1] Case 9 $sRet = "Timeout :: " & $aFuncRet[1] EndSwitch Return $sRet EndFunc ;==>_CheckRetractionMethod Func _Exit() Exit EndFunc ;==>_Exit Edited July 5, 2023 by Docfxit
Andreik Posted July 5, 2023 Posted July 5, 2023 Seems like you made too many requests and you have to take a break. Anyway, what is this Notify UDF?
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 (edited) It is supposed to show me when I get an error. The script is supposed to answer the messages and let the program continue. The notify was showing but it wasn't showing the $ErrorCount so I commented Line 61 out. $ErrorCount Edited July 5, 2023 by Docfxit
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 The program is created to make those request. It's an error in the program. I have reported it to Endicia. In the mean time until they fix their program I need to keep answering the messages.
Andreik Posted July 5, 2023 Posted July 5, 2023 Let me understand exactly what do you want to do. As I understand you have this app DAZzle Professional that may throw some errors and display the message in a window so you are looping and try to find if one of these error windows popup and count/log the error and then send Enter to continue the application. Is that right? If so use the AutoIt Window Info on one of this error window and let us show the info.
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 (edited) You are correct. That is exactly what the DAZzle program is doing. I'd like to use the AutoIt Info window. Every time I do it locks up the computer and I have to reboot. I have updated AutoIt to the latest version. I have run Chkdsk /r to fix any files. I have run sfc /scannow to fix any system files. I have run AutoIt Info Window 64bit and 32bit. I have run Tweaking Windows Repair All in One. AutoIt Info window still crashes the computer. I have Windows Defender turned off. I have Windows Firewall turned off. I have my Antivirus turned off. Edited July 5, 2023 by Docfxit
Andreik Posted July 5, 2023 Posted July 5, 2023 Ok, then use ConsoleWrite() to display window title and the text so we can figure it out. If it doesn't display anything in the console it means you didn't use the correct title for the window.
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 This is what I am getting in the console: expandcollapse popupLogList Details Show orders from: LogList Details Data Privacy Info You have printed X SmartSaver labels, which require a Container label. Last Name: ABList Address Details F&ull Name... &Address... &Job Title: Compan&y: Phone: E-Mail: Rate Advisor... Read Scale Use Stealth Label Value More Options Print Use Non-machinable price Use soft pack cubic price Use retail price Show Additional Fields This is an eBay item Customs Form Verify Address International Info... Test Print Clear Form Printer Setup From: Printer: &Feed Source: Paper &Size: Charges Total Cost: Insufficient Funds! N/A To: Address Not Validated Send Shipment Email Notification To: Package Type: Service: Weight: Height (thickness): Length: Width: Insurance/Coverage Value: Endicia Parcel Insurance fee: (billed separately) Extra Services: Package Description: Reference ID: Group Code: Dimension: eBay Seller: Address Information Printer Settings Preview Physical Characteristics Shipping Options Additional Fields Recipient Phone Number: Ship Date: Base Cost: Extra Service: Insurance/Coverage Provider: Ending Balance: Display on label Returns Mode Actual postage amount on invoice may vary due to currency fluctuations. Large Package A Large Package Surcharge has been applied to this package. oz lbs Duties/Taxes: Carrier: Saturday Delivery Additional Handling (+$) Residential Address Switch to UPS® Ground and Save More Info Because It has More Info it sounds to me the console has a limitation. I think I need to write it out to a file instead.
Andreik Posted July 5, 2023 Posted July 5, 2023 (edited) I doubt but you can write everything to a file in binary mode. There might be an issue in displaying a message box if your string contains weird chars like null character. Try to replace null chars and see if the MsgBox() display what you want MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace(StringReplace($text, Chr(0), ''), @CRLF, ' '), 7)) Edited July 5, 2023 by Andreik
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 I wrote it out to a file. That's all the text there is.
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 (edited) Good thinking. It wrote out the same number of characters to the file. I have replaced the code above with what I currently have. Edited July 5, 2023 by Docfxit
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 (edited) The error message is on the screen. AutoIt isn't seeing it. I think I know why. The script is looking for the title WinExists("DAZzle Professional") And that program is open. I need the script to see a different window with the title "Error" Edited July 5, 2023 by Docfxit
Andreik Posted July 5, 2023 Posted July 5, 2023 Make a print screen to get it's name properly or use AutoItSetOption('WinTitleMatchMode', 2) for partially match.
Docfxit Posted July 5, 2023 Author Posted July 5, 2023 Now I'm getting: I had Opt("WinTitleMatchMode", 4) I changed it to 2 and now the text screen is showing the above.
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