Цитата:
Сообщение от copypaste_scripter
Python:
Код:
import
time
from
pynput
.
mouse
import
Button
,
Controller
from
pynput
.
keyboard
import
Key
,
Listener
mouse
=
Controller
(
)
# Coordinates for the mouse to click in a list of tuples (x, y)
coordinates
=
[
(
1750
,
50
)
,
(
1578
,
445
)
,
(
1578
,
660
)
,
(
1578
,
780
)
,
(
1578
,
850
)
,
(
1578
,
920
)
,
(
1578
,
990
)
,
(
1895
,
985
)
,
(
1578
,
595
)
,
(
1578
,
665
)
,
(
1578
,
780
)
,
(
1578
,
850
)
,
(
1578
,
920
)
,
(
1578
,
990
)
,
(
1830
,
50
)
,
(
1576
,
605
)
,
(
1579
,
816
)
,
(
1577
,
887
)
,
(
1577
,
954
)
,
(
1898
,
998
)
,
(
1578
,
196
)
,
(
1578
,
266
)
,
(
1576
,
337
)
,
(
1578
,
403
)
,
(
1577
,
473
)
,
(
1577
,
542
)
,
(
1576
,
609
)
,
(
1576
,
825
)
,
(
1578
,
894
)
,
(
1577
,
964
)
,
(
1896
,
998
)
,
(
1578
,
197
)
,
(
1579
,
261
)
,
(
1578
,
381
)
,
(
1579
,
449
)
,
(
1576
,
518
)
,
(
1577
,
585
)
,
(
1577
,
705
)
,
(
1577
,
775
)
,
(
1575
,
845
)
,
(
1578
,
914
)
,
(
1898
,
1004
)
,
(
1577
,
526
)
,
(
1576
,
592
)
,
(
1578
,
664
)
,
(
1580
,
784
)
,
(
1577
,
851
)
,
(
1576
,
920
)
,
(
1578
,
990
)
]
# Function to perform the mouse clicks at the given coordinates
def
click_at_positions
(
coords
)
:
for
x
,
y
in
coords
:
mouse
.
position
=
(
x
,
y
)
time
.
sleep
(
0.2
)
# optional, you can adjust this delay
mouse
.
click
(
Button
.
left
,
1
)
# Function to handle the key press event
def
on_press
(
key
)
:
try
:
if
key
==
Key
.
f4
:
# Only trigger on F4 press
click_at_positions
(
coordinates
)
# Perform all the clicks
return
False
# Stops the listener after F4 press
except
AttributeError
:
return
False
# Start the keyboard listener
with
Listener
(
on_press
=
on_press
)
as
listener
:
listener
.
join
(
)
чат ЖОПАТЕ предлагает так, но блин у меня на 89, 133 и 177 линиях не 1 клик а разное количество
|
ну тогда как вариант сделать примерно так
Python:
Код:
import
time
from
pynput
.
mouse
import
Button
,
Controller
from
pynput
.
keyboard
import
Key
,
Listener
from
myscript
import
*
list
=
[
[
1750
,
50
,
True
]
,
# True - сделать клик не 1 а 3 раза
.
.
.
]
mouse
=
Controller
(
)
def
on_press
(
F4
)
:
try
:
for
pizda
in
list
:
mouse
.
position
=
(
pizda
[
0
]
,
pizda
[
1
]
)
time
.
sleep
(
0.2
)
mouse
.
click
(
Button
.
left
,
1
)
time
.
sleep
(
0.2
)
if
pizda
[
2
]
:
# тут типо еще клик или че там тебе надо
return
False
except
AttributeError
:
return
False
with
Listener
(
on_press
=
on_press
)
as
listener
:
listener
.
join
(
)
|