Python-auto-run for refbox-master user

# -*- coding:utf-8 -*-
import time,os
import keyboard
import mouse 
from  pynput.mouse import Button, Controller
import time,subprocess

mouse = Controller()
sleep=time.sleep(5)
#def mouse single-click action
def mouse_click(point):
    mouse.position=point
    mouse.press(Button.left)
    mouse.release(Button.left)

RefBoxPoint={

    'MasterUser_Mark_button':(1710,1043),
    'MasterUser_LiveMark_button':(1644,1057),
    'MasterUser_Live_button':(1279,1039),
    'MasterUser_Live-3_button':(1345,1031),
    'MasterUser_Pause_button':(1231,1030),
    'MasterUser_Play_button':(1173,1035),
    'MasterUser_Speed1_button':(1045,1041),
    'MasterUser_speed_button':(1102,1034),
    'MasterUser_-6_button':(987,1032),
    'MasterUser_plus1Frame_button':(934,1034),
    'MasterUser_-1_button':(873,1035),
    'MasterUser_Import_button':(380,1033),
    'MasterUser_Export_button':(325,1033),
    'MasterUser_CuesPanel':(1829,1043),
    'MasterUser_ClipsPanel':(1890,1031),
    'MasterUser_Settings_button':(1737,15),
    'MasterUser_First_Cue_Click':(1844,65),
    'MasterUser_PrevCue_Button_Click':(1531,1056),
    'MasterUser_NextCue_button_click':(1571,1049),
    'MasterUser_10xSpeed_drag':(811,1050),
    'MasterUser_-10xspeed_drag':(623,1053),
    'MasterUser_Select_Button':(1768,1044),
    'masteruser_SelectButton_DeleteAll':(1705,1053),
    'masteruser_SelectButton_DeleteAll_Delete':(1646,1056),
    'masteruser_SelectButton_DeleteAll_cancle':(1709,1050),
    'masteruser_SelectButton_Delete':(1650,1055),
    'MasterUser_In':(1587,1049),
    'MasterUser_Out':(1649,1057),
    'MasterUser_Save':(1706,1052),

    }


def startup_Refbox(Ip):
    #打开文件
    os.startfile(r'C:\Program Files\SIMPLYLIVE.TV\RefBox\RefBox.exe')
    time.slee(1)
    #change the Metadata ip address
    Ip=Ip
    #click the defined point
    mouse_click(889,282)
    #delete the content use the backspace key
    time.sleep(2)
    for i in range(1,15):
        k.press_key(k.backspace_key)
        time.sleep(0.01)
        k.release_key(k.backspace_key)
    #input something in current location
    k.type_string(str(Ip))
    #click the apply button
    mouse_click(1498,275)
    time.sleep(2)

    #change the backend ip address
    mouse_click(964,432)
    #delete the content use the backspace key
    time.sleep(2)
    for i in range(1,15):
        k.press_key(k.backspace_key)
        time.sleep(0.01)
        k.release_key(k.backspace_key)
    #input something in current location
    k.type_string(str(Ip))
    #click the apply button
    mouse_click.click(1502,421)
    time.sleep(2)
    mouse_click.click(1697,951)

#Prepare-delete everything
def refbox_masteruser_Cleansys():
    #clean all the markers
    mouse_click(RefBoxPoint['MasterUser_CuesPanel'])
    time.sleep(1)
    mouse_click(RefBoxPoint['MasterUser_Select_Button'])
    time.sleep(0.5)
    mouse_click(RefBoxPoint['masteruser_SelectButton_DeleteAll'])
    time.sleep(0.5)
    mouse_click(RefBoxPoint['masteruser_SelectButton_DeleteAll_Delete'])
    time.sleep(0.5)
    #clean all the clips
    mouse_click(RefBoxPoint['MasterUser_ClipsPanel'])
    time.sleep(1)
    mouse_click(RefBoxPoint['MasterUser_Select_Button'])
    time.sleep(0.5)
    mouse_click(RefBoxPoint['masteruser_SelectButton_DeleteAll'])
    time.sleep(0.5)
    mouse_click(RefBoxPoint['masteruser_SelectButton_DeleteAll_Delete'])
    time.sleep(0.5)
    #click live button
    mouse_click(RefBoxPoint['MasterUser_Live_button'])

#create markers

def Refbox_MarkCreate(amount):
    mouse_click(RefBoxPoint['MasterUser_CuesPanel'])
    mouse_click(RefBoxPoint['MasterUser_Live_button'])
    amount=amount
    #click mark button for 'amount' times
    for i in range(0,amount):
        mouse_click(RefBoxPoint['MasterUser_Mark_button'])
        time.sleep(0.5)

#create live markers
def Refbox_LiveMarkCreate(amount):
    mouse_click(RefBoxPoint['MasterUser_CuesPanel'])
    mouse_click(RefBoxPoint['MasterUser_Live_button'])
    amount=amount
    #click mark button for 'amount' times
    for i in range(0,amount):
        mouse_click(RefBoxPoint['MasterUser_LiveMark_button'])
        time.sleep(0.5)

def Refbox_defaultClip_Save_Clip(amount):
    mouse_click(RefBoxPoint['MasterUser_ClipsPanel'])
    mouse_click(RefBoxPoint['MasterUser_Live_button'])
    amount=amount
    for i in range(0,amount):
        mouse_click(RefBoxPoint['MasterUser_Save'])
        time.sleep(0.5)

def Refbox_InOutSave_clip(amount,duration):
    mouse_click(RefBoxPoint['MasterUser_ClipsPanel'])
    mouse_click(RefBoxPoint['MasterUser_Live_button'])
    amount=amount
    duration=duration
    for i in range(0,amount):
        mouse_click(RefBoxPoint['MasterUser_In'])
        time.sleep(duration)
        mouse_click(RefBoxPoint['MasterUser_Out'])
        mouse_click(RefBoxPoint['MasterUser_Save'])
        time.sleep(0.5)

#make it work
#StartRefbox('192.168.0.8')


refbox_masteruser_Cleansys()
time.sleep(1)
Refbox_MarkCreate(1)
time.sleep(1)
Refbox_LiveMarkCreate(1)
time.sleep(1)
Refbox_InOutSave_clip(1,10)
time.sleep(1)
Refbox_defaultClip_Save_Clip(1)
time.sleep(1)


#speed control
mouse_click(RefBoxPoint['MasterUser_Speed1_button'])

#review cues
mouse_click(RefBoxPoint['MasterUser_CuesPanel'])
mouse_click(RefBoxPoint['MasterUser_First_Cue_Click'])
time.sleep(1)
for i in range(1,20):
    mouse_click(RefBoxPoint['MasterUser_NextCue_button_click'])
    time.sleep(0.3)

mouse_click(RefBoxPoint['MasterUser_CuesPanel'])


 

猜你喜欢

转载自blog.csdn.net/vanlyfanfan/article/details/82986462