简体   繁体   中英

AutoIt Mouse Click doesn't seem to be working

I made a batch file and I need it to click on the screen. I know you cannot do this with just a batch file and so I downloaded Autoit. However, everytime I run my code, it says that MouseClick is not a valid command. I downloaded AutoIt and redownloaded it but it keeps showing the same message.

@if (@CodeSection == @Batch) @then


@echo off
start "" http://www.getluckee.com/games/5
set SendKeys=CScript //nologo //E:JScript "%~F0"

Timeout 18

nircmd setcursor 700 400


set _number=0

:action
if %_number%==100 goto :end
%SendKeys% "{LEFT}"

%SendKeys% "{DOWN}"

%SendKeys% "{RIGHT}"

%SendKeys% "{UP}"
echo %_number%
set /a _number +=1
goto :action

:end
Timeout 5
nircmd setcursor 830 140
Timeout 2
MouseClick("left")
Timeout 10


%SendKeys% "exit{ENTER}"

goto :EOF


@end


// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

It seems like you have an AutoIt function in a batch script. If you are still set on using batch, You could create a file like below:


leftClick.au3

Sleep(250)
MouseClick("left")

and then


myBatch.bat

@if (@CodeSection == @Batch) @then


@echo off
start "" http://www.getluckee.com/games/5
set SendKeys=CScript //nologo //E:JScript "%~F0"

Timeout 18

nircmd setcursor 700 400


set _number=0

:action
if %_number%==100 goto :end
%SendKeys% "{LEFT}"

%SendKeys% "{DOWN}"

%SendKeys% "{RIGHT}"

%SendKeys% "{UP}"
echo %_number%
set /a _number +=1
goto :action

:end
Timeout 5
nircmd setcursor 830 140
Timeout 2
START leftClick.au3
Timeout 10


%SendKeys% "exit{ENTER}"

goto :EOF


@end


// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM