Jump to content

Not sending "Enter" command


Recommended Posts

This is the section of the script:

If WinWaitActive("classname=TsDBGlobal","",2) = 1 Then

Send("{Enter}")

I've verified that the classname is correct.

The window is active, but nothing happens

I'm not sure what the ,"",2 part does, and if it has anything to do with the issue

Link to comment
Share on other sites

Cheers mate, it makes sense now

Here is the complete script, maybe it will make better sense:

#include <file.au3> ;Required for log functionality

AutoItSetOption("WinTitleMatchMode", 4)

AutoItSetOption("MustDeclareVars",1)

Dim $Company, $User, $Pwd, $Drive, $WorkingDir, $LogDir, $AppName, $Result

$Company = "ZZZ"

$User = "AUTI"

$Pwd = "a"

$Drive = "P"

$WorkingDir = "aklap911.corp.ad.airnz.co.nzsdmpFltCtrl"

$LogDir = "sdmpappserver.corp.ad.airnz.co.nzSDMPAPPScriptsPurgeDisabledRecords"

_FileWriteLog($LogDir & "PurgeDisabledRecords.log","Starting Purge CODES") ;Writes date and time, and message to logfile

AutoItSetOption("WinTitleMatchMode", 4)

If ($CmdLine[0] = 1) Then

If StringLen($CmdLine[1]) = 1 Then

$Drive = $CmdLine[1]

EndIf

Endif

While WinActivate("Dispatch Manager - ") = 1

Send("!F")

Send("x")

WEnd

$AppName = $Drive &":FltCtrlBinDISPMGR.exe N " & $User & $Drive & $Drive & $Drive & "CAANZ" _

& $Drive & "OYz FLTCTRL EAGLEOX " & $Drive

Run($AppName,$WorkingDir)

WinWaitActive("Dispatch Manager Sign In")

Send($Pwd & "{Tab 4}" & $Company & "{Enter}")

Send("{Enter}")

WinWaitActive("Dispatch Manager - ")

PurgeDisabled("!IC")

;MsgBox(0,"Purge Disabled Records","Purge Disabled Records Complete")

ExitDM()

Func PurgeDisabled($KeyStrokes)

AutoItSetOption("SendKeyDelay",20)

WinActivate("Dispatch Manager - ")

Send($KeyStrokes)

WinWaitActive("classname=TsEnterString","")

Send("ZZZ")

Send("!O")

WinWaitActive("classname=TsDBFile")

Send("!G")

Send("P")

Send("!O")

Send("!O")

If WinWaitActive("classname=TsDBGlobal","",2) = 1 Then

Send("{Enter}")

If WinWaitActive("classname=TsDBFile","",2) = 1 Then

EndIf

EndIf

WinWaitActive("classname=TMessageForm")

Send("{Enter}")

Send("!x")

AutoItSetOption("SendKeyDelay",Default)

WinActivate("Dispatch Manager - ")

EndFunc

Func ExitDM()

WinActivate("Dispatch Manager - ")

Send("!F")

Send("x")

_FileWriteLog($LogDir & "PurgeDisabledRecords.log","Completed Purge CODES") ;Writes date and time, and message to logfile

EndFunc

The bit that does not work is Bold and underlined.

Funny that the bit after it works fine

Link to comment
Share on other sites

  • Moderators

Hi, krokkie. I would suggest reviewing the help file for WinActive, you're not declaring the class correctly (missing brackets).

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...