Sign in to follow this  
Followers 0
idanmiller

Running AutoIT script synchronously

2 posts in this topic

Hello,

I'm trying to run the _ScreenCapture_CaptureWnd helper function from my ruby script.

I tried using AutoitX with COM, but the interface doesn't include the function.

Also, I need to run the script synchronously, and know when it ends.

How can I do that?

I noticed that with command line, the script runs asynchronously.

Also, is there a way to run it from COM? And if so, will that be synchronous?

Thanks,

Idan.

Share this post


Link to post
Share on other sites

I think you need a background script running, to which your AutoItX calls will send messages to trigger actions like a screen capture:

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

' Get current state of back end script
' Text in Input1 = "" when not busy
var = oAutoIt.ControlGetText("BackEndScript", "", "Input1")

If var = "" Then
    oAutoIt.ControlSetText "Untitled -", "", "Edit1", "COMMAND SCREENSHOT"
Else
    ' Handle it if back end script was busy
End If

In this case, BackEndScript is a regular compiled AutoIt script with a GUI and an Input control. By placing commands in Input1, BackEndScript is directed to do things. When the action is done, it clears Input1 to indicate readiness for the next command.

There are much more sophisticated methods for inter-process communications, but this gives one basic example. If the calls don't come too often, then simply running your helper script with command line switches would be enough.

:idea:


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