 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Robert Carnegie
Joined: 01 Jun 2005 Posts: 53 Location: Scotland
|
Posted: Tue Nov 07, 2006 11:18 pm Post subject: num1 between %x% and %y% and num2 between %w% and %z% ? |
|
|
Tested in AHk 1.0.44.14, I think
This is most likely my misunderstanding, but I intended to use a formula,
| Code: | If NowX between %Desktop1Left% and %Desktop1Right% and NowY between %Desktop1Top% and %Desktop1Bottom%
|
No?
The program, which I have made to work, is to support an unusual and possibly interesting requirement. I am currently using a touchscreen monitor with the Fitaly on-screen keyboard operated with a stylus (actually a printer cleaning cotton bud on a long stick - for a soft touch), and also using a mouse left-handed. AutoHotkey is used to tell Fitaly to be positioned on the Windows taskbar occupying the right 480 pixels of the screen. I make the interesting discovery that I expect to use the mouse on the desktop and Fitaly and my stylus for writing, and when I stop writing I expect the mouse pointer to be in its previous location - as if there were separate mouse and touchscreen pointers. Of course that doesn't work, but can I make it work?
So I borrowed from a previous script to capture the location of the pointer when the pointer is -not- on the taskbar - or something like that, you'll see - and if the pointer is on the taskbar and also idle then it gets moved back to its previous location. The script also taps the Ctrl key which is set to cause a circle to be zoomed around the new location of the pointer.
This version works; it uses a variable to indicate whether two "If" both came true.
| Code: | CoordMode, Mouse, Screen
RememberX := 0100
RememberY := 0100
Loop
{
; obtain Desktop1Left Desktop1Top Desktop1Right Desktop1Bottom
;
SysGet, Desktop1, MonitorWorkArea, 1
; obtain mouse position
;
MouseGetPos, NowX, NowY
NowBad := 1
If NowX between %Desktop1Left% and %Desktop1Right%
{
If NowY between %Desktop1Top% and %Desktop1Bottom%
{
RememberX := NowX
RememberY := NowY
NowBad := 0
}
}
If NowBad
{
IfGreater, A_TimeIdlePhysical, 1000
{
MouseMove, RememberX, RememberY
send, {ctrl}
}
}
Sleep, 200
}
|
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10474
|
Posted: Wed Nov 08, 2006 1:53 am Post subject: Re: num1 between %x% and %y% and num2 between %w% and %z% ? |
|
|
| Robert Carnegie wrote: | | If NowX between %Desktop1Left% and %Desktop1Right% and NowY between %Desktop1Top% and %Desktop1Bottom% | Currently, you can't use more than one "'between" on the same line because the operators "between", "is", "in", and "contains" are not supported in expressions. So your workaround of dividing it into two separate lines is one way of doing it; alternatively, you could use a series of greater-than and less-than comparisons instead of "between". |
|
| 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
|