AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

tooltip affecting hotkey

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Fri Jun 11, 2004 3:25 pm    Post subject: tooltip affecting hotkey Reply with quote

This tooltip menu runs fine for a while, but eventually the tooltip menu stops responding to a ~Lbutton click.

The tooltip menu will continue to respond to F10 (F10 and ~Lbutton activate the same code), and ~Lbutton will continue to work outside of the tooltip.

Mbutton will also continue to work by toggling the tooltip on and off.

The only problem is ~Lbutton will cease to run its hotkey code, even though F10 will run the code.


Code:
;____User Configurable Menu   - Rajat_______

;  WinActivate,    ahk_class tooltips_class32   ;ahk_class #32770
;You can set any title here for the menu

MenuTitle = =========

;Delay after which the menu is shown
UMDelay = 20
SetFormat, float, 0.0
SetBatchLines, 10ms z

;_____Menu Definitions______________________

; Create / Edit Menu Items here.
; You can't use spaces in keys/values/section names.

MenuItem1 = Notepad
MenuItem2 = Calculator
MenuItem3 = Section3
MenuItem4 = Section4
MenuItem5 = Section5

Exit

;_____Menu Sections_________________________

;Create / Edit Menu Sections here.

Notepad:
   Run, Notepad.exe
Return


Calculator:
   Run, Calc
Return


Section3:
   msgbox, You selected 3
Return


Section4:
   msgbox, You selected 4
Return


Section5:
   msgbox, You selected 5
Return


;_____Hotkey Section________________________


~MButton::
   HowLong = 0
   Loop
   {
      HowLong ++
      Sleep, 10
      GetKeyState, MButton, MButton, P
      IfEqual, MButton, U, Break
   }
   IfLess, HowLong, %UMDelay%, Return

   Menu = %MenuTitle%
   Loop
   {
      IfEqual, MenuItem%a_index%,, Break
      MenuItems ++
      StringTrimLeft, MenuText, MenuItem%a_index%, 0
      Menu = %Menu%`n%MenuText%
   }
   
   MouseGetPos, mX, mY
   ToolTip, %Menu%, %mX%, %mY%
;   WinActivate, %MenuTitle%
  WinActivate, ahk_class tooltips_class32
Return



F10::
~LButton::
   IfWinNotActive, ahk_class tooltips_class32
    ;IfWinNotActive, %MenuTitle%
    {
       ToolTip
       Return
    }
     
    CoordMode, Mouse, Relative
    MouseGetPos, mX, mY
    ToolTip
   mY -= 3      ;space after which first line starts
   mY /= 13   ;space taken by each line
   IfLess, mY, 1, Return
   IfGreater, mY, %MenuItems%, Return
   StringTrimLeft, TargetSection, MenuItem%mY%, 0
   Gosub, %TargetSection%
Return
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Fri Jun 11, 2004 3:44 pm    Post subject: Reply with quote

Quote:
This tooltip menu runs fine for a while, but eventually the tooltip menu stops responding to a ~Lbutton click.

I tried about 50 clicks with that script and couldn't reproduce that behavior.

Perhaps you can help me isolate this. When it stops responding, check the View > Hotkeys menu item in the main window's menu. Does it say that the ~LButton hotkey is running? If so, that's a problem. If not, check the View > Key history menu item. It should have something like the below in it for each time you press the left button:
Quote:
01 000 h d 0.93 LButton =========

And every time it shows an h in the 3rd column like the above, the subroutine should launch (as evidenced by View > Lines) unless it's already running as shown by View > Hotkeys.

Thanks,
Chris
Back to top
View user's profile Send private message Send e-mail
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Fri Jun 11, 2004 6:19 pm    Post subject: Reply with quote

there is a '1' in front of ~LButton



Code:
m-hook         ~MButton
reg         F10
m-hook      1   ~LButton
reg         ^+y
reg         #p
k-hook         a & g
k-hook         space & t
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Fri Jun 11, 2004 9:00 pm    Post subject: Reply with quote

The 1 means that the ~LButton hotkey is running, that it has 1 thread. When this happens, check "key history" to see what it says for these 3 lines:

Enabled Timers
Interrupted threads
Paused threads

Based on what it says there I will try to figure it out some more. Thanks for your help.
Back to top
View user's profile Send private message Send e-mail
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Fri Jun 11, 2004 10:26 pm    Post subject: Reply with quote

i cleared the history by pressing many F5's.

then brought up the tooltip (mbutton)
then left clicked on tooltip
then alt-tab back to history display
then F5 to refresh history.

resulting in the below.

Code:
Window: D:\Documents and Settings\dexter\My Documents\apps.ahk - AutoHotkey v1.0.12
Keybd hook: yes
Mouse hook: yes
Last hotkey type: not keybd hook
Enabled Timers: 0 of 0 ()
Interrupted threads: 0
Paused threads: 0 of 1 (1 layers)
Modifiers (GetKeyState() now) =
Modifiers (Hook's Logical) =
Modifiers (Hook's Physical) =
Prefix key is down: no

The oldest are listed first.  VK=Virtual Key, SC=Scan Code, Elapsed=Seconds since the previous event, Types: h=Hook Hotkey, s=Suppressed (hidden from system), i=Ignored because it was generated by the script itself.

VK  SC   Type   Up/Dn   Elapsed   Key      Window
-------------------------------------------------------------------------------------------------------------
74  03F       d   0.04   F5                D:\Documents and Settings\dexter\My Documents\apps.ahk - AutoHotkey v1.0.12
74  03F       d   0.03   F5                
74  03F       d   0.03   F5                
74  03F       d   0.04   F5                
74  03F       d   0.03   F5                
74  03F       d   0.03   F5                
74  03F       d   0.03   F5                
74  03F       d   0.04   F5                
74  03F       d   0.03   F5                
74  03F       d   0.03   F5                
74  03F       d   0.04   F5                
74  03F       d   0.03   F5                
74  03F       d   0.03   F5                
74  03F       d   0.03   F5                
74  03F       d   0.04   F5                
74  03F       d   0.03   F5                
74  03F       d   0.03   F5                
74  03F       d   0.04   F5                
74  03F       u   0.02   F5                
04  000   h   d   0.69   MButton           
04  000       u   0.46   MButton           
01  000   h   d   3.50   LButton           menua
volmiddle
menu2
programs
winamp
powerdesk
TVyahoo
aliens3
rabbitsjob
tarzan
holy
keylist
AHKr
01  000       u   0.04   LButton           
A4  038       d   2.12   Alt               
A4  038       d   0.25   Alt               
A4  038       d   0.04   Alt               
A4  038       d   0.03   Alt               
A4  038       d   0.03   Alt               
A4  038       d   0.03   Alt               
A4  038       d   0.04   Alt               
A4  038       d   0.03   Alt               
A4  038       d   0.03   Alt               
A4  038       d   0.03   Alt               
A4  038       d   0.04   Alt               
09  00F       d   0.03   Tab               
09  00F       u   0.08   Tab               
09  00F       d   0.74   Tab               
09  00F       u   0.14   Tab               
A4  038       u   0.08   Alt               
74  03F       d   1.99   F5                D:\Documents and Settings\dexter\My Documents\apps.ahk - AutoHotkey v1.0.12
Press [F5] to refresh.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Sat Jun 12, 2004 1:09 am    Post subject: Reply with quote

You might first try upgrading to v1.0.13 on the off-chance that this has been resolved. If that doesn't help, you're the only one who can try to isolate this (unless someone else can reproduce the problem) using steps such as the below.

Did the LButton hotkey fail to respond correctly when you pressed F5 the final time and copied the data you posted? If not, I need to see the data for when it fails to respond.

Were you running any other scripts at the same time?

Are you using the script exactly as posted above, or are there other hotkeys/timers in it?

When the hotkey stops responding, the View > Hotkeys function will display a 1 near the LButton hotkey (as you posted earlier). While that 1 is there, it means that hotkey's subroutine is running as a thread. At this time, does View > Key History show interrupted threads greater than 0? If so, there's probably some other hotkey or timer that interrupted it. If not, use View > Lines to find out what line it's stuck on.

The last task above is the most important: the last line will show a number in parens to its right to indicate how long that line was run. That number should increase as you press F5 to indicate that the script is idle. If you think it's useful, the next time you get it to stop responding, post the last 10 lines or so from View > Lines.

Finally, as a temporary workaround until the problem is isolated, you might try this:
...
#MaxThreadsPerHotkey 10
~LButton::
#MaxThreadsPerHotkey 1
...

The above might cause hung threads to start stacking up until the limit of 10 is reached (as shown by View > Key History). If it does, it would be good if I can find a way to get threads to hang on my system as well.

Thanks for your patience.
Back to top
View user's profile Send private message Send e-mail
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Sat Jun 12, 2004 4:29 pm    Post subject: Reply with quote

i may have found the problem. please dont spend any more time on this. could be user error. Embarassed

i sliced and diced the script many many times, over many days, before posting it as a problem, darn it.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Sat Jun 12, 2004 5:23 pm    Post subject: Reply with quote

Ok thanks for following up on that.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group