| View previous topic :: View next topic |
| Author |
Message |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Thu Apr 05, 2007 2:30 pm Post subject: Detect an window title question |
|
|
Hi,
This simple code below is used to detect if a window title is present. List 15 is the list I made with the
window titles I want to detect.
I don't understand why, but when I run my app with the code below in my :timer it occasionally makes my app go nuts, CPU goes to 90%, seems to get stuck in an endless loop. I am not able to reproduce in Debug mode through the VDS IDE. The timer is called every 1 second.
Someone has an idea why? or a better routine?
Thanks in advance...
| Code: | :timer
#List 15 contains my personal list of windows
# Example : Untitled - Notepad
list clear,14
list winlist,14,N
%x = 0
REPEAT
if @item(15,%x)
%y = 0
REPEAT
#Exact match
if @match(14, @item(15, %y))
# Found a match! @item(14)
%a = @WINEXISTS(@item(14))
IF @not(@null(%a))
# Code to do something with matching window
end
else
# no match
end
%y = @succ(%y)
UNTIL @equal(%y, @count(14))@greater(%y, @count(14))
end
%x = @succ(%x)
UNTIL @equal(%x, @count(15))@greater(%x, @count(15))
goto evloop |
|
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Apr 05, 2007 3:25 pm Post subject: |
|
|
Marty,
From what I can tell you should not need the inner loop. Try the code below.
| Code: |
:timer
#List 15 contains my personal list of windows
# Example : Untitled - Notepad
list clear,14
list winlist,14,N
%x = 0
REPEAT
%i = @item(15,%x)
If %i
List seek,14,0
if @match(14, %i)
# Found a match! @item(14)
%a = @WINEXISTS(@item(14))
IF @not(@null(%a))
# Code to do something with matching window
end
else
# no match
end
End
%x = @succ(%x)
UNTIL @equal(%x, @count(15))@greater(%x, @count(15))
goto evloop
|
_________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Fri Apr 06, 2007 2:25 pm Post subject: |
|
|
Woohoo! Thanks.. works perfectly now..
Wondering why I did put 2 REPEATs in there after seeing your code. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|