Jump to content

New to AutoIT - Can't Get a Simple MouseClick working...


Recommended Posts

I'm trying to program a simple program for self use in Magic Online. I followed a few simple tutorials to get accustomed to the syntax (used to C++) and I've hit a bit of a brick wall with the simplest of functions. I cannot seem to get the program to click anywhere on the game window. I don't get any errors or anything, it just doesn't do anything. (Seemingly)

I'm using a GUI button to call this incredibly simple function:

Func GoToCollection()
MouseClick("Left",240,1021, 2)
EndFunc

My GUI code:

GUICreate("Test Window",500,500)
GUISetState(@SW_SHOW)

$startbutton = GUICtrlCreateButton("Start", 8, 8, 60)

While 1
$msg = GUIGetMsg()

Select

Case $msg = $startbutton
WinActivate("Magic Online", "")
Sleep(1000)
Call(GoToCollection())

Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
ExitLoop

EndSelect

WEnd

Obviously, I've double and triple decked that the mouse coordinates are correct before posting, so it's not something as silly as that, but I imagine it's something rather simple that I'm overlooking, but I can't seem to figure it out via Google searches. The window switch works, but then nothing happens. I've tried it without the function call and just doing it in the switch, I've tried clicking a lot of different buttons but none of them will click. Any idea what I'm overlooking here?

Edited by LotusCobra
Link to comment
Share on other sites

Welcome to Autoit and the forum!

Unfortunately you've missed to read the forum rules (link is in the lower right corner of this page).

Game automation isn't allowed here.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Have a look in the help file at Opt / MouseCoordMode.

My guess is that you got the values with WinInfo. Within the default setting the mouse is moved to the absolut screen coordinates. Try this in the beginning of your script:

Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client

Hmm, tried it in all 3 modes and none of them seemed to change anything.

Welcome to Autoit and the forum!

Unfortunately you've missed to read the forum rules (link is in the lower right corner of this page).

Game automation isn't allowed here.

Even when it's widely supported by the game? The game's entire economy is run by bots. (And it's mostly seen as a good thing) Edited by LotusCobra
Link to comment
Share on other sites

The Mods handle the rules rather strict when it comes to game automation. Let's see what the Mods say ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

LotusCobra,

water is quite right - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. We have no interest in what goes on elsewhere - here we do not support bots. Follow the rules or leave. Thread locked. :naughty:

MrChiliCheese,

If a post is obviously game-related (and "for self use in Magic Online" is a pretty good clue) best not to offer any help. ;)

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...