Jump to content

KeyInput with DLLcalls


Eraston
 Share

Recommended Posts

First off, i would like to apologize if this has been asked anywhere but i have been messing with this for days and have not found a solution.

What i am hoping to achieve is simple, very simple Automated right clicks and 2 key clicks (Right click x4, F2, Right click, F1, repeat)

what is making this so difficult is i need to call a DLL and close it after every function, therefor i cant (or i dont know how?) use the simple Send function.

With the code bellow, all works except the Key inputs are completely skipped and it just continously right clicks.

I am fairly new to this so please bear with me if this looks sloppy or completly wrong.

While 1
Local $dll = DllOpen("EXAMPLEDLL.dll")
if $dll <> -1 Then
$leftclick=1;
$rightclick=0;
$mousedown=1;
$mouseup=0;
$v_key=71;
$v_key2=70;
$keydown=1;
$keyup=0;


$result3 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mousedown)
Sleep(50);
$result4 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mouseup)
Sleep(50);
DllClose($dll)
Sleep(500)


$result3 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mousedown)
Sleep(50);
$result4 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mouseup)
Sleep(50);
DllClose($dll)
Sleep(500)

$result3 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mousedown)
Sleep(50);
$result4 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mouseup)
Sleep(50);
DllClose($dll)
Sleep(500)

$result3 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mousedown)
Sleep(50);
$result4 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mouseup)
Sleep(50);
DllClose($dll)
Sleep(500)

sleep(700)
$result7 = DllCall($dll, "int", "KeyboardInput", "int", $v_key, "int", $keydown)
Sleep(50);
$result8 = DllCall($dll, "int", "KeyboardInput", "int", $v_key, "int", $keyup)
DllClose($dll)
sleep(700)

$result3 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mousedown)
Sleep(50);
$result4 = DllCall($dll, "int", "SendMouseClick", "int", $rightclick, "int", $mouseup)
Sleep(50);
DllClose($dll)
Sleep(500)


$result7 = DllCall($dll, "int", "KeyboardInput", "int", $v_key2, "int", $keydown)
Sleep(50);
$result8 = DllCall($dll, "int", "KeyboardInput", "int", $v_key2, "int", $keyup)
DllClose($dll)
sleep(500)


endif
WEnd
Edited by Eraston
Link to comment
Share on other sites

Welcome to AutoIt and the forum!

I searched for "GreenMacro" on the web and found it to be game related. Please read our forum rules (link is in the lower right corner of this page) and you will see that game automation isn't allowed here.

"Green Macro can bypass x-trap. It's actually a keyboard/mouse driver. You can use your own scripting language such as AUTOIT, AutoHotKey to call Green Macro keyboard/mouse/pixel functions which are blocked by x-trap"

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Eraston,

Welcome to the AutoIt forum. :)

When I Google "GreenMacroDLL" I get lots of hits on gaming sites suggesting that this DLL is an possible way to bypass gamebot protection in some games. If that is indeed the case, please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation and Bypassing of security measures - anti-bot agents - before you post again. :naughty:

If not then please explain exactly what you are trying to do with this DLL. :)

M23

Edited by Melba23
Typo

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

Trying to cover your ass after the fact by masquerading the DLL name instead of answering the question of a moderator was a childish, idiotic move and will certainly speed up closing of this thread.

Really bad start here.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Moderators

Eraston,

As jchd has pointed out, we are not stupid - thread locked and you are now firmly on my radar. :naughty:

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