Window Handles

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Window Handles

Post by PepsiHog » Sat Feb 05, 2011 1:11 am

v12. Windows XP sp3

Hello,

In regards to LibFunc, if the lowest handle is 65556, what is the highest?

I need to cycle through window handles, looking for a particular title.
JRL helped me out with a routine that does this, but I modified it for another
macro. If the windows searched for are not found, I need the loop to exit.
If it finds the windows then it jumps out with an if statement.


Code: Select all

Repeat>GWres
  Add>kk,1
  // 2=Identify the handle of the window below the specified handle(GWres)
  LibFunc>user32,GetWindow,GWres,%GWres%,2
  //Let>Window_%kk%=%GWres%
  GetWindowNames>GWres,title,class
  //If>class=Shell_TrayWnd,Done
  if>title=%IsOpen_Var_1%
          let>IsOpen1=1
          add>asd,1
  endif
  if>title=%IsOpen_Var_2%
          let>IsOpen2=1
          add>asd,1
  endif
  if>asd>1,Done
Until>GWres=0
I believe I have what I need in the script, but I need an exit.

Repeat>GWres

rest of macro...............

Until>???? (highest handle?)

Make sense?

Thanks.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Feb 05, 2011 5:30 am

Hi PepsiHog,
Not sure if the following code answers your question.

Code: Select all

Let>i=1
Let>k=10
While>i<10>k=10
Goto>Me
Endif
Add>i,1
Endwhile
Label>Me
// Do something else
Last edited by armsys on Sat Feb 05, 2011 6:29 am, edited 5 times in total.

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Please Explain

Post by PepsiHog » Sat Feb 05, 2011 5:41 am

What is this macro suppose to do? I don't understand the context.

Please explain.

Thanks.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Feb 05, 2011 6:32 am

Now I notice the problem.
The forum keeps deleting %CRLF%IF>
The 3rd line should read:
While ik=10

After posting it, it becomes:
While ik=10

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Feb 05, 2011 6:36 am

You can see the forum keeps deleting my text. I have already reposted the correct code several times. Still it keeps truncating some text.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Feb 05, 2011 6:39 am

Finally after disabling HTML, it stops messing up my code:
Let>i=1
Let>k=10
While>ik=10
Goto>Me
Endif
Add>i,1
Endwhile
Label>Me
// Do something else

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts