Mecrazycoder Posted September 3, 2009 Posted September 3, 2009 Hi friends, I wrote a script like Opt("WinTitleMatchMode",-2) If (( ProcessExists("firefox.exe") or ProcessExists("iexplorer.exe") ) And (WinWaitActive("Hotmail") or WinWaitActive("Google") or WinWaitActive("Gmail")) )Then MsgBox(0,"","Got it") EndIf .It works fine for hotmail window alone.When i open some other window like Gmail(comes second or so) it doesn't produce the output.Please help.Only works if first window is active. [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]
jvanegmond Posted September 3, 2009 Posted September 3, 2009 (edited) Because it uses WinWaitActive, it will wait until the window "Hotmail" comes up, before it tries to wait for the "Google" and "Gmail" windows. (The expression is evaluated left to right)Use WinExists instead of WinWaitActive in a loop. Edited September 3, 2009 by Manadar github.com/jvanegmond
Mecrazycoder Posted September 3, 2009 Author Posted September 3, 2009 Because it uses WinWaitActive, it will wait until the window "Hotmail" comes up, before it tries to wait for the "Google" and "Gmail" windows. (The expression is evaluated left to right)Use WinExists instead of WinWaitActive in a loop.Yeah i know that but problem is when hotmail is active it doesn't show the output.Can you please try the script [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]
jvanegmond Posted September 3, 2009 Posted September 3, 2009 WinWaitActive function waits for the window to become active. AutoIt only has one thread. So the interpreter will do this:If (( ProcessExists("firefox.exe") ; < == Check if firefox exists, return 1 or 0) or ProcessExists("iexplorer.exe") ; < == Check if iexplore.exe exists, return 1 or 0And (WinWaitActive("Hotmail") ; < == WAIT FOR HOTMAIL TO EXIST AND DO NOTHING ELSE UNTIL IT ACTUALLY EXISTS or WinWaitActive("Google") ; < == WAIT FOR GOOGLE TO EXIST AND DO NOTHING ELSE UNTIL IT ACTUALLY EXISTS or WinWaitActive("Gmail")) )Then ; < == WAIT FOR GMAIL TO EXIST AND DO NOTHING ELSE UNTIL IT ACTUALLY EXISTSThis is how you solve it:Use WinExists instead of WinWaitActive in a loop. Opt("WinTitleMatchMode",2) While 1 If (( ProcessExists("firefox.exe") or ProcessExists("iexplorer.exe") ) And (WinExists("Hotmail") or WinExists("Google") or WinExists("Gmail")) )Then MsgBox(0,"","Got it") ExitLoop EndIf Wend github.com/jvanegmond
Manjish Posted September 3, 2009 Posted September 3, 2009 Hey the reason is simple.. You have put "iexplorer.exe"..make it "iexplore.exe" [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
jvanegmond Posted September 3, 2009 Posted September 3, 2009 Hey the reason is simple.. You have put "iexplorer.exe"..make it "iexplore.exe"That too. github.com/jvanegmond
Manjish Posted September 3, 2009 Posted September 3, 2009 Make it: Opt("WinTitleMatchMode",2) While 1 If (( ProcessExists("firefox.exe") or ProcessExists("iexplore.exe") ) And (WinExists("Hotmail") or WinExists("Google") or WinExists("Gmail")) )Then MsgBox(0,"","Got it") ExitLoop EndIf Wend [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Mecrazycoder Posted September 4, 2009 Author Posted September 4, 2009 WinWaitActive function waits for the window to become active. AutoIt only has one thread. So the interpreter will do this: If (( ProcessExists("firefox.exe") ; < == Check if firefox exists, return 1 or 0 ) or ProcessExists("iexplorer.exe") ; < == Check if iexplore.exe exists, return 1 or 0 And (WinWaitActive("Hotmail") ; < == WAIT FOR HOTMAIL TO EXIST AND DO NOTHING ELSE UNTIL IT ACTUALLY EXISTS or WinWaitActive("Google") ; < == WAIT FOR GOOGLE TO EXIST AND DO NOTHING ELSE UNTIL IT ACTUALLY EXISTS or WinWaitActive("Gmail")) )Then ; < == WAIT FOR GMAIL TO EXIST AND DO NOTHING ELSE UNTIL IT ACTUALLY EXISTS This is how you solve it: Use WinExists instead of WinWaitActive in a loop. Opt("WinTitleMatchMode",2) While 1 If (( ProcessExists("firefox.exe") or ProcessExists("iexplorer.exe") ) And (WinExists("Hotmail") or WinExists("Google") or WinExists("Gmail")) )Then MsgBox(0,"","Got it") ExitLoop EndIf Wend Tanx man [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]
Mecrazycoder Posted September 4, 2009 Author Posted September 4, 2009 Make it: Opt("WinTitleMatchMode",2) While 1 If (( ProcessExists("firefox.exe") or ProcessExists("iexplore.exe") ) And (WinExists("Hotmail") or WinExists("Google") or WinExists("Gmail")) )Then MsgBox(0,"","Got it") ExitLoop EndIf Wend Tanx dude [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]
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