Jump to content

Coordinates thru InputBoxes?


Recommended Posts

Hey,

I wanna code a program, in which the user can choose the Coordinates where the Mouse moves himself (using input boxes)

See the Code below, thats how I tried it, but AutoIT gives me an Error.

Any Ideas?

Greetings,

Tomato

P.s.: My GUI uses the EventMode.

My Code:

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\kevin\eigene dateien\aaa.kxf

Opt("GUIOnEventMode", 1)

$Form1_1 = GUICreate("", 443, 455, 192, 124)

$simple = GUICtrlCreateButton("Simple Mode", 24, 24, 177, 41, $WS_GROUP)

GUICtrlSetCursor (-1, 0)

guictrlsetonevent ( -1 , "_start" )

$advmode = GUICtrlCreateButton("Advanced Mode [in Progress]", 248, 24, 177, 41, BitOR($BS_CENTER,$BS_FLAT,$WS_GROUP))

GUICtrlSetCursor (-1, 7)

guictrlsetonevent ( -1 , "_progress" )

$Label1 = GUICtrlCreateLabel("Requires Resolution.", 24, 72, 102, 17)

$Label2 = GUICtrlCreateLabel("Done to 25%.", 248, 72, 68, 17)

$xcoord = GUICtrlCreateInput("X-Coordinate", 240, 136, 169, 21)

GUICtrlSetCursor (-1, 5)

$ycoord = GUICtrlCreateInput("Y-Coordinate", 240, 176, 169, 21)

$Group1 = GUICtrlCreateGroup(" HowTo: Simple Mode ", 24, 128, 185, 73)

$Label3 = GUICtrlCreateLabel("Using the AutoIT Window Info, put", 32, 144, 168, 17)

$Label4 = GUICtrlCreateLabel("in your X- and Y-Coordinates of the", 32, 160, 168, 17)

$Label5 = GUICtrlCreateLabel("red marked space.", 32, 176, 116, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Checkbox1 = GUICtrlCreateCheckbox("KeepCloths", 240, 224, 17, 17)

$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 240, 256, 17, 17)

$Checkbox3 = GUICtrlCreateCheckbox("Checkbox2", 240, 288, 17, 17)

$Label6 = GUICtrlCreateLabel("Keep Clothes [in Progress]", 256, 224, 129, 17)

$Label7 = GUICtrlCreateLabel("Keep Quests [in Progress]", 256, 256, 127, 17)

$Label8 = GUICtrlCreateLabel("Keep Other [in Progress]", 256, 288, 120, 17)

$Group2 = GUICtrlCreateGroup(" Credits ", 232, 320, 185, 41)

$Label9 = GUICtrlCreateLabel("Made by", 240, 336, 118, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$elite = GUICtrlCreateButton("", 232, 376, 185, 65, $WS_GROUP)

guictrlsetonevent ( -1 , "_elite" )

$Pic1 = GUICtrlCreatePic("PictureDirectory", 24, 216, 185, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

Sleep (1000)

WEnd

Func _start ()

While 1

MouseMove (GUICtrlRead $xcoord, GUICtrlRead $ycoord)

Sleep (50)

WEnd

EndFunc

Func _progress ()

MsgBox ("", "Feature in Progress", "Sorry, I'm still working on this Feature.")

EndFunc

Func _elite ()

Run ("explorer.exe website")

EndFunc

Edited by ShootTomato
Link to comment
Share on other sites

MouseMove (GUICtrlRead $xcoord, GUICtrlRead $ycoord
should be

MouseMove (GUICtrlRead ($xcoord), GUICtrlRead ($ycoord))
Edited by P5ych0Gigabyte
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

first, in posts surround your code with [ autoit] [ /autoit] tags (without the spaces) so your code will stand out from your message

like this:

[ autoit]

MouseMove (GUICtrlRead($xcoord), GUICtrlRead($ycoord))

[ /autoit]

will result in this:

MouseMove (GUICtrlRead($xcoord), GUICtrlRead($ycoord))

Your script neglected the the "()" around $xcoord and $ycoord.

Also you have mousemove in a while loop, with no condition to ever end the loop.

Link to comment
Share on other sites

I made a couple more mods here. First I made the window respond to hitting the close button, second I set a hotkey (Ctrl+alt+f), the same as AUInfo tool) that will capture the current mouse coordinates, and set the x and y accordingly.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\kevin\eigene dateien\aaa.kxf
Opt("GUIOnEventMode", 1)
$Form1_1 = GUICreate("", 443, 455, 192, 124)
$simple = GUICtrlCreateButton("Simple Mode", 24, 24, 177, 41, $WS_GROUP)
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")

GUICtrlSetCursor (-1, 0)
guictrlsetonevent ( -1 , "_start" )
$advmode = GUICtrlCreateButton("Advanced Mode [In Progress]", 248, 24, 177, 41, BitOR($BS_CENTER,$BS_FLAT,$WS_GROUP))
GUICtrlSetCursor (-1, 7)
guictrlsetonevent ( -1 , "_progress" )
$Label1 = GUICtrlCreateLabel("Requires Resolution.", 24, 72, 102, 17)
$Label2 = GUICtrlCreateLabel("Done to 25%.", 248, 72, 68, 17)
$xcoord = GUICtrlCreateInput("X-Coordinate", 240, 136, 169, 21)
GUICtrlSetCursor (-1, 5)
$ycoord = GUICtrlCreateInput("Y-Coordinate", 240, 176, 169, 21)
$Group1 = GUICtrlCreateGroup(" HowTo: Simple Mode ", 24, 128, 185, 73)
$Label3 = GUICtrlCreateLabel("Using the AutoIT Window Info, put", 32, 144, 168, 17)
$Label4 = GUICtrlCreateLabel("in your X- and Y-Coordinates of the", 32, 160, 168, 17)
$Label5 = GUICtrlCreateLabel("red marked space.", 32, 176, 116, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Checkbox1 = GUICtrlCreateCheckbox("KeepCloths", 240, 224, 17, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 240, 256, 17, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox2", 240, 288, 17, 17)
$Label6 = GUICtrlCreateLabel("Keep Clothes [In Progress]", 256, 224, 129, 17)
$Label7 = GUICtrlCreateLabel("Keep Quests [In Progress]", 256, 256, 127, 17)
$Label8 = GUICtrlCreateLabel("Keep Other [In Progress]", 256, 288, 120, 17)
$Group2 = GUICtrlCreateGroup(" Credits ", 232, 320, 185, 41)
$Label9 = GUICtrlCreateLabel("Made by", 240, 336, 118, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$elite = GUICtrlCreateButton("", 232, 376, 185, 65, $WS_GROUP)
guictrlsetonevent ( -1 , "_elite" )
$Pic1 = GUICtrlCreatePic("PictureDirectory", 24, 216, 185, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

HotKeySet("^!f","_mousepos")

While 1
Sleep (1000)
WEnd

Func _Exit()
    Exit
EndFunc

Func _mousepos()
    GUICtrlSetData($xcoord,MouseGetPos(0))
    GUICtrlSetData($ycoord,MouseGetPos(1))
EndFunc

Func _start ()
While 1
MouseMove (GUICtrlRead($xcoord), GUICtrlRead($ycoord))
Sleep (50)
Wend
EndFunc

Func _progress ()
MsgBox ("", "Feature in Progress", "Sorry, I'm still working on this Feature.")
EndFunc

Func _elite ()
Run ("explorer.exe website")
EndFunc
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...