Exemplo n.º 1
0
    def run(self):
        while True:
            mbm = win32api.GetAsyncKeyState(win32con.VK_MBUTTON)
            if mbm != 0:
                if self.x is None and self.y is None:
                    self.get_and_save_pos_when_wheel_up()
                    win32api.Beep(1000, 100)
                else:
                    self.x = None
                    self.y = None
                    win32api.Beep(10000, 200)

            self.click_on_pos()
Exemplo n.º 2
0
	def toggle_bot(self):
		while True:
			localf2 = win32api.GetKeyState(self.switch)
			if localf2 != self.state_f2:
				self.state_f2 = localf2
				if localf2 < 0:
					self.run_bot = not self.run_bot
					if self.run_bot:
						#print(GetCursorPos())
						win32api.Beep(1600,50)
						win32api.Beep(2000,100)
					else:
						win32api.Beep(400,100)
						win32api.Beep(300,50)
Exemplo n.º 3
0
def loopClick(x, y):
    global redo, circlePix, errors, clickTimer
    stopTimer()

    # If a circle has been tried it checks accuracy and stores data
    if circlePix:
        redo = not insideCircle((x, y), circlePix)
        circleStack[len(circleStack) - 1][2] = clickTimer
        circleStack[len(circleStack) - 1][3] = calcDistance()

    # Sets up for next
    resetCursor()
    testsLeft = len(circleTestBlocks)
    if not redo: progressUpdate(testsLeft)

    # Get a circle to test using pixel values to draws it
    circlePix = getCircle(redo)
    createCircle(drawTurtle, circlePix, redo)

    # Makes a beep if circle was missed
    if redo:
        win32api.Beep(750, 300)
        errors += 1
    else:
        circleStack[len(circleStack) - 1][1] = errors
        errors = 0

    # Controls a recursive function once it finishes all test cases
    if testsLeft > 0 or redo:
        distPoint()
        startTimer()
        windowScreen.onclick(loopClick)
    else:
        simClick()
        windowScreen.onclick(endScreen)
Exemplo n.º 4
0
def getPositionBotaoComprar():
    print('\tClick com botão direito no botão comprar.')
    x, y = getPosicaoDoClick()
    print('\n\tPosição do botão comprar: ({}, {})'.format(x, y))
    win32api.Beep(800, 150)
    win32api.MessageBeep()
    return x, y
Exemplo n.º 5
0
def download_one_rest(cursor_pos):
    if cursor_pos is None:
        while win32api.GetKeyState(VK_CODE["enter"]) >= 0:
            time.sleep(0.1)

    win32api.Beep(3000, 100)
    win32api.Beep(3000, 100)
    win32api.Beep(3000, 100)

    pos_left_top = PRODUCED_PARAMETERS["button_positions"]["pos_left_top"][0]
    if cursor_pos is None:
        episode = list(win32api.GetCursorPos())
    else:
        episode = cursor_pos
        if episode[1] - CUSTOM_PARAMETERS["large_episode_size"][
                1] > pos_left_top[1]:
            episode[1] -= CUSTOM_PARAMETERS["large_episode_size"][1]

    while episode[1] > pos_left_top[1]:
        while episode[0] > pos_left_top[0]:
            episode_copy = episode
            if click_and_wait((episode, episode_copy)) == -1:
                continue
            print("episode clicked")

            if click_and_wait(download_button) == -1:
                click_and_wait(back_button)
                continue
            print("download clicked")
            if gh.basicpe.search_given_picture_in_area(
                    select_all_button_picture, ((900, 900), (1920, 1080))):
                print("multi-epi found")
                click_and_wait(select_all_button)
                print("select all clicked")
                click_and_wait(confirm_button)
                print("confirm clicked")
            else:
                print("multi-epi not found")
            click_and_wait(start_download_button)
            print("start download clicked")
            click_and_wait(back_button)
            print("back clicked")
            episode[0] -= CUSTOM_PARAMETERS["large_episode_size"][0]
        episode[0] += CUSTOM_PARAMETERS["large_episode_size"][
            0] * CUSTOM_PARAMETERS["column_num"]
        episode[1] -= CUSTOM_PARAMETERS["large_episode_size"][1]
Exemplo n.º 6
0
def get_mouse():
    state_f2 = win32api.GetKeyState(0x71)
    while True:
        localf2 = win32api.GetKeyState(0x71)
        if localf2 != state_f2:
            state_f2 = localf2
            if localf2 < 0:
                print(GetCursorPos())
                #win32api.Beep(1600,50)
                win32api.Beep(2000, 100)
            else:
                pass
Exemplo n.º 7
0
	def beep(self, tono=5, duracion=0.5):
		
		if tono >= 1 and tono <= 10:
			if duracion >= .1 and duracion <= 10: WA.Beep(int(tono*100), int(duracion*1000))
			else: raise self.ErrorBeep('\n\n\t Duración Seleccionada: {} segundos\n\n\t Rango Valido de Duración: 0.3 a 10 segundos'.format(duracion))
		else: raise self.ErrorBeep('\n\n\t Tonalidad Seleccionada: {}\n\n\t Rango Valido de Tono: 3 a 10'.format(tono))
Exemplo n.º 8
0
    """
    Based on the search area given, store the certain area picture for later comparision.
    This function should be used separately and shall not be used in the main chatting program.

    :param name:
    :param size_of_window:
    :param scan_position:
    :param scan_size:
    :return:
    """
    result_list = scan_aera(size_of_window, scan_position, scan_size)
    outfile = name
    temp_res = np.array(result_list)
    np.save(outfile, np.array(result_list))


if __name__ == "__main__":
    win32api.Beep(3000, 500)

    # start = time.time()
    # target_pic = Image.open("pic_search_test.png")
    # print(search_given_picture_in_area_and_give_pos(target_pic, ((0, 0), (1920, 1080)), full_screen=False))
    # print("used time:", time.time() - start)

    # image1 = Image.open("mouse_hover.png")
    # image2 = Image.open("mouse_hover_fixed.png")
    # print(comparing_two_pictures(image1, image2))

    im = screenshot_certain_place(((100, 100), (200, 220)))
    im.show()
Exemplo n.º 9
0
    def __init__(self, freq, dur):
        if platform.system() != "Windows":
            raise PlatformNotSupportedError("Needed win32api module")

        import win32api as wa
        wa.Beep(freq, dur)
Exemplo n.º 10
0
# Licence:     <your licence>
# -------------------------------------------------------------------------------
import os
import win32api
import platform
import matplotlib.pyplot as plt

#GET SYSTEM SPECIFIC INFORMATION
machine_name = os.environ['COMPUTERNAME']
os = platform.platform()
drives = win32api.GetLogicalDriveStrings()
drives = drives.split('\000')[:-1]
print os
print machine_name

win32api.Beep(500, 50)


def size_calculations(value):
    # 2**10 = 1024
    power = 2**10
    n = 0
    Dic_powerN = {0: '', 1: 'kilo', 2: 'mega', 3: 'giga', 4: 'tera'}
    while value > power:
        value /= power
        n += 1
    return value


#Function to calculate size on disk
def bytes_2_human_readable(number_of_bytes):
Exemplo n.º 11
0
#-*-coding:utf8-*-
import time
import win32api

win32api.Beep(8000, 3000)

win32api.ShellExecute(0, 'open',
                      r'F:\music\The Script\Science & Faith\09 Walk Away.wav',
                      '', '', 1)

while True:
    f = open('conf.txt', 'r')
    content = f.read().split('#')
    if content[0] != '0':
        win32api.MessageBox(0, content[1], content[2])
    time.sleep(5)
Exemplo n.º 12
0
        if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
            _, found_pid = win32process.GetWindowThreadProcessId(hwnd)
            if found_pid == pid:
                hwnds.append(hwnd)
            return True
    hwnds = []
    win32gui.EnumWindows(callback, hwnds)
    return hwnds


# window = subprocess.Popen(
#    "disco.bat", creationflags=subprocess.CREATE_NEW_CONSOLE)

username = win32api.GetUserName()
s = win32com.client.Dispatch('SAPI.SpVoice')
voices = [i for i in s.GetVoices()]
s.Voice = voices[1]
s.Rate = 3
win32api.Beep(1050, 1000)
s.Speak(f"Congratulations, {username}. Enjoy.")

for hwnd in get_hwnds_for_pid(window.pid):
    print(hwnd, "=>", win32gui.GetWindowText(hwnd))
    for i in range(1, 100):
        win32gui.MoveWindow(hwnd, random.randint(1, 1000),
                            random.randint(1, 500), 700, 400, 1)
        time.sleep(0.1)


win32gui.SendMessage(hwnd, win32con.WM_CLOSE, 0, 0)

def scroll_one(direction):
    """Scroll up or down one unit

    :param direction: up or down
    :type: str, either "up" or "down"
    :return: None
    """
    if direction == "up":
        win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, 1)
    elif direction == "down":
        win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, -1)
    else:
        print("Direction not defined.")


def scroll_custom(direction, length):
    if direction == "up":
        win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, length)
    elif direction == "down":
        win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, -length)
    else:
        print("Direction not defined.")


if __name__ == "__main__":
    win32api.Beep(3000, 100)
    win32api.Beep(3000, 100)
    win32api.Beep(3000, 100)
Exemplo n.º 14
0
def beep_func():
    print("beep")
    win32api.Beep(int(freqency), (int(beep_time) * 1000))
Exemplo n.º 15
0
import win32api

FREQUENCY = [
    392, 392, 440, 392, 523, 494, 392, 392, 440, 392, 587, 523, 392, 392, 784,
    659, 523, 494, 440, 689, 689, 523, 587, 523
]
DELAY = [
    375, 125, 500, 500, 500, 1000, 375, 125, 500, 500, 500, 1000, 375, 125,
    500, 500, 500, 500, 1000, 375, 125, 500, 500, 500, 1000
]
for i in range(0, 24):
    win32api.Beep(FREQUENCY[i], DELAY[i])

#win32api.MessageBox(hwnd, message , title , style , language )
#hwnd:父窗口的句柄,一般为0
#message:消息
#title:标题
#style和language均有默认值,可以不填

#win32api.ShellExecute(hwnd, op , file , params , dir , bShow )
#打开某个文件,file填打开文件的目录
#win32api.ShellExecute(0,'open',r'C:\Users\tqb\Desktop\MCC\NothingInTheWorld.mp3','','',1)
Exemplo n.º 16
0
def beep(data):
    win32api.Beep(631, data)