forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Detect an window title question

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Thu Apr 05, 2007 2:30 pm    Post subject: Detect an window title question Reply with quote

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...Very Happy


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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Thu Apr 05, 2007 3:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri Apr 06, 2007 2:25 pm    Post subject: Reply with quote

Woohoo! Thanks.. works perfectly now..

Wondering why I did put 2 REPEATs in there after seeing your code.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group