Sign in to follow this  
Followers 0

script not working

3 posts in this topic

i created 2 scriptsa that sync with eachother...

but one of the scripts gui's(papertape) dosent respond



#include <GUIConstants.au3>
global $et
GUICreate("papertape", 262, 339, 624, 128, -1)
$edit = GUICtrlCreateEdit("",0,0,262,339)
if $cmdline[0] <> 1 Then
while 1
    $data = ""
    $data = consoleread()
    if $data = "hide" Then
    ElseIf $data = "show" Then
    elseif $data = "clear" Then
        $et = ""
    ElseIf stringleft($data,2) = "st" Then
        $st = stringsplit($data," ")
        if $st[0] = 2 Then
            if $et = "" Then
                $et = $st[2]
                $et = @lf & $st[2]
    elseif $data = "exit" then
    $guimsg = guigetmsg()
    Switch $guimsg
        case $GUI_EVENT_CLOSE
            if consoleread() = "exit" Then

[size="10"]Pure Au3 crypt funcs(I'm currently also working on making a dll from this)[/size][Y] Be more active in the community[Y] Get 200 posts[N] Get 300 posts[N] Make a Topic in the example scripts forum with at least 50 replies.People who currently hate me:ValikSmOke_N

Share this post

Link to post
Share on other sites

Your ConsoleRead() is hanging because there is no input. From the help file:

If at any time when this function is called (except for "peeking" as described below) there are no characters to be read from the stream, the ConsoleRead function will block (pause) and not return until there are characters to be read from the stream. This means that the AutoIt process will be halted, and there will be no processing of hotkeys, GUI messages, etc. until the parent process writes something to AutoIt's STDIN stream.

Use "peek" to check for available input before reading:

While 1
    $data = ""
    If ConsoleRead(0, 1) Then $data = ConsoleRead()

    ; ...


Running that in a tight loop is likely to get you occasional partial messages. If you send "The quick brown fox", the console read might only get "The qui" and then get "ck brown fox" on the next loop. You might need a test for whatever end of line character is used.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

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
Sign in to follow this  
Followers 0