AutoHotkey Community

It is currently May 27th, 2012, 11:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Debug-View for Timers
PostPosted: November 17th, 2005, 8:55 am 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Hi,

what I'm still missing in AutoHotkey's window is a list of all running timers.

_________________
Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2005, 11:22 am 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
That could be pretty helpful sometimes when dealing with lots of conditional timers, in which instance just the number of enabled timers (in the Key History and Script Info window) doesn't always give much of a hint.

If it's not too much trouble, listing the value for each SetTimer would also save some manual calculation (when SetTimers are assigned a variable for the period).

Another reason I think this would be helpful is that I recall there is an item on the list of planned features for AHK:

Quote:
Add scheduling by extending SetTimer, e.g. daily at a certain time, etc.


(Which I'm really looking forward to since it's a bit messy to do at the moment and it'll replacement my current scheduling program for most tasks if not all).

Anyhow, if it's that much easier to schedule things, it'll be used a lot more and it'll be that much more important to check it's actually running as intended, especially with very long periods of, for example, a month (which I presume the planned feature would accomodate).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2005, 11:37 am 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Thanks Evl,

I've missed the List at the key-history. That would help me.

_________________
Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2005, 1:59 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
Perhaps a custom function would suffice:

Code:
MsgBox, % SetTimer()

SetTimer( "timer_dummy1" )
ToolTip
MsgBox, % SetTimer()

SetTimer( "timer_dummy2", 1000 )
ToolTip
MsgBox, % SetTimer()

SetTimer( "timer_dummy1", "off" )
ToolTip
MsgBox, % SetTimer()

SetTimer( "timer_dummy2", "off" )
ToolTip
MsgBox, % SetTimer()
return

timer_dummy1:
   CoordMode, ToolTip, Screen
   ToolTip, timer_dummy1, 10, 10
return

timer_dummy2:
   CoordMode, ToolTip, Screen
   ToolTip, timer_dummy2, 10, 30
return

SetTimer( p_label="", p_period="", p_priority="" )
{
   ; field = |<label>,<enabled>,<period>,<priority>
   static   list
   
   if ( p_label = "" )
      return, list
   
   old_StringCaseSense := A_StringCaseSense
   StringCaseSense, Off
   
   ix := InStr( list, "|" p_label ",", false )
   if ( ! ix )
      exists := false
   else
   {
      exists := true
   
      ix_e := InStr( list, "|", false, ix+1 )

      if ( ! ix_e )
         StringRight, old_field, list, StrLen( list )-ix
      else
         StringMid, old_field, list, ix+1, ix_e-ix-1
         
      ix := InStr( old_field, "," )
      StringMid, f_enabled, old_field, ix+1, 1
      
      ix += 2
      ix_e := InStr( old_field, ",", false, ix+1 )
      StringMid, f_period, old_field, ix+1, ix_e-ix-1
      
      StringRight, f_priority, old_field, StrLen( old_field )-ix_e
   }
   
   if ( p_period = "off" )
   {
      if ( ! exists )
         return
   
      f_enabled := false
   }
   else if ( p_period != "" or ! exists or p_priority = "" )
   {
      f_enabled := true
      
      if p_period is integer
         f_period := p_period
      else if ( ! exists )
         f_period = 250
   }

   if ( p_priority = "" )
      f_priority = 0
   else
      f_priority := p_priority
      
   new_field = %p_label%,%f_enabled%,%f_period%,%f_priority%
   
   if ( exists )
      StringReplace, list, list, |%old_field%, |%new_field%
   else
      list = %list%|%new_field%
      
   SetTimer, %p_label%, %p_period%, %p_priority%
   
   StringCaseSense, %old_StringCaseSense%
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group