Jump to content

Mousemove using a single variable - Mousemove($coord, 1, 0)


Go to solution Solved by Melba23,

Recommended Posts

Hello!

I was searching for this in the internet but the closest solution I found was a thread in this forum:

'?do=embed' frameborder='0' data-embedContent>>

So i want to do mousemove/mouseclick by only using one variable. 

Instead of 

Mouseclick(123, 456, 1, 0)

i would like to do

Mouseclick($theplace, 1, 0)

;~ But of course it does not work to just define variable like this:

$theplace = "123, 456"

in the old thread somebody suggested

$COORD=stringsplit("300,400",","); auto creates 3 dimention array with $COORD[1]=300, $CHORD[2]=400
MouseMove($COORD[1],$CHORD[2])

or

$COORD=stringsplit("300,400",",")
MouseMove($COORD[1],$CHORD[2],0); I like it to move very fast.

 

But a i said i want to know if there is a way to do it without having to put in same var two times... Just MouseMove($thisplace, 0)

Would be happy about any solutions :)

Link to comment
Share on other sites

  • Moderators
  • Solution

VVind0wM4ker,

Welcome to the AutoIt forums. :)

Just create your own function to wrap the standard MouseClick: ;)

$theplace = "123|456"

_MyMouseClick($theplace, 1, 0)

Func _MyMouseClick($sPos, $iNumber = 1, $iSpeed = 0)

    ; Split the value
    $aPos = StringSplit($sPos, "|")
    ; Call the normal function
    MouseClick($aPos[1], $aPos[2], $iNumber, $iSpeed)
    
EndFunc
Please ask if you have any questions. :)

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

one example

Local $array[5] = ["Left",123,456,1,100]
MouseClick_Array($array)
Func MouseClick_Array($a)
    If UBound($a)<>5 
    MouseClick($a[0],$a[1],$a[2],$a[3],$a[4])
EndFunc
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Thanks Melba23!
And you got me its my first post :D
 
If there is no other way (but i already thought that) then this is fine :)
I only have one Question: 
 
_MyMouseClick($theplace, 1, 0) 
Func _MyMouseClick($sPos, $iNumber = 1, $iSpeed = 0)
 
If I start _MyMouseClick ($theplace, 1, 0)
 
then i start it with 3 Arguments (is this called so?)
but in the Func you overwrite them right ? i think  it should be
 
Func _MyMouseClick($sPos, $iNumber, $iSpeed)
 
Or not? Cause $iNumber = 1 sets the var to 1 instead of setting it to the number, i started the function with
 
Thanks also to all others who replied =)
 
And yeah as you can see english is obviously not my mother language. sry ;)
Link to comment
Share on other sites

  • Moderators

VVind0wM4ker,

 

Cause $iNumber = 1 sets the var to 1 instead of setting it to the number, i started the function with

No it does not. it will only set the value to 1 if you do not define the parameter when you call the function - run this small example and see the results: ;)

#include <MsgBoxConstants.au3>

; Call the function with no parameter
_DefaultTest()

; And now pass a parameter
_DefaultTest(3)


Func _DefaultTest($iParam = 99)

    MsgBox($MB_SYSTEMMODAL, "Parameter", $iParam)

EndFunc
All clear? :)

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

Melba23

Oh ok. I found the mistake (nothing happend when using the funktion). It was the missing Button which was why nothing happend. I think that should make it:

$theplace = "123|456"

_MyMouseClick("secondary", $theplace, 1, 10)

Func _MyMouseClick($MouseButton, $sPos, $iNumber = 1, $iSpeed = 0)

    ; Split the value
    $aPos = StringSplit($sPos, "|")
    ; Call the normal function
    MouseClick($MouseButton, $aPos[1], $aPos[2], $iNumber, $iSpeed)

EndFunc

Thanks for your help :)

VVind0wM4ker

Link to comment
Share on other sites

  • Moderators

VVind0wM4ker,

 

It was the missing Button which was why nothing happened

Sorry about that. :blush:

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

 M23

 
So I think that was it. :)
You know im pretty new here so I have a last Question:
 
There is a "Mark Solved" Button. Will this button mark the thread as "Solved" or also the Post (the one where i clicked the Button)?
 
If 2nd would'nt it be good to make a final solution post an mark it. So other people who come here from google etc. quickly find the solution?
 
Maybe this sounds weird but I have to ask.
 
VVind0wM4ker
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...