Jump to content
Sign in to follow this  
Eraston

KeyInput with DLLcalls

Recommended Posts

Eraston

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

Share this post


Link to post
Share on other sites
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

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

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
jchd

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.

  • Like 1

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)

Share this post


Link to post
Share on other sites
Melba23

Eraston,

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×