Modify

Opened 6 months ago

Closed 5 months ago

#3745 closed Bug (No Bug)

bug appears on windows 10, writing to edit control freezes script and crashes it.

Reported by: TheAutomator Owned by: Melba23
Milestone: Component: AutoIt
Version: 3.3.14.0 Severity: None
Keywords: edit, gui, write, append, text Cc:

Description (last modified by mLipok)

referring tho this weird bug:

https://www.autoitscript.com/forum/topic/201263-async-soundplay-freezes-gui/?tab=comments#comment-1445495

my code:

#include <guiconstantsex.au3>
#include <buttonconstants.au3>
#include <windowsconstants.au3>
#include <guiedit.au3>

;--------------------------------------------------------------------------------------------------

const $form = guicreate('TypingError', 600, 400, default, default, bitor($gui_ss_default_gui,$ws_maximizebox,$ws_sizebox,$ws_thickframe,$ws_tabstop))
    guisetbkcolor(0x400000)
    const $console = guictrlcreateedit('loading...', 10, 10, 581, 341, bitor($es_autovscroll,$es_readonly,$es_wantreturn,$ws_vscroll), 0)
        guictrlsetfont(default, 12, 800, 0, 'consolas')
        guictrlsetcolor(default, 0xffffff)
        guictrlsetbkcolor(default, 0x000000)
        guictrlsetresizing(default, bitor($gui_dockleft,$gui_dockright,$gui_docktop,$gui_dockbottom))
        guictrlsetcursor (default, 3)
    const $user = guictrlcreateinput('', 10, 360, 521, 30, default, 0)
        guictrlsetfont(default, 14, 800, 0, 'consolas')
        guictrlsetcolor(default, 0xffffff)
        guictrlsetbkcolor(default, 0x000000)
        guictrlsetresizing(default, bitor($gui_dockleft,$gui_dockright,$gui_dockbottom,$gui_dockwidth,$gui_dockheight))
    const $send = guictrlcreatebutton('send', 540, 360, 51, 31, bitor($es_uppercase,$bs_defpushbutton,$ws_disabled))
        guictrlsetresizing(default, bitor($gui_dockright,$gui_dockbottom,$gui_dockwidth,$gui_dockheight))
        guictrlsetcursor (default, 0)
guisetstate(@sw_show)

;--------------------------------------------------------------------------------------------------

Global $clear = False
func WRITE($message)
    if $clear then
        $clear = False
    else
        _guictrledit_appendtext($console, @crlf)
    endif
    ADD($message)
endfunc

Func ADD($message)
    for $i = 1 to stringlen($message)
        sleep(50)
        _guictrledit_appendtext($console, stringmid($message, $i, 1))
    next
EndFunc

func READ()
    guictrlsetstate($send, $gui_enable)
    while 1
        switch guigetmsg()
            case $gui_event_close
                exit
            case $send
                guictrlsetstate($send, $gui_disable)
                local $answer = guictrlread($user)
                guictrlsetdata($user, '')
                return $answer
        endswitch
    wend
endfunc

HotKeySet('{esc}','quit')
func QUIT()
    write("goodbye...")
    exit
endfunc

;--------------------------------------------------------------------------------------------------

write('this a test of a string with the ' & @CRLF & 'character in it...')
read()
Sleep(1000)
$clear = True
GUICtrlSetData($console, '')
write('this a test of qdfgdqfgqdfga string with the ' & @CRLF & 'character in it...');PROBLEM!
read()
write('this a test oqdgff a string with the ' & @CRLF & 'character in it...')
read()
write('this a t... cbgfshf...e?' & @CRLF & 'character in it...')
read()
write('done')

Attachments (1)

919513622_Aantekening2020-01-16133439.jpg.7010e22040b54d9d8aca32b027ff6792.jpg (29.8 KB) - added by anonymous 6 months ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 6 months ago by Melba23

  • Owner set to Melba23
  • Status changed from new to assigned

comment:2 Changed 6 months ago by mLipok

  • Description modified (diff)

comment:3 Changed 5 months ago by Melba23

  • Resolution set to No Bug
  • Status changed from assigned to closed

It appears Win 10 edit controls do not like being passed a single @CR and will on occasion freeze the whole script. The user must ensure that this does not occur if sending a stream of single characters by introducing a simple check for @CR characters in the stream and passing @CRLF in its place - like this:

Func ADD($message)
    For $i = 1 To StringLen($message)
        Sleep(50)
        ; Look for @CR and @LF
        If StringMid($message, $i, 1) = @CR Or StringMid($message, $i, 1) = @LF Then
            ; If @CR then check it is followed by @LF and send @CRLF in one call and pass over the trailing @LF         
            If StringMid($message, $i, 2) = @CRLF Then $i += 1
            _GUICtrlEdit_AppendText($console, @CRLF)
        Else
            _GUICtrlEdit_AppendText($console, StringMid($message, $i, 1))
        EndIf
    Next
EndFunc   ;==>ADD

As this is not an AutoIt problem we are closing the ticket.

M23

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Melba23.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.