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 

proform action based on Window and Mouse

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Invalid User
Guest





PostPosted: Tue Feb 08, 2005 3:23 pm    Post subject: proform action based on Window and Mouse Reply with quote

I suddenly found my self needing to perform an action based where my mouse was within a window, simular to a tool tip. This script mocks a tool tip as an example but think BIGGER

Use the Active Window Info window to determine your ranges


Code:

SetTimer, MyLabel, 500
MyLabel:
Loop,
{
   WinGetActiveTitle, TheActiveWindow

   If TheActiveWindow = The Crystal Society's Key Stroke Automator ;Some Know Window Name goes here
   {
      WinGetActiveStats, TheActiveWindow, ActiveW, ActiveH, ActiveX, ActiveY
      MouseGetPos, OutX, OutY
;----------------------------------------------------------------
      XRangeMin = 1 ;         Set Ranges Here   |
      XRangeMax = 50 ;            |
      YRangeMin = 1 ;             |
      YRangeMax = 50 ;            |
;----------------------------------------------------------------



      If OutX between %XRangeMin% and %XRangeMax%
      {
         If OutY between %YRangeMin% and %YRangeMax%      
         {
            ToolTip, Your Within Range, %OutX%, %OutY% ;   This Could be another Funtion- run, GoSub, etc.
         }
      }
      IfWinNotActive, TheActiveWindow
      {
         ToolTip,
         Continue
      }
   }
}
END::
ExitApp
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Feb 15, 2005 3:22 am    Post subject: Reply with quote

I took the liberty of cleaning it up a little, since I'll be utilizing a section of it... thought I might as well post the revised code.

Code:
settitlematchmode,2
IfWInNotExist,- Notepad ; Only needs to be set here, then it's the last found window.
WinWait,- Notepad
Loop
{
   IfWinActive
   {
      MouseGetPos, OutX, OutY
;----------------------------------------------------------------
      XRangeMin = 1 ;         Set Ranges Here   |
      XRangeMax = 50 ;            |
      YRangeMin = 1 ;             |
      YRangeMax = 50 ;            |
;----------------------------------------------------------------



      If OutX between %XRangeMin% and %XRangeMax%
      {
         If OutY between %YRangeMin% and %YRangeMax%     
         {
            ToolTip, You're Within Range., %OutX%, %OutY% ;   This Could be another Funtion- run, GoSub, etc.
            Sleep,400
         }
      }
      Else
         Tooltip
   }
   
   IfWinNotExist
   {
      Tooltip
      WinWait,- Notepad
      Continue
   }

   IfWinNotActive
   {
      ToolTip
      WinWaitActive
      Continue
   }
}
END::
ExitApp
Back to top
View user's profile Send private message
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Tue Feb 15, 2005 4:16 am    Post subject: Reply with quote

just curious what did you find to use this one on?
_________________
my lame sig Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Feb 15, 2005 4:19 am    Post subject: Reply with quote

It's really only an idea for now, and I just needed a break from my paper. My idea was to map the icon in the top left of every window to a menu, so I could make my own "system menu." I was also going to map it to Alt+Space, so it fully replaces it. I'll work more on it later, but I'm not sure it'll be worth posting, anyway.

Btw, I did mean just a "section." My code will probably look very different from this, just because I have a different coding style.
Back to top
View user's profile Send private message
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Wed Feb 16, 2005 4:02 am    Post subject: Reply with quote

I want a different coding styles, I have been playing around with the concept of adding var everywhere I can, just to see if its more versitile or effiencent. I need some style anyway
_________________
my lame sig Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Wed Feb 16, 2005 4:16 am    Post subject: Reply with quote

Lol! That's funny, I have exactly the opposite view. I don't like "customization" variables, I only use them for script operations. And then, I reuse them a lot (the names never make sense).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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