Sign in to follow this  
Followers 0
kaiks

Problem with ControlSend

4 posts in this topic

Hi, I'm new to this forums

I've problem with ControlSend function, here's the code

#include <file.au3>

$window="whatever"
$path="c:\path\to\some\file.txt"
AutoItSetOption("WinTitleMatchMode", 4)
$handle = WinGetHandle($window, "")
$line=_FileCountLines($path)
$file=FileOpen($path,0)

;==============================================================================
While 1
Sleep(100)
While FileReadLine ($file,$line) = ""
Sleep(100)
WEnd
Sleep(100)
ControlSend($handle,"","",FileReadLine($file,$line),0)
;MsgBox(0,"bla",FileReadLine($file,$line)) <-- to test if problem was in fileread, it worked fine tho
Sleep(300)
ControlSend($handle,"","","{Enter}")
Sleep(100)
$line=$line+1
WEnd

That program is supposed to find a new line in some file and 'paste' it to other window...

When the line is for example 'blablablablabla' it works good...

But when the line is 'blaBLAbla!!!!bla' it sends 'blablabla1111bla'

Using Send function works good too, but that's not what I want

Any help?

Share this post


Link to post
Share on other sites



Hi,

have you tried to set the flag to 1 ?

ControlSend ( "title", "text", controlID, "string" [, flag] )

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

have you tried to set the flag to 1 ?

ControlSend ( "title", "text", controlID, "string" [, flag] )

So long,

Mega

yes...doesnt work;p

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

HI,

this works for me (Notepad.exe) Title in German Editor - Unbenannt.

#include <file.au3>

$window = "Unbenannt - Editor"
$path = "Controlsend.txt"
AutoItSetOption("WinTitleMatchMode", 4)
$handle = WinGetHandle($window, "")
$line = _FileCountLines($path)
$file = FileOpen($path, 0)

;==============================================================================
While 1
    Sleep(100)
    While FileReadLine($file, $line) = ""
        Sleep(100)
    WEnd
    Sleep(100)
    Local $text = FileReadLine($file, $line)
    ControlSend($window, "", 15, $text, 1)
    ;MsgBox(0,"bla",FileReadLine($file,$line)) ;<-- to test if problem was in fileread, it worked fine tho
    Sleep(300)
    ControlSend($window, "", 15, "{Enter}")
    Sleep(100)
    $line = $line + 1
WEnd

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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