 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
D4BST3R
Joined: 04 Aug 2008 Posts: 65 Location: UK: Crawley
|
Posted: Thu Aug 28, 2008 5:56 pm Post subject: Mouse Pos Query |
|
|
Hey i got 2 queries
1) Im wondering if this is possible:
Basically i want the script to Check if the Mouse is in a certain area every 0.01 second or so something liek this:
| Code: | #Persistent
SetTimer, MousePos, 10
Return
MousePos:
MouseGetPos, X, Y
; Now i want the script to see if the Mouse Pos (X and Y) is in the defined area.... Somethign like this...
[Some Expression for checking], 100, 200, 400, 500 ;This is a rectangle i want the script to check (300 x 300)
|
2) I made a GUI Interface and it has one Edit Box at the top and some other controls, and when the Script is run it asks for a Number and it does some calculations and displays the Answer in the GUI Interface, and the Edit box that shows at the top shows the Number that was entered at the beggining. So basically is there a way the script monitors to see if chages have been made to the edit box, if there are changes it shows the new answer in the interface?
Thanks
Thats what i want to know if its possible...
Thanks |
|
| Back to top |
|
 |
BoBo² Guest
|
Posted: Thu Aug 28, 2008 6:01 pm Post subject: |
|
|
--> OnMessage()
| Quote: | | basically is there a way the script monitors to see if chages have been made to the edit box, | Yes. --> GUI --> gLabel |
|
| Back to top |
|
 |
D4BST3R
Joined: 04 Aug 2008 Posts: 65 Location: UK: Crawley
|
Posted: Thu Aug 28, 2008 6:37 pm Post subject: |
|
|
| Ermm.. How do i do that? Lil Help :S |
|
| Back to top |
|
 |
phire123418
Joined: 22 Aug 2008 Posts: 44
|
|
| Back to top |
|
 |
D4BST3R
Joined: 04 Aug 2008 Posts: 65 Location: UK: Crawley
|
Posted: Thu Aug 28, 2008 7:02 pm Post subject: |
|
|
Ok Sorry but the code istn working  |
|
| Back to top |
|
 |
D4BST3R
Joined: 04 Aug 2008 Posts: 65 Location: UK: Crawley
|
Posted: Fri Aug 29, 2008 11:29 am Post subject: |
|
|
Ok Thanks Phire123418 Ive managed to get a lot done just lil problem now..
Heres the code so far (well partly)
| Code: | A1=%[SomeInformation]%
A2=%[SomeInformation]%
A3=%[SomeInformation]%
A4=%[SomeInformation]%
A5=%[SomeInformation]%
A6=%[SomeInformation]%
A7=%[SomeInformation]%
A8=%[SomeInformation]%
A9=%[SomeInformation]%
A10=%[SomeInformation]%
A11=%[SomeInformation]%
A12=%[SomeInformation]%
Gui, Add, Picture, x0 y0 w169 h348 , \PATH\Image.bmp ;169 x 348
Gui, Font, S10 CDefault Bold, Verdana
Gui, Add, Text, x30 y94 w20 h20 CYellow BackgroundTrans , %5%
Gui, Add, Text, x30 y126 w20 h20 CYellow BackgroundTrans, %11%
Gui, Add, Text, x30 y158 w20 h20 CYellow BackgroundTrans, %8%
Gui, Add, Text, x30 y190 w20 h20 CYellow BackgroundTrans, %17%
Gui, Add, Text, x30 y222 w20 h20 CYellow BackgroundTrans, %20%
Gui, Add, Text, x30 y254 w20 h20 CYellow BackgroundTrans, %23%
Gui, Add, Text, x30 y286 w20 h20 CYellow BackgroundTrans, %65%
Gui, Add, Text, x30 y318 w20 h20 CYellow BackgroundTrans, %71%
Gui, Add, Text, x84 y94 w20 h20 CYellow BackgroundTrans, %14%
Gui, Add, Text, x84 y126 w20 h20 CYellow BackgroundTrans, %53%
Gui, Add, Text, x84 y158 w20 h20 CYellow BackgroundTrans, %50%
Gui, Add, Text, x84 y190 w20 h20 CYellow BackgroundTrans, %56%
Gui, Show, x586 y317 h348 w169, [WINDOW NAME]
OnMessage(0x200, "WM_MOUSEMOVE")
OnMessage( 0xA0, "WM_NCMOUSEMOVE")
Return
WM_NCMOUSEMOVE()
{
ToolTip,
}
WM_MOUSEMOVE()
{
GoSub, Test
}
Return
Test:
MouseGetPos, X, Y
;==========================================
If (X>7) && (X<58) && (Y>117) && (Y<150)
{
ToolTip, %[SomeInformation]%
}
;==========================================
If (X>7) && (X<58) && (Y>150) && (Y<178) ;Basically theres going to be 12 of these "If"'s...
{
ToolTip, %[SomeInformation]%
}
;Ok Basically, I need the tooltip to disappear if the mouse is not in any of those two areas (going to be 12 different areas) and in order for the mouse to go away I have to add:
Else
{
ToolTip
Return
} ;At the end of each IF I add
;Because I have to add the command in Blue to each If I have in order for it to function with all of the tooltips, the Return command in Blue stops the "WM_MOUSEMOVE()" command from reading all the "If"'s after the first ToolTip Return, therfore only the first IF AREA fnctions and nothing happens to the rest of the Areas when the mouse goes over them... So basically I Need 12 different mouse areas with the tooltip disappearing away if the mouse is not in any of the areas...
Also, the ToolTips blink repeatidly when ther are more then one area functioning... which is another problem
Thanks SO Much If You Can Crack This Problem :) |
|
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Fri Aug 29, 2008 1:17 pm Post subject: |
|
|
If you want to find out if the mouse is over a control in a gui you can just add the hwnd option for the controls. WM_MOUSEMOVE also gets the mouse coordinates relative to the gui.
| Code: | gui, add, button, hwndbutton
gui, show, w200 h200
onmessage(0x200, "WM_MOUSEMOVE")
return
WM_MOUSEMOVE(wparam, lparam, msg, hwnd)
{
global
x := lparam & 0xFFFF, y := lparam >> 16 ; mouse coordinates
if (hwnd = button)
tooltip hello
else
tooltip
} |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
soggos
Joined: 27 Mar 2008 Posts: 37 Location: France
|
Posted: Tue Sep 02, 2008 2:52 pm Post subject: on a Button, And on a Picture? |
|
|
Hello Serenity and everybody
| Quote: | | If you want to find out if the mouse is over a control in a gui you can just add the hwnd option for the controls. WM_MOUSEMOVE also gets the mouse coordinates relative to the gui. |
very kool
i have tested with a picture like: | Code: | Gui, Add, Picture,hwndPicture x5 y7 w28 h28 vIMAGEl1 gAZ1 icon99 E0x200, C:\WINDOWS\system32\shell32.dll
gui, show, w200 h200
onmessage(0x200, "WM_MOUSEMOVE")
return
WM_MOUSEMOVE(wparam, lparam, msg, hwnd)
{
global
x := lparam & 0xFFFF, y := lparam >> 16 ; mouse coordinates
if (hwnd = picture)
tooltip hello
else
tooltip
} |
but nothing on a picture.
idem with:
| Code: | | if (hwnd = IMAGElA ) |
it's possible to make that?
And if i have many different control,
how to make different tooltip?
i don't found anything  |
|
| Back to top |
|
 |
soggos
Joined: 27 Mar 2008 Posts: 37 Location: France
|
Posted: Tue Sep 02, 2008 3:09 pm Post subject: !nothing with Static1 |
|
|
other test:
With/for my first picture:
| Code: | if (hwnd = Static1)
{
tooltip Picture...
Sleep 1000
tooltip
} |
but nothing! |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Tue Sep 02, 2008 4:43 pm Post subject: |
|
|
Soggos, the code you posted (hwndpicture) works for me. If you want to display a different tooltip just add an Else If per control, again using the hwnd option:
| Code: | gui, add, edit, hwndedit
gui, add, button, hwndbutton1
gui, add, button, hwndbutton2
gui, show
onmessage(0x200, "WM_MOUSEMOVE")
return
WM_MOUSEMOVE(wparam, lparam, msg, hwnd)
{
global
x := lparam & 0xFFFF, y := lparam >> 16 ; mouse coordinates
if (hwnd = button1 || hwnd = button2)
tooltip Buttons
else if (hwnd = edit)
tooltip Edit
else
tooltip
} |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
soggos
Joined: 27 Mar 2008 Posts: 37 Location: France
|
Posted: Tue Sep 02, 2008 9:43 pm Post subject: oh yes :) |
|
|
o yes ok my problem was:
i have 2 pictures:
and that don't work's | Code: |
Gui, Add, Picture,x5 y7 w28 h28 vIMAGElB gACTION icon99 E0x200, C:\WINDOWS\system32\shell32.dll
Gui, Add, Picture,hwndPicture1 x5 y7 w30 h30 vIMAGElA gACTION icon99, C:\WINDOWS\system32\shell32.dll |
and that is good | Code: |
Gui, Add, Picture,hwndPicture1 x5 y7 w28 h28 vIMAGElB gACTION icon99 E0x200, C:\WINDOWS\system32\shell32.dll
Gui, Add, Picture,x5 y7 w30 h30 vIMAGElA gACTION icon99, C:\WINDOWS\system32\shell32.dll |
arf:) under : over
Gracias.Serenity
this little code is very great! |
|
| 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
|