Jump to content

Recommended Posts

Posted

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?

Posted

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)

 

Posted (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 by Andreik
Posted (edited)

I'm getting an error.  I don't understand why my script won't catch it.

DazzelError.jpg.ad1cacd7583fbe75445fee24227b5438.jpg

This is my full script:

Opt("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 by Docfxit
Posted (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 by Docfxit
Posted

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.

Posted

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.

Posted (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.

AutoItVersion.jpg.2bf394d1dc74bc22d56f4b57f1a796f0.jpg

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 by Docfxit
Posted

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.

Posted

This is what I am getting in the console:

LogList
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.

Posted (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 by Andreik
Posted (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 by Docfxit
Posted (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 by Docfxit

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...