Jump to content

SetCursorPos (help)


Mouse
 Share

Recommended Posts

Can someone help me with this?

I'm trying to (set) the mouse position with

$Haha = DllCall("user32.dll "," bool "," SetCursorPos "," int ",997," int ", 435)

and when i run that, there is no errors... but it doesn't set my mouse to that position

Here is my script... when i press the middle mouse button it is suppose to run $Haha

but again - it doesnt

#Include
#include
#include


Local $hDLL = DllOpen("user32.dll")

While 1
If _IsPressed("04", $hDLL) Then
lol()
; Now wait until the key is released
While _IsPressed("04", $hDLL)
Sleep(10) ; ; You need this to keep the CPU from overheating when in this inner loop
WEnd
EndIf
Sleep(10) ; You also need this to keep the CPU from overheating when in this outer loop
WEnd



Func lol()


;;;;;;;;;;;
$hDLL = DllOpen("user32.dll")
;;;;;;;;;;;;;;;;;;;;;;;;


DllCall("user32.dll "," bool "," SetCursorPos "," int ",997," int ", 435)


endfunc

Link to comment
Share on other sites

  • Moderators

Mouse,

And why are you not using MouseMove? :huh:

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

Mouse,

And why are you not using MouseMove? :huh:

M23

Tryin' something different

I have been using Autoit for about 2 years now, and i have always been using Mousemove...

so i want to see if i can approach this a different way by using this method and actually setting the mouse position; thats all. :thumbsup:

Edited by Mouse
Link to comment
Share on other sites

This does

DllCall("user32.dll ","bool","SetCursorPos","int",997,"int", 435)

Why to add unnecessary spaces

please do check the error macro you are definitely gonna get an error ;)

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

I think I have the same problem too...

I want to write a number in a small box-window but it doesnt do it, what it does:

It writes the number at the same place where my mouse is - which is wrong.

I am telling to go to the box-window in this case:ClassnameNN:TEdit16

I am using following command lines:

ControlClick("[ClassnameNN:TEdit16]", "", "")

Send($wert[1])

Could somebody help me,

Thanks

Link to comment
Share on other sites

I used ControlFocus()

but I still have the same problem....the curser goes to the last place I clicked before I startet my program.

I used follwing code:

WinActivate("[CLASS:TVMU]", "")

WinWaitActive ("[CLASS:TVMU]", "")

Controlfocus("[ClassnameNN:TEdit16]", "", "")

send("1000")

This is the information I get from Autoit v3 Window Info:

>>>> Control <<<<

Class: TEdit

Instance: 16

ClassnameNN: TEdit16

Name:

Advanced (Class): [CLASS:TEdit; INSTANCE:16]

ID: 3408674 //Not always the same

Text:

Position: 93, 301 //Always the same

Size: 60, 24 //Not always the same

ControlClick Coords: 10, 10

Style: 0x540000C0 // Not always the same

ExStyle: 0x00000200 // Not always the same

Handle: 0x00340322

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...