 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Invalid User Guest
|
Posted: Tue Feb 08, 2005 3:23 pm Post subject: proform action based on Window and Mouse |
|
|
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
|
Posted: Tue Feb 15, 2005 3:22 am Post subject: |
|
|
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 |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Tue Feb 15, 2005 4:16 am Post subject: |
|
|
just curious what did you find to use this one on? _________________ my lame sig  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Feb 15, 2005 4:19 am Post subject: |
|
|
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 |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Wed Feb 16, 2005 4:02 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Wed Feb 16, 2005 4:16 am Post subject: |
|
|
| 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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|