Jump to content

WinWaitActive?


krokkie
 Share

Recommended Posts

I have a job that runs as a scheduled task, but because I have other apps runing on the server, it seems to stop at the login prompt.

When you click on it, it then proceeds to run the job without problems.

This is the part of the script that causes the issue:

;Sign In

WinWaitActive("Dispatch Manager Sign In")

Send($Pwd & "{Enter}")

WinWaitActive("classname=TMessageForm")

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

Send("{Enter}")

; ExitDM()

I tried changing the second WinWaitActive to WinActive, but it still fails

If I change bot to WinActive, it does not carry on with the job

What command do I use to force the login prompt to always be active, no matter what other apps are running?

Link to comment
Share on other sites

It's probably because the windows aren't active if you're not connected/logged in to the server

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Are you always logged in when this runs?

If not, then you will not be able to make the window active.

http://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F

Using WinExists will work (loop until it does), and then wait for the WinGetState to include is visible, and is enabled...then use controlsend instead of send

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

I'd suggest doing an action, and writing the results of that action to a log file, so you know exactly what's going on.

So, if the function returns an HWnd, add a step directly after that function to validate that it was a success...use If IsHWnd() Then

Only proceed to the next action if the prior was a success

Output all steps to a log

That way, you can ask constructive things, like, why is 'this' function failing? instead of broad this isn't working statements

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...