Jump to content

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


Recommended Posts

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!

Link to post
Share on other sites
  • Moderators

FrancescoDiMuro,

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

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 post
Share on other sites
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:

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.

Link to post
Share on other sites
  • Moderators

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

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 post
Share on other sites
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...:)

Link to post
Share on other sites
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...:)

Link to post
Share on other sites

@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

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to post
Share on other sites

@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!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By WhaleJesus
      #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <file.au3> ; Create Data Folder if it doesn't exist yet If FileExists(@ScriptDir & "\Data") Then Else ShellExecute(@ScriptDir) DirCreate(@ScriptDir & "\Data") EndIf ; Playlist Name & location input Global $playlistnameinput = InputBox("Playlist", "Enter The playlist name", _ "Name") Global $playlistlocationinput = InputBox("Location", "Specify where you would like the playlist folder to be stored", @ScriptDir & "\Playlists\" & $playlistnameinput) ; Create file in Data folder and other vars Global $sDataFile = @ScriptDir & "\Data\Data.txt" Global $DataHandle = FileOpen($sDataFile, 1) Global $DataFileLine = FileReadLine($sDataFile, 1) FileClose($DataFileLine) MsgBox(0, "", $DataFileLine, 10) ; Prove it exists If FileExists($sDataFile) Then _FileWriteToLine($DataHandle, $DataFileLine, $playlistnameinput, True, True) $DataFileLine += 1 _FileWriteToLine($DataHandle, 1, $DataFileLine, True) Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sDataFile & "Does not exist") EndIf Global $sPDataFile = @ScriptDir & "\Data\" & $playlistnameinput & "_Data.txt" Global $PDataHandle = FileOpen($sPDataFile, 1) If FileExists($sPDataFile) Then _FileWriteToLine($PDataHandle, 1, $playlistnameinput, True, True) _FileWriteToLine($PDataHandle, 2, $playlistlocationinput, True, True) Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sPDataFile & "Does not exist") EndIf _FileWriteToLine stopped working and i don't know what it is in my code that's causing this, please help
    • By DannyJ
      $sCommands1 = 'powershell.exe Get-ChildItem' $iPid = run($sCommands1   , @WorkingDir , @SW_SHOW , 0x2) $sOutput = ""  While 1     $sOutput &= StdoutRead($iPID)         If @error Then             ExitLoop         EndIf  WEnd ;~ msgbox(0, '' , $sOutput) ConsoleWrite("$sOutput") ConsoleWrite($sOutput) ConsoleWrite(@CRLF) $aOutput = stringsplit($sOutput ,@LF , 2) For $i=0 To  UBound($aOutput) - 1 Step 1     ConsoleWrite($aOutput[$i]) Next The script above reads the whole directory into a one dimensional array, but I need to work with the array, so I need to split the array into multiple dimensions.
      I have already read some forum answers here, and I have already tried these commands:
       
      Are there any way to use the $aOutput variable like in PowerShell:
      PowerShell:
      $a = Get-ChildItem $a.Mode I imagine this in AutoIt  $aOutput
      ConsoleWrite($aOutput[i].Mode) Or if I split this command into 2 dimension like:
      For $i To UBound($aOutput)-1 Step 1 ConsoleWrite($aOutput[$i][1]) ConsoleWrite($aOutput[$i][2]) Next  
    • By DannyJ
      If I run this code, it works perfectly
      $CmdPid = Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit " & 'Get-ChildItem',@DesktopDir, @SW_SHOW) But this code
      $CmdPid = Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit " & 'Get-RDUserSession',@DesktopDir, @SW_SHOW) I get this error:
      Get-RDUserSession : The term 'Get-RDUserSession' is not recognized as the name of a cmdlet, function, script file, or o perable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga in. If I try run the command Get-RDUserSession  in normal PowerShell (started from windows start menu) the command works perfectly.
      But If I run with AutoIt I get the above mentioned error .
      Any ideas?
    • By Automania
      Hi all,
      I haven't used AutoIt in more than 10 years and I am sure a lot has improved since that long time. I hope you can give me some suggestions on my approach.
      Task: I need to extract user data (for around 1700 users) from a website tool. That tool shows an output in a table on the website. However, no export feature is available and I need the data in an Excel file, such as:
      username, serial number (of a laptop), ID number (of laptop) and some more
       
      With my knowledge from 2009 I would do this:
      1) use _IEextract with each username in the url to get the whole source code of the website with the user's data summary
      2) Work with lots of regexpressions to extract each data piece, save them into variables/array
      3) Write variable values into an Excel file
      4) rinse repeat 1700 times
       
      The relevant line for step 3 looks like this:
      <td class="resultcell"><span class="new">2021-03-23 11:05:00</span></td><td class="resultcell">Hostname-1234</td><td class="resultcell"><a href="?&Search=Search&result=summarized%20history&field=serial%20numbers&criteria=123456">123456</a></td><td class="resultcell">0987654/td><td class="resultcell"><a href="?&Search=Search&result=summarized%20history&field=usernames&criteria=myusername">myusername</a> and so on.. so here it would be Hostname-1234, 0987654 and myusername that I would need to extract.

      Although this may work it does not appear very efficient and would take a while. So I am happy for an alternate approach. Preferably, without using additional exe binary files due to company policies besides AutoIt itself.
    • By SEuBo
      Hi!
      I am just getting started with C and C++. I have created a pretty simple C code which is calling a dll function.
      When I compile and run, I get the appropriate Output. So it works fine.

       
      Now I would want to transform that to AutoIt. -> I would like to call the "RfcOpenConnection" function from AutoIt - but whatever I try with DLLCall, I can not get it to work. 
      Can someone point me in the right direction? DLL, C Sourcecode and compiled exe are attached too large to be attached, so they're uploaded here: 
      https://drive.google.com/file/d/12CUSsISl0mojiMCNxKjps1Sdoox3JlCX/view?usp=sharing
       
      Thanks a bunch!
×
×
  • Create New...