krokkie Posted March 14, 2012 Share Posted March 14, 2012 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 More sharing options...
somdcomputerguy Posted March 14, 2012 Share Posted March 14, 2012 I'm not sure what the ,"",2 part does..The Help file is good for things like this 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. Link to comment Share on other sites More sharing options...
krokkie Posted March 14, 2012 Author Share Posted March 14, 2012 Cheers mate, it makes sense nowHere is the complete script, maybe it will make better sense:#include <file.au3> ;Required for log functionalityAutoItSetOption("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 logfileAutoItSetOption("WinTitleMatchMode", 4)If ($CmdLine[0] = 1) Then If StringLen($CmdLine[1]) = 1 Then $Drive = $CmdLine[1] EndIfEndifWhile WinActivate("Dispatch Manager - ") = 1 Send("!F") Send("x")WEnd$AppName = $Drive &":FltCtrlBinDISPMGR.exe N " & $User & $Drive & $Drive & $Drive & "CAANZ" _ & $Drive & "OYz FLTCTRL EAGLEOX " & $DriveRun($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 - ")EndFuncFunc ExitDM() WinActivate("Dispatch Manager - ") Send("!F") Send("x") _FileWriteLog($LogDir & "PurgeDisabledRecords.log","Completed Purge CODES") ;Writes date and time, and message to logfileEndFuncThe bit that does not work is Bold and underlined.Funny that the bit after it works fine Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 15, 2012 Moderators Share Posted March 15, 2012 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 More sharing options...
krokkie Posted March 15, 2012 Author Share Posted March 15, 2012 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now