Jump to content
Sign in to follow this  

SendkeepActive doesn't work on VbScript

Recommended Posts


I use AutoIt into VB Script.

It is really cool scripting language !

I have to use it to make automatic translation with Visual Translate.

But, when I use Call objAutoIt.SendKeepActive instruction, the vb script crash : unknown command on this objet (don't know the real message in english because i'm french) : this function is unknown on objAutoIt object

If I remove all SendKeepActive instruction, the script work fine, but i'm afraid if the user change the window's focus on another one.

Any idea ?

' Start of AutoIt Script

Dim objAutoIt
Set objAutoIt = WScript.CreateObject("AutoItX3.Control")

Call objAutoIt.Run("C:\Program Files\Visual Translate\VTRANS.EXE")
Call objAutoIt.Opt("WinTitleMatchMode", 2)   ' 1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

' Running Visual Translate
If objAutoIt.WinWaitActive("Visual Translate","",5) = 1 Then
    Call objAutoIt.SendKeepActive("Visual Translate")
    ' Open dic file
    Call objAutoIt.Send("!fo")
    ' Wait Open window to open
    If objAutoIt.WinWaitActive("Ouvrir","",1) = 1 Then
        Call objAutoIt.SendKeepActive("Ouvrir")
        Call objAutoIt.Send("T:\dispatcher\exe\uk\DISPATCHER UK.dic{ENTER}")
        ' Waite Open window to close
        Call objAutoIt.WinWaitClose("Ouvrir")
        ' Si apparition de la fenĂȘtre Visual "Translate" contenant le texte "to extract the new resource" faire Yes All
        If objAutoIt.WinWaitActive("Visual Translate","to extract the new resource",1) = 1 Then
            Call objAutoIt.ControlClick("Visual Translate","",1121) ' Appui sur le bouton "Yes All"
            If objAutoIt.WinWaitActive("Extract resources","",1) = 1 Then
                Call objAutoIt.ControlClick("Extract resources","",12325) ' Appui sur le bouton "Terminer"
                Call objAutoIt.WinWaitClose("Extract resources")
            End If
        End If
        Call objAutoIt.SendKeepActive("Visual Translate")
        ' Supprimer les ressources non utilisĂ©es
        Call objAutoIt.Send("!tu")
        Call objAutoIt.WinWaitActive("Unused texts")
        Call objAutoIt.ControlClick("Unused texts","",1085) ' Remove All
        Call objAutoIt.ControlClick("Unused texts","",1)    ' Close
        Call objAutoIt.WinWaitClose("Unused texts")

        Call objAutoIt.Send("!fs") ' Sauver
        Call objAutoIt.Send("!fq") ' Quitter
    End If
End If

Set objAutoIt = Nothing


Share this post

Link to post
Share on other sites

Welcome to the forums!

SendKeepActive isn't supported in the latest AutoItX.

Instead of Send, try to use the following functions because they don't require the window to be active or even visible:

ControlSend, ControlSetText, ControlClick, ControlCommand, and WinMenuSelectItem

There's also a separate forum for AutoItX where you may find more relevant information.


Good luck!

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post

Link to post
Share on other sites

Thanks for your reply, I'll see tomorrow at work.

I'm working with lot of script (vbscript) to automatize heavy task. This software is very interesting in complement of VBscript.

It can be usefull to make software tests (like WinRunner).

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