Jump to content
Sign in to follow this  
krokkie

Not sending "Enter" command

Recommended Posts

krokkie

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

Share this post


Link to post
Share on other sites
somdcomputerguy

I'm not sure what the ,"",2 part does..

The Help file is good for things like this :oops:

If the application isn't made active in 2 seconds, the Send() isn't executed.

WinWaitActive


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
krokkie

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

Share this post


Link to post
Share on other sites
JLogan3o13

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


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
krokkie

Cheers, I've actually found that if I change it to WinSetOnTop, it seems to work better.

I'll be testing some more in the next few days

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  

×