Sign in to follow this  
Followers 0
Michel Claveau

Send data to au3-script?

13 posts in this topic

#1 ·  Posted (edited)

Hi!

I search to send data to (standalone) au3-scripts (.au3 or compiled .exe), already running, with GUI (not AutoIt-X, isn't it! with it, no problem)

Like with COM/Ole-automation, when using call function ( e.g.: ie.navigate($data))

I had explore:

- file: slow, difficult (lock managment),

- environment: limited size, limited variety functions

- register: slow, restricting, dangerous

- TCP/IP server: run OK, but complex to install

- clipboard: not reliable for intensive use

I had some ideas:

- memmap (mmap): I know how in Python, Ruby, but not in AutoIt! (shame!)

- shared-memory-object: I know how with javascript, Python, but not in AutoIt!

- common (mono-instance) COM server: I had experiment problems in concurrent use (freeze)

Consequently: who had a genious idea? and *sorry for my bad english*

Edited by Michel Claveau

Share this post


Link to post
Share on other sites



Hi!

I search to send data to (standalone) au3-scripts (.au3 or compiled .exe), already running, with GUI (not AutoIt-X, isn't it! with it, no problem)

Like with COM/Ole-automation, when using call function ( e.g.: ie.navigate($data))

I had explore:

- file: slow, difficult (lock managment),

- environment: limited size, limited variety functions

- register: slow, restricting, dangerous

- TCP/IP server: run OK, but complex to install

I had some ideas:

- memmap (mmap): I know how in Python, Ruby, but not in AutoIt! (shame!)

- shared-memory-object: I know how with javascript, Python, but not in AutoIt!

- common (mono-instance) COM server: I had experiment problems in concurrent use (freeze)

Consequently: who had a genious idea? and *sorry for my bad english*

did you try in a while loop to check for a value in a control in the app with

ControlGetText

if a specific value is in then do the action you want in autoit

Share this post


Link to post
Share on other sites

Hi!

did you try ... ControlGetText

Thanks!

It's an idea. I will try. But I have a doubt for performance. I will give results of tests.

Ideal will be Autoit-X with GUI, but, I think that is not for tomorrow...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Re-Hi !

Results of tests:

- with only ControlSetText in loop: 0,5 millisec by set (assignment)

- with ControlGetHandle+ControlSetText in loop: 1/100e sec by set (assignment)

It's quite slow, but it's playable...

Edited by Michel Claveau

Share this post


Link to post
Share on other sites

Re-Hi !

Results of tests:

- with only ControlSetText in loop: 0,5 millisec by set (assignment)

- with ControlGetHandle+ControlSetText in loop: 1/100e sec by set (assignment)

It's quite slow, but it's playable...

can you give the code of the loop.

I do'nt understand why you use controlsettext as I thought you wanted to send from your app some info to autoit

That was why I talked about controlgettext to retrieve info from your app

Share this post


Link to post
Share on other sites

Hi, tresa!

Exemple of I want obtain:

A message utility, stay visible, and can be "updatable" by batch.

For this, I write two softwares:

-1. the utility who display the message (stay visible)

-2. the utility who write data (param from command-line) in the (good) control of the first software

Other case: use AutoIt-script like dynamic GUI, for application write in Python (or Ruby)

Another exemple: using ActiveX from a Batch.

etc.

Share this post


Link to post
Share on other sites

Hi, piccaso!

>>> how about windows messages?

Sorry, my english is too many poor for understand...

You want to said "use windows API/windows messages"? I don't try this way. But the slow part is the identification of the control, not easy to (re)-write.

Share this post


Link to post
Share on other sites

Yes thats what i wanted to say.

Here is an example for using WM_COPYDATA with autoit

you can allso create shared memory struct with DllStruct* and GlobalAlloc API...


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Hi!

an example for using WM_COPYDATA with autoit

Thanks! very interesting. Speed is only very little faster.

But it's a possible way.

I have now two solutions.

Thanks.

Share this post


Link to post
Share on other sites

Both of your threads have concerns on "speed". If this is such a concern to you, why not try to write your script in a lower leveled language?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

re-Hi, piccaso!

After complementary tests, I found your solution more flexible and better for the "montée en charge" (sorry, it's french expression, because I don't know the translation).

Share this post


Link to post
Share on other sites

udp localloops are quite fast too...

UDPStartup()

Func _IPC_GetSocket($iPort = 6789, $sBind = "127.0.0.1")
    Local $hSock, $iErr
    $hSock = UDPBind($sBind,$iPort)
    $iErr = @error
    If $iErr = 1 Or $iErr = 2 Then
        Return SetError($iErr,0,-1)
    ElseIf $iErr = 0 And $hSock <> -1 Then
        Return $hSock
    EndIf
    $hSock = UDPOpen($sBind,$iPort)
    Return SetError(@error,@extended,$hSock)
EndFunc

$hSock1 = _IPC_GetSocket() ; Server
$hSock2 = _IPC_GetSocket() ; Client

; Server must be binded first but Client must initiate transfair

$iTimer = TimerInit()
UDPSend($hSock2,"2 -> 1 : Msg One" & @CR)
While 1
    $sBuff = UDPRecv($hSock1,256)
    If $sBuff Then
        ConsoleWrite($sBuff)
        ExitLoop
    EndIf
WEnd
ConsoleWrite("Time: " & TimerDiff($iTimer) & @LF)

$iTimer = TimerInit()
UDPSend($hSock1,"1 -> 2 : Msg Two" & @CR)
While 1
    $sBuff = UDPRecv($hSock2,256)
    If $sBuff Then
        ConsoleWrite($sBuff)
        ExitLoop
    EndIf
WEnd
ConsoleWrite("Time: " & TimerDiff($iTimer) & @LF)

UDPShutdown()

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

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