Jump to content

mousecords in a gui


pezo89
 Share

Recommended Posts

Hi Fellas, i where just wondering.. im making a job program that is based on imagesearch, however sometimes the images in the area change..

so iv been thinking on imagecapture new pics if it fails, ofc for me it is easy to change the cords, but not so for others, so i thought have cords in an ini file, and a gui with input bars, however

is there a way to get mousecords(client relative) into an gui?

Link to comment
Share on other sites

Hi Fellas, i where just wondering.. im making a job program that is based on imagesearch, however sometimes the images in the area change..

so iv been thinking on imagecapture new pics if it fails, ofc for me it is easy to change the cords, but not so for others, so i thought have cords in an ini file, and a gui with input bars, however

is there a way to get mousecords(client relative) into an gui?

Honestly, I didn't got it.

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

  • Moderators

pezo89,

Please do not bump your posts within 24 hours. :x

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually.

But it might help if you were to make your question a little clearer - like the other responder, I have little or no idea what you are talking about. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I'm Sorry Melba, wont happen again :x

for the question itself.

all down to the core i'm just asking

Is is possible to have an active mouse Cordinate in a Gui, like on the Window info tool, that shows mousecordinates relative the client,

and is locked "Always on top", so clicking to activate the program area won't set that window infront and my gui behind :P

I think i saw something like this a year back, tried to research it but without any luck, here or trough google.. might have missed it thou..

Pezo

Link to comment
Share on other sites

  • Moderators

pezo89,

You can get the mouse coordinates relative to the client area of a GUI by using MouseGetPos with Opt("MouseCoordMode", 2) or by using the GUIGetCursorInfo command. :P

I am afraid I am still unclear how you want to display the coordinates - perhaps with a ToolTip like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

GUISetState()

GUIRegisterMsg($WM_MOUSEMOVE, "_WM_MOUSEMOVE")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

Func _WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam, $lParam

    $aCInfo = GUIGetCursorInfo($hGUI)
    Switch $aCInfo[0]
        Case 2 To 497
            Switch $aCInfo[1]
                Case 2 To 497
                    ToolTip($aCInfo[0] & ":" & $aCInfo[1])
                Case Else
                    ToolTip("")
            EndSwitch
        Case Else
            ToolTip("")
    EndSwitch
    
EndFunc

Are we even close? :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba, yea well, kinda..

it is those cords i mean. however i need it to do what the autoit window info tool does, regarding the mousecords, but showing the cords in an GUI im making..

i made just an example image. the cords are shown in the window it is. and are used to alter the cords in an ini file where the input boxes are, the rest i can do. it is just showing cords and showing them in a box thats hard for me..

post-44830-0-43567900-1292278188_thumb.j

Link to comment
Share on other sites

Looked at GUICtrlCreateInput() in the helpfile?

i don't see how that can make me be able to show mousecordinates?

as that is only for making an input area isen't it?

im wondering how i can Show the mousecordinates in the window to the right :x

Edited by pezo89
Link to comment
Share on other sites

ok iv gotten this so far, now i only need it to be in that damn GUI..

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$_1 = GUICreate("Test", 233, 272, 192, 114)
$Cargo = GUICtrlCreateLabel("IC1", 16, 8, 48, 20)
$Label1 = GUICtrlCreateLabel("IC2", 93, 8, 48, 20)
GUICtrlCreateInput("R_B", 8, 56, 65, 24)
GUICtrlCreateInput("T_L", 85, 33, 65, 24)
GUICtrlCreateInput("R_B", 85, 57, 65, 24)
GUICtrlCreateInput("R_B", 12, 139, 65, 24)
$Label2 = GUICtrlCreateLabel("W1", 20, 91, 50, 20)
GUICtrlCreateInput("T_L", 12, 115, 65, 24)
GUICtrlCreateInput("R_B", 85, 140, 65, 24)
$Label3 = GUICtrlCreateLabel("W2", 93, 92, 50, 20)
GUICtrlCreateInput("T_L", 85, 116, 65, 24)
GUICtrlCreateInput("R_B", 159, 56, 65, 24)
GUICtrlCreateInput("T_L", 159, 32, 65, 24)
GUICtrlCreateInput("T_L", 8, 32, 65, 24)
$Label4 = GUICtrlCreateLabel("CI", 162, 8, 66, 20)
$Label5 = GUICtrlCreateLabel("OV", 171, 91, 60, 20)
GUICtrlCreateInput("R_B", 163, 139, 60, 24)
GUICtrlCreateInput("T_L", 163, 115, 60, 24)
$Input1 = GUICtrlCreateInput("Cords are shown here", 80, 208, 81, 24)
GUICtrlCreateLabel("Cordinates", 80, 176, 77, 20)
$Button1 = GUICtrlCreateButton("Ok", 80, 240, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

And these are the sort of cordinates i need to be show into the inputbar thats names "Cords shown here"

but instead of Tooltip, i want them into that GUI :x

while 1
    $pos = MouseGetPos()


Opt("MouseCoordMode", 2)        ;1=absolute, 0=relative, 2=client

ToolTip(" "&$pos[0] &  ","&$pos[1])

WEnd
Link to comment
Share on other sites

  • Moderators

pezo89,

Using GUICtrlSetData will put the mouse coordinates into the Input control: :x

Opt("MouseCoordMode", 2)        ;1=absolute, 0=relative, 2=client

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    $pos = MouseGetPos()
    GUICtrlSetData($Input1, $pos[0] &  "," & $pos[1])

WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thx Alot Meldba!, it works like a Charm! :x

btw, do you happen to know if there is any easy way to seperate 4 keypresses after eachother?

say f1-f2-f3-f4,

so it sends f1 the first for $i = 1 to x,

so it sends F1,F2,F3,F4 ->done.

so it is like a loop, going trough 4 keys and then on to the next command.

Edited by pezo89
Link to comment
Share on other sites

  • Moderators

pezo89,

You really do need to take a class in how to explain yourself clearly - once again I have very little idea of what you want to do! :shifty:

This is my best guess as the moment: :P

; You said "4 keypresses after each other [...] say f1-f2-f3-f4"
Global $aKeys [4] =["F1", "F2", "F3", "F4"]

; You said "it sends F1,F2,F3,F4"
; This loop will determine which key we send
For $j = 0 To 3

    ; You said "it sends f1 the first for $i = 1 to x"
    ; This loop will send the selected key 4 times
    For $i = 1 To 4
        ; Create Send Command
        $sLine = 'Send("{' & $aKeys[$j] & '}")'
        ; Display it to show it is correct
        ConsoleWrite("Pass " & $i & ": " & $sLine & @CRLF)
    Next
Next

; You said: "done"
Exit

Anywhere near what you want? :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

pezo89,

You really do need to take a class in how to explain yourself clearly - once again I have very little idea of what you want to do! :nuke:

This is my best guess as the moment: :shifty:

; You said "4 keypresses after each other [...] say f1-f2-f3-f4"
Global $aKeys [4] =["F1", "F2", "F3", "F4"]

; You said "it sends F1,F2,F3,F4"
; This loop will determine which key we send
For $j = 0 To 3

    ; You said "it sends f1 the first for $i = 1 to x"
    ; This loop will send the selected key 4 times
    For $i = 1 To 4
        ; Create Send Command
        $sLine = 'Send("{' & $aKeys[$j] & '}")'
        ; Display it to show it is correct
        ConsoleWrite("Pass " & $i & ": " & $sLine & @CRLF)
    Next
Next

; You said: "done"
Exit

Anywhere near what you want? :x

M23

lol yea, im sry but it was written long into the night,

well as far as i could see, it wasent exactly like that.. easiest way to explain is in this way (i think)

i have used the loopmode for, so it does actions in beneeth 4 times in total, but what i need.

is to send 4 keys in in total before it goes next , so it does one loop with for example F1, so next it does F2, then F3 and F4, so by the time the for $i 1 to 4 is done it has been trough all those 4 keys.

mabye that was abit more understandable? :P

Edited by pezo89
Link to comment
Share on other sites

; You said "4 keypresses after each other [...] say f1-f2-f3-f4"
Global $aKeys [4] =["1", "2", "3", "4"]
ShellExecute("notepad.exe")
WinActivate("notepad")
sleep (1000)
; You said "it sends F1,F2,F3,F4"
; This loop will determine which key we send
For $j = 0 To 4

    ; You said "it sends f1 the first for $i = 1 to x"
    ; This loop will send the selected key 4 times
    For $i = 1 To 1
        ; Create Send Command
        $sLine = 'Send("{' & $aKeys[$j] & '}")'
        send ($sLine)
        ; Display it to show it is correct
        ConsoleWrite("Pass " & $i & ": " & $sLine & @CRLF)
    Next
Next

; You said: "done"
Exit
i think i figured it out, with a small modification :x,

and yes. notepad is just a testplatform :P.. Thanks alot Melba, i really appriciate the help, and i must admit im learning a new thing from this, witch i really appriciate..

but do you know about any good and helpfull Tutorials? that uv tried or you could suggest? as im really eager to learn more about the Autoit Script lang..

and searched the web, alot out there, but as so many other things, alot of bad ones aswell =)

Edited by pezo89
Link to comment
Share on other sites

  • Moderators

pezo89,

mabye that was abit more understandable?

No! :shifty:

But I have given you an example of how you might code something like that in the post above. Just modify that script to do what you want - you have all the elements (array of key values, twin loops, construction of the Send command) to do what you want in there. :P

M23

Edit: See, I told you you could do it! :x

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

pezo98,

My pleasure! :x

But you did it on your own, remember? :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...