Jump to content
Fin

Can MouseMove($pos[0], $pos[1]$x,0) take a variable at $x...?

Recommended Posts

Fin

Hello...:)

I have done extensive searches on this issue before posting but have not found a solve. Any help will be greatly appreciated.

;I have a valid AutoIt support question and kindly provided the details of my system:
;AutoIt Version: V3.3.14.2 [X32]
;Windows Version: WIN_VISTA [X86]
;Language: English (0409)

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

Global $form = GUICreate("O_o", 146, 66, -1, -1)
Global $inputNorth = GUICtrlCreateInput("", 12, 24, 53, 21)
Global $btnSet = GUICtrlCreateButton("Set Controls", 72, 16, 65, 33, $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)

HotKeySet("{UP}","_north")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $btnSet
            Global $goNorth= "-" & GUICtrlRead($inputNorth)
            MsgBox(0,"", "go north: " & $goNorth)

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
;functions
Func _north()
    $pos=MouseGetPos()
    MouseMove($pos[0], $pos[1]$goNorth,0) ;-results in syntax error
EndFunc

As you can see, $goNorth gets its value from $inputNorth
(the MsgBox shows it works)
But I cannot get MouseMove() to take $goNorth

If I use: MouseMove($pos[0], $pos[1]$goNorth,0) --I get a syntax error.

If I use: MouseMove($pos[0], $pos[1] & $goNorth,0) --I no longer get a syntax error, but that's not right so the function, (likely), moves by zero.

So is there a way I can get MouseMove() to take a variable for that parameter?

Thank you in advance should you choose to help!

Share this post


Link to post
Share on other sites
pixelsearch

Hello Fin, a plus sign should do it :

MouseMove($pos[0], $pos[1] + $goNorth, 0)


 

  • Like 1

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@Fin
What is this script for?

Best Regards.

  • Like 1

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
Melba23

FrancescoDiMuro,

Why do you ask? What business is it of yours?

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@Melba23
I saw $goNorth, and I thought that it was something for game automation.
Just to point out that here, game automation scripts are not allowed.

Best Regards.

  • Like 1

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
232showtime
11 hours ago, Fin said:

So is there a way I can get MouseMove() to take a variable for that parameter?

yes there are so many ways :D, but you need to tell us what app you want to automate because there are strict rules here and I don't want my ass to be kicked... :sweating:

  • Like 1

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites
Melba23

232showtime,

Quote

 you need to tell us what app you want to automate

No he/she does not. - there is nothing in that question other than some operator confusion. Why are you all trying to get the thread locked?

Quote

I don't want my ass to be kicked

Then report the thread and ask for a Mod to take a look before you reply - simples.

M23

  • Like 1
  • Thanks 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Fin
On 6/19/2018 at 12:46 AM, pixelsearch said:

Hello Fin, a plus sign should do it :

MouseMove($pos[0], $pos[1] + $goNorth, 0)


 

Thanks!  That worked.  I was hoping it was something small like that...:)

Share this post


Link to post
Share on other sites
Fin
On 6/19/2018 at 2:54 AM, FrancescoDiMuro said:

@Fin
What is this script for?

Best Regards.

It's just to control my mouse in photoshop.

 

2018-06-20 12_08_13-MouseController.png

Share this post


Link to post
Share on other sites
Fin
On 6/19/2018 at 3:28 AM, 232showtime said:

yes there are so many ways :D, but you need to tell us what app you want to automate because there are strict rules here and I don't want my ass to be kicked... :sweating:

Thanks.  I understand.  I read all the rules before posting and saw that about game and other program automation.  I'm not into that so it'll be no problem...:)

All I'm doing is making a small program to control my mouse (brush/tool) in photoshop, and to send button clicks so I get even looking dots or whatever.

Adding a + before the variable solved my issue but thanks for offering to help! I really appreciate it...:)

Share this post


Link to post
Share on other sites
FrancescoDiMuro
Posted (edited)

@Fin

My apologizes to you :) Feel always free to ask what is not clear for you :)

@Melba23

On 19/6/2018 at 1:51 PM, Melba23 said:

Why are you all trying to get the thread locked?

In a forum where almost everyday someone asks for gane-automation, I think it is legit to ask what he was trying to do with his script, and he has been courteus replying us :)

I don't see anything wrong with MY question.

Thanks again Fin for have read Forum Rules :)

 

Best Regards.

Edited by FrancescoDiMuro
  • Like 1

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
Fin

@FrancescoDiMuro

1 hour ago, FrancescoDiMuro said:

My apologizes to you :) Feel always free to ask what is not clear for you :)

No apology necessary...:)  I probably should have been more clear upfront.  TBH, I was a little nervous after reading all the rules and just wanted to be as short and to the point as possible.  Next time I'll include a little more information for sure...:)

Thanks again for the offer to help!  I'm just learning AutoIt and I love it!  It's very easy to understand, but I'm sure I'll have questions in the future so it's nice to know there are people around to ask.  And while I don't know very much yet, I will spend some time here in case I can be of help to someone else...:)

Thanks again!  Take care!

  • Like 1

Share this post


Link to post
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

  • Similar Content

    • CodingMonkey81
      By CodingMonkey81
      All,
      I'm working on automating the update process for a piece of software that we use at my company. The installer file always contains the version number as a part of the file name (eg InstallFile_9342.msi) and the numbers always change with every update.
      How do I use AutoIt to run the program? I know I can't use a wildcard in place of the numbers when using the "Run" command. 
      I tried 
      Local $aArray = _FileListToArray("C:\path\to\file", "InstallFile_*.msi", 0, 1) Run("$aArray") and I also tried
      Local $bInstall = FileFindFirstFile("InstallFile_*.msi") Run("$bInstall") and neither worked. 
      Can someone please point me in the right direction? I've done some searching on the forum and haven't found anyone in a similar situation before.
      Thanks!
    • RHolmes
      By RHolmes
      I have a program that has a control that changes color a few seconds into running. So ideally, I would poll this to tell when an event has occurred. 
      I can't seem to retrieve the correct color value for a control. It always seems to return white indicating that its selecting somewhere else in the window.
      In the PixelGetColor call I'm adding half the width to the x value and subtracting half the height to the y value  in order to get the center of the control. (assuming the coords returned by ControlGetPos are top left - which i can't be sure of) But I've also tried without modifying the x/y and with changing the PixelCoordMode option to 2. Maybe I'm making a silly mistake and can't see it? Any help would be appreciated.
      Code is below:
      Opt("PixelCoordMode", 0)
      FileChangeDir( "C:\Where\My\File\Is" );
      Run( "MyProgram.exe" )
      Local $hClient = WinWaitActive( $CLIENT_TITLE, "", 10 )
      Local $systemIndicatorClassNN= "[CLASS:Qt5QWindowIcon; INSTANCE:99]"
      Local $hSystemIndicator = ControlGetHandle ( $hClient, "", $systemIndicatorClassNN)
      Local $xywh = ControlGetPos ( $hClient, "", $hSystemIndicator )
      For $i = 10 To 1 Step -1
            $color = PixelGetColor ( $xywh[0] + ($xywh[2]/2), $xywh[1] - ($xywh[3]/2), $hClient )
            LogToFile( $color )
            Sleep( 2000 )
      Next
    • VAN0
      By VAN0
      Hello.
      I have a program XX that asks for user confirmation on exit, which hangs the system reboot/shutdown process until I confirm. So I decided create a autoit script that would automatically close that dialog and let the system reboot/shutdown.
      The problem I'm facing is that my scripts now exits before the XX.
      Is there a way delay script exit until the XX is closed but only when system is rebooting/shutting down?
       
      Thank you.
    • Simpel
      By Simpel
      Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData.
      #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank?
      Regards, Conrad
    • hunte922
      By hunte922
      Edit: The solution! Maybe?
       
      I need to download an image from a website using AutoIt but the download, when viewed in a text editor, does not appear to be the same as if I had downloaded it from a web browser.
      Could anyone help me figure out why this is happening?
      I've already tried _INetGetSource, InetGet, _IENavigate, wget, this, and a few .bat and .vbs scripts.
       
      Example Code:
      #include <Inet.au3> Local $source = _INetGetSource("http://c0.rbxcdn.com/0db36a45eae4838667ae9a46ba0c082a") Local $newfile = FileOpen(@ScriptDir & "\test.txt", 2) FileWrite($newfile, $source) FileClose($newfile) Image URL: http://c0.rbxcdn.com/0db36a45eae4838667ae9a46ba0c082a
      Screenshot attached.

×