AutoHotkey Community

It is currently May 25th, 2012, 7:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: February 8th, 2005, 4:23 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 4:22 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 5:16 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
just curious what did you find to use this one on?

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 5:19 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 5:02 am 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 5:16 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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).


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot] and 9 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