В Wed, 13 Mar 2024 19:01:59 +0530
Christofer Bogaso <bogaso.christo...@gmail.com> пишет:

> I need simulate mouse click in windows machine at certain coordinate
> on screen and hold the click for certain seconds e.g. for 5 seconds

There's no interface for this in base R. It's always possible to write
some Windows API code to do that and call it from R using .Call()
(SendInput() is relatively easy to use [*]), but that takes effort and
knowledge of C.

What I suggest to do instead is to write an AutoHotKey script, making
use of the Click function [**] and taking arguments from the command
line [***], and then launch that script using system2(). AutoHotKey is
free software (GPLv2), designed specifically to automate other programs
and should be much easier to use correctly than C.

-- 
Best regards,
Ivan

[*]
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput

[**]
https://www.autohotkey.com/docs/v2/lib/Click.htm

[***]
https://www.autohotkey.com/docs/v2/Scripts.htm#cmd

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to