Jump to content
Sign in to follow this  
dabus

UDF: _WinWaitActiveOf

Recommended Posts

dabus

This is a simple udf that's useful if you don't know what window will appear in an installation-process (e.g. you have a setup that show diffrent windows if the system has been installed before.)

Here's an example:

$Test=_WinWaitActiveOf('Unbenannt|', 'Unnamed|', 'Untitled|','New|',1)
ConsoleWrite($Test&@CR)
; you should see an 0 here
Run('notepad.exe')
$Test=_WinWaitActiveOf('Unbenannt|', 'Unnamed|', 'Untitled|','New|',5) 
ConsoleWrite($Test&@CR)
; you should see an 1 or 3 here, depending on @OSLang
oÝ÷ Ù«­¢+Ø(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ìÍÉ¥ÁÑ¥½¸èÉÑÕɹÌÑ¡¹ÕµÈ½Ñ¡½Õ¹Ñ¥ÙÝ¥¹½Ü(ìMå¹Ñàè}]¥¹]¥ÑÑ¥Ù= ÀÌØí°ÀÌØí°ÀÌØíôÌäì´Ìäì°ÀÌØíôÌäì´Ìäì°ÀÌØíôÔ¤(ìAɵÑȡ̤èÀÌØíѼÀÌØíôÝ¥¹Ñ¥Ñ±ñÝ¥¹Ñáа½¹±äÑݼÉÉÅÕ¥É(ì$$$$$ÀÌØíô$(ìIÅեɵ¹Ð¡Ì¤è9½¹(ìIÑÕɸY±Õ¡Ì¤è=¸MÕÍÌ´IÑÕɹÌÑ¡¹ÕµÈ½Ñ¡ÁɵÑÈ Ä°È°Ì°Ð¤¹ÍÑÌÉɽÈѼÀ(ì=¸¥±ÕÉ´IÑÕɹÌÀ¹ÍÑÌÉɽÈѼÄ(ì$$$$%%¹¼Ý¥¹½Ü¥ÌÍÁ¥¥´IÑÕɹ̴ĹÍÑÌÉɽÈѼ´Ä$(ìÕÑ¡½È¡Ì¤èÕÌ(ì9½Ñ¡Ì¤è%%å½Ô½¸ÌäíÐݹÐѼÍÉ ½ÈÝ¥¹Ñáа±ÙÑ¡¥Ð±¹¬¡¹¸Ý¥¹Ñ¥Ñ±ð¤(ì9½Ñ¡Ì¤è%%å½ÔݹÐѼݥÐÑ¥±°½¹Ý¥¹½Üá¥ÍÑÌ°ÍÐÀÌØíѼ´Ä(챱ѥÀè$$%}]¥¹]¥ÑÑ¥Ù= ÀÌØí°ÀÌØí°ÀÌØíôÌäì´Ìäì°ÀÌØíôÌäì´Ìäì°ÀÌØíôÔ¤IÑÕɹÌÑ¡¹ÕµÈ½Ñ¡½Õ¹Ñ¥ÙÝ¥¹½Ü¸¡ÉÅÕ¥É襹±Õ±Ðíå½ÕȹÔÌÐì¤(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)Õ¹}]¥¹]¥ÑÑ¥Ù= ÀÌØí°ÀÌØí°ÀÌØíôÌäì´Ìäì°ÀÌØíôÌäì´Ìäì°ÀÌØíôÔ¤($ÀÌØí±½½ÀôÀ(%½ÈÀÌØí¹Õ´ôÄQ¼Ð($$ÀÌØíÑÍÐõMÑÉ¥¹MÁ±¥Ð¡Ù°¡
¡È ØЬÀÌØí¹Õ´¤¤°ÌäíðÌäì¤($%%9½ÐÉɽÈQ¡¸($$$ÀÌØí±½½ÀôÀÌØí±½½À¬Ä($$%ÍÍ¥¸¡
¡È ØЬÀÌØí¹Õ´¤µÀìÌäí}]¥¸Ìäì°ÀÌØíÑÍÑlÅt°Ä¤($$%ÍÍ¥¸¡
¡È ØЬÀÌØí¹Õ´¤µÀìÌäí}QáÐÌäì°ÀÌØíÑÍÑlÉt°Ä¤($%¹%$(%9áÐ(%%ÀÌØí±½½ÀôÀQ¡¸($%MÑÉÉ½È ´Ä¤($%IÑÕɸ ´Ä¤(%±Í($$ÀÌØí±½½ÀôÀ($%]¡¥±Ä($$$ÀÌØí±½½ÀôÀÌØí±½½À¬Ä($$%½ÈÀÌØí¹Õ´ôÄQ¼Ð($$$$ÀÌØíÑÍÑ]¥¸õÙ°¡
¡È ØЬÀÌØí¹Õ´¤µÀìÌäí}]¥¸Ìäì¤($$$%%9½ÐÉɽÈQ¡¸($$$$$ÀÌØíÑÍÑQáÐõÙ°¡
¡È ØЬÀÌØí¹Õ´¤µÀìÌäí}QáÐÌäì¤($$$$%%]¥¹á¥ÍÑÌ ÀÌØíÑÍÑ]¥¸°ÀÌØíÑÍÑQáФQ¡¸($$$$$%MÑÉÉ½È À¤($$$$$%IÑÕɸ ÀÌØí¹Õ´¤($$$$$%á¥Ñ1½½À Ȥ($$$$%¹%($$$%¹%($$%9áÐ($$%M±À ÄÀÀÀ¤($$%%ÀÌØí±½½ÀôÀÌØíQ¡¸($$$%MÑÉÉ½È Ä¤($$$%IÑÕɸ À¤($$$%á¥Ñ1½½À($$%¹%($%]¹(%¹%)¹Õ¹(

Share this post


Link to post
Share on other sites
Uten

Are you aware of the fact that you can use regular expressions with the Win* family of functions?

Try this code:

HotKeySet("!{ESC}", "Terminate")
opt("WinTitleMatchMode", 4)
WinWaitActive("regexp=.*Opera|.*Firefox|.*Thunderbird|.*Untitled.*")
msgbox(48, "Active window is", WinGetTitle("active"))

Anyhow thanks for sharing your code..:shocked:

Share this post


Link to post
Share on other sites
dabus

I should read about the regexp; your idea seems ten times better then mine. :shocked:

Wait with the regexp and see what's active. Oh boy, never code if it's weekend. :(

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.