克罗地亚狂想曲

还是明日之后那个游戏,88键的钢琴键子太小太难点了,还想弹怎么办,突发奇想能不能搞一个鼠标位置控制点击的代码玩玩。

还是Python代码,发现pyautogui是专门做鼠标键盘控制的,那这不就简单了,无限pyautogui.click控制不就完事了。

pyautogui.click(X, Y, clicks=1, interval=0.0, button='left')

其中X,Y是以屏幕左上角为原点,可以自己下一个截图软件,截图的时候会告诉你坐标位置,我用的是Snipaste,然后明日之后下的pc版(14G,浪费内存)
由于不会看谱子,找的简谱一个一个对照的,可能简谱也没看好,间隔时间我感觉有问题,不过勉强能听了

具体代码如下:

import pyautogui
import time

# 8
# 24
#  ... ..   .       .   .. ...
# C 45 172 302 433 564 694 820
# D 64 191 322 454 582 711 840
# E 81 209 341 470 599 727 859
# F 98 229 359 488 617 747 876
# G 118 246 376 505 637 768 896
# A 135 266 395 525 653 787 913
# B 155 285 415 544 674 804 931
# 950
# pyautogui.click(, 520, clicks=1, interval=0.5, button='left')
def first():
    a()
    a()
    b()
    b()
    c()
    d()
    c()
    e()
    e()
    f()
    g()
    e()
    e()
    f()
    g()
    e()
    h()
    i()
    ii()
    ii()
    j()
    h()
    i()
    ii()
    ii()
    k()
    kk()
    k()
    kk()
    k()
    kkk()
    l()
    k()
    k()
    kk()
    k()
    kk()
    k()
    kkk()
    l()
    m()
    n()
    m()
def a():# ..3/.7..1.6
    pyautogui.click(727, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(674, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(694, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(653, 520, clicks=1, interval=0.1, button='left')


def b():# .6/.3.4.2
    pyautogui.click(653, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(617, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(582, 520, clicks=1, interval=0.1, button='left')


def c():
    # .7/.4.5.3
    pyautogui.click(674, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(617, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(637, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    # .7/.3
    pyautogui.click(674, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.2, button='left')
    # .3/7.16
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    # .3/7.16
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')

def d():
    # ..3/.7..1.6
    pyautogui.click(727, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(674, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(694, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(653, 520, clicks=1, interval=0.2, button='left')
    # ..3/.7..1..3.6
    pyautogui.click(727, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(674, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(694, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(727, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(653, 520, clicks=1, interval=0.1, button='left')
    # .6/.3.4.2
    pyautogui.click(653, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(617, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(582, 520, clicks=1, interval=0.1, button='left')
    # .6/.3.4.6.2
    pyautogui.click(653, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(617, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(653, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(582, 520, clicks=1, interval=0.1, button='left')

def e():
    # .3/7.16 .3/6
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.3, button='left')

    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')


def f():
    # .3/7.16
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.2, button='left')
    # .3/6
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.2, button='left')


def g():
    # 5.3/6
    pyautogui.click(505, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    # .3/7.16
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.2, button='left')


def h():# 6/432
    pyautogui.click(525, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(488, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(454, 520, clicks=1, interval=0.3, button='left')

def i():
    # 7/453
    pyautogui.click(544, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(488, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(505, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.2, button='left')
    # 7/3
    pyautogui.click(544, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.2, button='left')


def ii():
    # 3/7.16.
    pyautogui.click(470, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(415, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(433, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(395, 520, clicks=1, interval=0.2, button='left')


def j():
    # .3/7.16
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.4, button='left')
    # .3/6
    pyautogui.click(599, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.2, button='left')


def k():
    # 3/7.16.
    pyautogui.click(470, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(415, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(433, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(395, 520, clicks=1, interval=0.4, button='left')


def kk():
    # 36.
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(395, 520, clicks=1, interval=0.1, button='left')


def kkk():
    # 3/6.
    pyautogui.click(470, 520, clicks=1, interval=0.0, button='left')
    pyautogui.click(395, 520, clicks=1, interval=0.1, button='left')


def l():
    #5.6.
    pyautogui.click(376, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(395, 520, clicks=1, interval=0.4, button='left')

def m():
    # 1.367
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    # 1.361.
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    # 2.31.3
    pyautogui.click(582, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    # 7363
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')


def n():
    # 7356
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(505, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    # 7357
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(505, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    # 1.373
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    # 633.3
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')

def o():
    # 3.353
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(505, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    # 1.373
    pyautogui.click(564, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(544, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    # 633.36
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(599, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(470, 520, clicks=1, interval=0.1, button='left')
    pyautogui.click(525, 520, clicks=1, interval=0.1, button='left')
if __name__=="__main__":
    start = time.perf_counter()
    first()
    end = time.perf_counter()
    print('运行' , (end - start))

运行截图:

最后修改:2021 年 05 月 11 日
如果觉得我的文章对你有用,请随意赞赏