Posted: Tue Apr 06, 2021 4:21 pm Post subject: Auto Mouse Click V1 (Save-Load-Repeat)
Over existing CE-Lua codes;
Let's do an automatic click simulation.
I've posted an example of this as a free Trainer.
I find it useful to share the code content as an add-on in this archive.
The codes used;
getMousePos()
setMousePos()
mouse_event()
keyDown()
keyUp()
Trainer usage explanation;
1) Save: Move the mouse arrow to the place to be clicked and press the F8 key.
2) Speed: Set the click speed. (1 x 10 is predicted. Accordingly, Speed (100) = 10 will be written. Default = 5 (= speed (50))
3) Repeat: Determine how long you will repeat the list. Default = 1.
4) Lock: After all settings are done, it locks the list and creates a hotkey for start.
5) Start: Press the hotkey created by locking and activate it. Default = F9.
You can edit the code below or save it to a .lua file as it is and drop it in the CE >> Autorun folder.
Here is the code;
Mouse Auto Click (M_A_Clk)
Code:
--[[
RequiredCEVersion=7.1
if (getCEVersion==nil) or (getCEVersion()<RequiredCEVersion) then
local answer = messageDialog("This encoding will work better with\nCE 7.1 and above versions.\nWould you like to go to the\nCheat Engine page to download the latest version?", mtWarning, mbYes, mbNo)
if answer == mrYes then
shellExecute("https://www.cheatengine.org/")
closeCE()
return caFree()
else
closeCE()
return caFree()
end
end
]]
--################################################################--
--################################################################--
function AutoClick1()
if AC_frm then AC_frm.Destroy() AC_frm=nil end
function SaveClk()
sleep(200)
if AC_memo1.Enabled==false then
showMessage("The list appears to be locked.\nPlease unlock the list first!\nListe kilitli görünüyor.\nLütfen önce listenin kilidini açın!");
else
AC_memo1.Lines.Add(">>"..AC_lblx.caption.."<< >>"..AC_lbly.caption.."<<")
end
end
autoH3=createHotkey(SaveClk, VK_F8)
function LoadClk()
keyUp(VK_F9)
RpT=tonumber(RpT) + 1
RpT1=tonumber(AC_edt2.Text)
local spd2=tonumber(AC_edt1.Text) * 10
if AC_edt1.Text=="" then spd2=50 end
sleep(200)
local SL = createStringlist()
SL.Text=AC_memo1.Lines.Text
local finiss=strings_getCount(AC_memo1.Lines)-1
for i=0, strings_getCount(SL)-1 do
sleep(tonumber(spd2))
Px2=SL[i]:match(">>PosX: (.-)<< ")
--print("Px2: "..Px2)
Py2=SL[i]:match("<< >>PosY: (.-)<<")
--print("Py2: "..Py2)
if Px2~=nil then
setMousePos(Px2,Py2)
mouse_event(MOUSEEVENTF_LEFTDOWN)
mouse_event(MOUSEEVENTF_LEFTUP)
end
if i==finiss then
rslt=tonumber(rslt) + i + 1
--print(RpT.." / "..RpT1)
if RpT==RpT1 then
showMessage("Auto Click Finished!\nTotal Click: "..rslt)
else
keyDown(VK_F9)
end
end
end
SL=nil
end
AC_chk1.OnChange=function()
if AC_edt2.Text=="" then AC_edt2.Text="1" end
if AC_chk1.checked==true then
rslt=0
RpT=0
AC_memo1.Enabled=false
AC_btn1.Enabled=false
AC_edt1.Enabled=false
AC_edt2.Enabled=false
AC_chk1.caption="Un-Lock"
if autoH2 then autoH2.destroy() autoH2=nil end
autoH2=createHotkey(LoadClk, VK_F9)
else
if autoH2 then autoH2.destroy() autoH2=nil end
AC_memo1.Enabled=true
AC_btn1.Enabled=true
AC_edt1.Enabled=true
AC_edt2.Enabled=true
AC_chk1.caption="Lock"
end
end
AC_btn1.OnClick=function()
AC_memo1.Lines.Text=""
end
--################################################################--
AC_pnl2.OnClick=function()
AC_frm.WindowState = "wsMinimized"
end
AC_pnl3.OnClick=function()
AC_frm.Close()
--closeCE()
--return caFree
end
AC_pnl5.OnClick=function()
shellExecute("https://www.paypal.com/xclick/business=dark_byte%40hotmail.com&no_note=1&tax=0&lc=US")
end
function panelcap(item2) --Effect
item2.BevelColor=16728064
item2.Cursor= -21
item2.BevelInner="bvRaised" item2.BevelWidth=3
item2.Font.Style="fsBold"
item2.OnMouseMove=function() item2.BevelColor=0xffffff end
item2.OnMouseLeave=function() item2.BevelColor=16728064 end
end
panelcap(AC_pnl2) panelcap(AC_pnl3) panelcap(AC_pnl5)
end
--AutoClick1()
if miAClick then miAClick.Destroy() end
local mf = getMainForm()
local mainMenu = mf.Menu.Items
miAClick = createMenuItem(mf.MainMenu)
miAClick.Caption = 'M_A_Clk'
miAClick.OnClick=AutoClick1
mainMenu.insert(mainMenu.Count-1,miAClick)
Pretty neat.
You could add an 'auto repeat' checkbox to the list (above and below) and that way you don't need to copy-paste.
Rinse and repeat until the next F9
Or, add a 'Run count' box, too where you can enter how many times the list is repeated.
Thanks @Csimbi. It's nice to be in control of the masters.
If you watched the code from the video, yes I did copy-paste to repeat it.
But in the code I shared above, I left a box for "Repeat".
The repeat box defaults to 1, but clicking "F9" will continue clicking until the value entered in the "Repeat" box.
Please test the code.
Thanks again for the return. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum