示例#1
0
def GetConsoleHwnd():
    """Returns the window handle of the console window in which this script is
    running, or 0 if not running in a console window.  This function is taken
    directly from Pythonwin\dllmain.cpp in the win32all source, ported to
    Python."""

    # fetch current window title
    try:
        oldWindowTitle = win32api.GetConsoleTitle()
    except:
        return 0

    # format a "unique" NewWindowTitle
    newWindowTitle = "%d/%d" % (win32api.GetTickCount(),
                                win32api.GetCurrentProcessId())

    # change current window title
    win32api.SetConsoleTitle(newWindowTitle)

    # ensure window title has been updated
    import time
    time.sleep(0.040)

    # look for NewWindowTitle
    hwndFound = win32gui.FindWindow(0, newWindowTitle)

    # restore original window title
    win32api.SetConsoleTitle(oldWindowTitle)

    return hwndFound
示例#2
0
def keyboardHandler():
    """
  Igor specific keyboard handling.
  """
    _click = 0
    _esc = False
    mouse_as_stop_action = True
    win32api.SetConsoleTitle("paused")
    while (not _esc):
        if (_click > 0):
            igor(_click, mouse_as_stop_action)
            win32api.SetConsoleTitle("paused")
            print("\033[91m" + "= Cursor movement, stoped clicking." +
                  "\033[0m")

        _click = 0
        _esc = False
        while (not _esc and not _click):
            if (IsKeyDown(VK_F9)):
                _click = 1
                print("\033[92m" + "= F9 pressed, now left clicking!" +
                      "\033[0m")

            elif (IsKeyDown(VK_F10)):
                _click = 2
                print("\033[92m" + "= F10 pressed, now right clicking!" +
                      "\033[0m")

            elif (IsKeyDown(VK_F8)):
                global kDelay
                kDelay += kDelayStep
                print("\033[92m" + "= F8 pressed, increasing delay to " +
                      str(kDelay) + "\033[0m")
                time.sleep(0.2)

            elif (IsKeyDown(VK_F7)):
                global delay
                kDelay -= kDelayStep
                print("\033[92m" + "= F7 pressed, decreasing delay to " +
                      str(kDelay) + "\033[0m")
                time.sleep(0.2)

            elif (IsKeyDown(VK_F4)):
                mouse_as_stop_action = not mouse_as_stop_action
                state = ""
                if (mouse_as_stop_action):
                    state = "[mouse move]"
                else:
                    state = "[press F4]"
                print("\033[92m" + "= F4 pressed, stop action is now " +
                      state + "\033[0m")
                time.sleep(0.2)

            elif (IsKeyDown(VK_ESCAPE)):
                _esc = True
                print("= ESC pressed, exiting")

            else:
                time.sleep(0.01)
示例#3
0
def 获得自我句柄(): 
    原标题 = win32api.GetConsoleTitle()
    新标题 = f'snow({random.random()})'
    win32api.SetConsoleTitle(新标题)
    time.sleep(0.05)
    句柄 = win32gui.FindWindow(None, 新标题)
    win32api.SetConsoleTitle(原标题)
    return 句柄
示例#4
0
def igor(_click, stop_on_mouse_move):
    """
  Igor provides what others can't.
  @param _click 0 -> left click
                1 -> right click
  @param stop_on_mouse_move [bool]
  """
    a, b = win32api.GetCursorPos()
    ref = a
    timer = time.monotonic()
    count = 0
    run = True
    while (run):
        if (stop_on_mouse_move and ref != a):
            run = False
        elif (IsKeyDown(VK_F4)):
            run = False
            time.sleep(1)  # to not instantly change the stop action

        a, b = win32api.GetCursorPos()
        count += click(a, b, _click)
        if (time.monotonic() - timer > 0.0999999):
            timer = time.monotonic()
            win32api.SetConsoleTitle("click/s: " + str(count * 10))
            count = 0

        time.sleep(kDelay)
示例#5
0
def set_prgname(name):
    try:
        import win32api  #@UnresolvedImport
        win32api.SetConsoleTitle("Xpra")
        import glib
        glib.set_prgname(name)
    except:
        pass
示例#6
0
def set_prgname(name):
    global prg_name
    prg_name = name
    try:
        win32api.SetConsoleTitle(name)
        import glib
        glib.set_prgname(name)
    except:
        pass
示例#7
0
 def _promptPass(self, passid):
     self._initPass(passid)
     try:
         win32api.SetConsoleTitle("mount.py - password required: " + passid)
     except:
         warnings.warn("Cannot change window title - Running in IDLE?")
     self.passwords[passid]["val"] = getpass.getpass(passid + ": ")
     print "Ok!"
     self.passwords[passid][
         "attempts"] = self.passwords[passid]["attempts"] + 1
示例#8
0
def _fix_up_win_console_freeze():
    import win32api
    import ctypes
    try:
        win32api.SetConsoleTitle("Pyarmor Webui")
        # Disable quick edit in CMD, as it can freeze the application
        handle = win32api.GetStdHandle(-10)
        if handle != -1 and handle is not None:
            ctypes.windll.kernel32.SetConsoleMode(handle, 128)
    except Exception:
        pass
示例#9
0
def RunAsCollector():
    import sys
    try:
        import win32api
        win32api.SetConsoleTitle("Python Trace Collector")
    except:
        pass  # Oh well!
    win32trace.InitRead()
    print "Collecting Python Trace Output..."
    #	import win32api;win32api.DebugBreak()
    while 1:
        #		print win32trace.blockingread()
        sys.stdout.write(win32trace.blockingread())
示例#10
0
 def _prompt(self,passId):
     #try to set window title
     try:
         import win32api
         try:
             win32api.SetConsoleTitle("mount.py - password required: "+ passid)
         except:
             warnings.warn("Cannot change window title - Running in IDLE?")
     except ImportError:
         pass
     self._initPass(passId)
     self._passwords[passId]["val"] = getpass.getpass(passId+": ")
     print "Ok!"
     self._passwords[passId]["attempts"] += 1
示例#11
0
def RunAsTraceCollector():
    import sys
    try:
        import win32api
        win32api.SetConsoleTitle("Python Trace Collector")
    except:
        pass  # Oh well!
    win32trace.InitRead()
    p("Collecting Python Trace Output...", log_level=4)
    try:
        while 1:
            # a short timeout means ctrl+c works next time we wake...
            sys.stdout.write(win32trace.blockingread(500))
    except KeyboardInterrupt:
        p("}}ybCtrl+C - quitting...}}xx", log_level=3)
示例#12
0
def RunAsCollector():
    import sys
    try:
        import win32api
        win32api.SetConsoleTitle("Python Trace Collector")
    except:
        pass  # Oh well!
    win32trace.InitRead()
    print("Collecting Python Trace Output...")
    try:
        while True:
            # a short timeout means ctrl+c works next time we wake...
            sys.stdout.write(win32trace.blockingread(500))
    except KeyboardInterrupt:
        print("Ctrl+C")
示例#13
0
def start():
    recoil_status = False
    if not misc.check_path():  ###    Super mega Battle-Eye & EAC bypass   ###
        exit(0)
    win32api.SetConsoleTitle(misc.generate_random()
                             )  ###                                         ###
    general()

    while True:  # main loop
        if keyboard.is_pressed(key_fastfarm):
            scripts.fastfarm(key_pickaxe, key_grenade)

        if win32api.GetAsyncKeyState(key_recoil_activation) and 0x80000:
            recoil_status = not recoil_status
            winsound.Beep(600, 700)

        if recoil_status:
            if recoil_method == 1:
                if keyboard.is_pressed(key_recoil):
                    scripts.recoil_control(recoil_method=1)
            elif recoil_method == 2:
                while mouse.is_pressed(button="left"):
                    scripts.recoil_control(recoil_method=2)
                    time.sleep(0.1)
示例#14
0
#!/usr/bin/env python

# simple wrapper script so we can launch a script file with the same python interpreter
# and environment which is used by the xpra.exe / xpra_cmd.exe process.
#
# normally, the py2exe win32 platform code redirects the output to a log file
# this script disables that.

import os.path
import sys
from xpra.platform.win32 import set_redirect_output
set_redirect_output(False)

try:
    import win32api  #@UnresolvedImport
    win32api.SetConsoleTitle("Python")
except:
    pass

if len(sys.argv) < 2:
    print("you must specify a python script file to run!")
    sys.exit(1)
filename = sys.argv[1]
if not os.path.exists(filename):
    print("script file '%s' not found" % filename)
    sys.exit(1)

cwd = os.getcwd()
if cwd not in sys.path:
    sys.path.append(cwd)
execfile(filename)
示例#15
0

def start_one_instance_httpserver():
    lockFile = os.path.join(os.path.expanduser('~'), "WebLocker",
                            "myhttpserver.lock")
    fd = open(lockFile, "w")
    lock(fd, LOCK_EX | LOCK_NB)

    http_server = myhttpserver.MyHTTPServer(('127.0.0.1', 8080),
                                            myhttpserver.MyHTTPHandle)
    http_server.start()


if __name__ == '__main__':
    try:
        multiprocessing.freeze_support()
        win32api.SetConsoleTitle("WebLockerServer")
        start_browser()
        threads = []
        threads.append(threading.Thread(target=hide_console, args=()))
        threads.append(
            threading.Thread(target=start_one_instance_httpserver, args=()))
        for i in threads:
            i.start()
        for i in threads:
            i.join()

    except Exception, e:
        print traceback.print_exc()
        print e
示例#16
0
		все остальные данные шифр с ключом=хэш пароля

чаты=стандартный
	название публичного чата ключ=стандартный
		сообщения ключ=стандартный
	название приватного чата ключ=стандартный
		сообщения ключ=специальный
		приглашение косят под сообщение ключ=специальный
		в названии приглашения=ключ+имя_нового_участника
'''
from threading import Thread
import win32api, random, string

from auth import *

win32api.SetConsoleTitle(dictionary['### Concole Chat ###'][language])


def id_generator(size=6,
                 chars=string.ascii_uppercase + string.digits +
                 string.ascii_lowercase):
    #mess name
    return ''.join(random.choice(chars) for _ in range(size))


class Sending(Thread):
    def __init__(self):
        Thread.__init__(self)

    def run(self):
        global to_send, chat_name, windowStop, left_chat
示例#17
0
def menu():
    global chat_name, myName, KEY, foreMain, foreMain_, foreSub, foreSub_, space, space_, styleDef, styleDef_, chat_type, language, language_

    mode = 'main'
    while True:
        clear()
        if mode == 'main':
            print(space + styleDef + foreMain +
                  dictionary['### Menu ###'][language])
            print(space + styleDef + foreMain +
                  dictionary['1) Join chat'][language])
            print(space + styleDef + foreMain +
                  dictionary['2) Create public chat'][language])
            print(space + styleDef + foreMain +
                  dictionary['3) Create private chat'][language])
            print(space + styleDef + foreMain +
                  dictionary['4) Settings'][language])
            print(space + styleDef + foreMain +
                  dictionary['0) Log out\n'][language])
            print(space + styleDef + foreMain +
                  dictionary['Your choice: '][language] + foreSub,
                  end='')
            choice = input()
            if choice == '1':
                mode = 'chat'
            elif choice == '2':
                mode = 'new'
            elif choice == '3':
                mode = 'newp'
            elif choice == '4':
                mode = 'settings'
            elif choice == '0':
                return 'exit'
            else:
                print(space + styleDef + foreMain +
                      dictionary['No such option!'][language])
                sleep(1)
        elif mode == 'chat':
            KEY = defKey
            print(space + styleDef + foreMain +
                  dictionary['Chat: '][language] + foreSub,
                  end='')
            chat = input()
            chats = firebase.get('/' + encode_str('chats'), None)
            if chats == None:
                print(space + styleDef + foreMain +
                      dictionary['No such chat!'][language])
                sleep(1)
                return 'menu'
            no_chat = True
            for i in chats.keys():
                if chat == decode_str(i):
                    status = decode_str(
                        chats[i][encode_str('info')][encode_str('access')])
                    if status == 'public':
                        KEY = defKey
                        print(space + styleDef + foreMain +
                              dictionary['Connecting ...'][language])
                        chat_name = chat
                        chat_type = 'public'
                        return 'chat'
                    else:
                        passwd = get_passwd(
                            [[dictionary['Chat: '][language], chat]],
                            dictionary['Password: '******'utf-8')
                        try:
                            #this line is here for trying password
                            mes = decode_str(chats[i][encode_str(
                                'info', default=True)][encode_str('name')])

                            chats = firebase.get('/' + encode_str('chats'),
                                                 None)
                            for i in chats.keys():
                                if chat == decode_str(i):
                                    break
                            users = chats[i][encode_str('users', default=True)]
                            find = False
                            for j in users.keys():
                                if decode_str(j, default=True) == myName:
                                    find = True
                                    break
                            if find == False:
                                print(space + styleDef + foreMain + dictionary[
                                    'You do not have an invitation!'][language]
                                      )
                                sleep(2)
                                return 'menu'

                            print(space + styleDef + foreMain +
                                  dictionary['Connecting ...'][language])
                            chat_name = chat
                            chat_type = 'private'
                            return 'chat'
                        except Exception as e:
                            err('8' + str(e))
                            no_chat = False
                            print(space + styleDef + foreMain +
                                  dictionary['Wrong password!'][language])
                            sleep(1)
                            KEY = defKey
                            break
            if no_chat == True:
                print(space + styleDef + foreMain +
                      dictionary['No such chat!'][language])
                sleep(1)
                return 'menu'
        elif mode == 'new':
            print(space + styleDef + foreMain +
                  dictionary['Name of chat: '][language] + foreSub,
                  end='')
            title = input()
            chats = firebase.get('/' + encode_str('chats'), None)
            if title == '':
                print(space + styleDef + foreMain +
                      dictionary['Type something!'][language])
                sleep(1)
                again = True
            else:
                print(space + styleDef + foreMain +
                      dictionary['Loading ...'][language])
                again = False
                if chats != None:
                    for i in chats.keys():
                        if decode_str(i) == title:
                            again = True
                            print(space + styleDef + foreMain +
                                  dictionary['This name is taken'][language])
                            sleep(1)
                            break
            if again == False:
                KEY = defKey
                chat_name = title
                text = myName + ' created this chat!'
                data = {
                    encode_str('name'): encode_str(SYSTEM_NAME),
                    encode_str('text'): encode_str(text),
                    encode_str('time'): get_date(),
                    encode_str('access'): encode_str('public')
                }
                result = firebase.patch(
                    '/' + encode_str('chats') + '/' + encode_str(chat_name) +
                    '/' + encode_str('info'), data)
                print(space + styleDef + foreMain +
                      dictionary['Connecting ...'][language])
                chat_type = 'public'
                return 'chat'
        elif mode == 'newp':
            print(space + styleDef + foreMain +
                  dictionary['Name of chat: '][language] + foreSub,
                  end='')
            title = input()
            chats = firebase.get('/' + encode_str('chats'), None)
            if title == '':
                print(space + styleDef + foreMain +
                      dictionary['Type something!'][language])
                sleep(1)
                again = True
            else:
                print(space + styleDef + foreMain +
                      dictionary['Loading ...'][language])
                again = False
                if chats != None:
                    for i in chats.keys():
                        if decode_str(i) == title:
                            again = True
                            print(space + styleDef + foreMain +
                                  dictionary['This name is taken'][language])
                            sleep(1)
                            break
            if again == False:
                KEY = id_generator(size=8)
                print(
                    space + styleDef + foreMain +
                    dictionary['Password for this chat:'][language], KEY)
                KEY = KEY.encode('utf-8')
                print(space + styleDef + foreMain + dictionary[
                    'Press tab in the chat to make an invitation for your friend']
                      [language])
                print(space + styleDef + foreMain + dictionary[
                    'This way your friend can join this chat by password']
                      [language])
                print(space + styleDef + foreMain +
                      dictionary['Press enter to continue...'][language],
                      end='')
                input()
                chat_name = title
                text = myName + ' created this private chat!'
                data = {
                    encode_str('name'):
                    encode_str(SYSTEM_NAME),
                    encode_str('text'):
                    encode_str(text),
                    encode_str('time'):
                    get_date(),
                    encode_str('access', default=True):
                    encode_str('private', default=True)
                }
                result = firebase.patch(
                    '/' + encode_str('chats', default=True) + '/' +
                    encode_str(chat_name, default=True) + '/' +
                    encode_str('info', default=True), data)
                data = {
                    encode_str(myName, default=True): [
                        encode_str(myName, default=True),
                        encode_str('True', default=True)
                    ]
                }
                result = firebase.patch(
                    '/' + encode_str('chats', default=True) + '/' +
                    encode_str(chat_name, default=True) + '/' +
                    encode_str('users', default=True), data)
                print(space + styleDef + foreMain +
                      dictionary['Connecting ...'][language])
                chat_type = 'private'
                return 'chat'
        elif mode == 'settings':
            print(space + styleDef + foreMain +
                  dictionary['### Settings ###'][language])
            print(space + styleDef + foreMain +
                  dictionary['1) Main Color: '][language] + foreSub +
                  dictionary[foreMain_][language])
            print(space + styleDef + foreMain +
                  dictionary['2) Side Color: '][language] + foreSub +
                  dictionary[foreSub_][language])
            print(space + styleDef + foreMain +
                  dictionary['3) Brightness: '][language] + foreSub +
                  dictionary[styleDef_][language])
            print(space + styleDef + foreMain +
                  dictionary['4) Left margin: '][language] + foreSub + space_ +
                  dictionary[' space(s)'][language])
            print(space + styleDef + foreMain +
                  dictionary['5) Language: '][language] + foreSub +
                  dictionary[language_][language])
            print(space + styleDef + foreMain +
                  dictionary['0) Back'][language])
            print('\n' + space + styleDef + foreMain +
                  dictionary['Your choice: '][language],
                  end='')
            choice = input()
            if choice == '1':
                for i in range(len(COLORS)):
                    print(space + styleDef + foreMain + str(i + 1) + ') ' +
                          COLORS[i][0] + dictionary[COLORS[i][1]][language])
                print()
                print(space + styleDef + foreMain +
                      dictionary['Your choice: '][language],
                      end='')
                col = input()
                try:
                    col = int(col)
                    if col in range(1, len(COLORS) + 1):
                        foreMain = COLORS[col - 1][0]
                        foreMain_ = COLORS[col - 1][1]
                    else:
                        print(space + styleDef + foreMain +
                              dictionary['No such option!'][language])
                        sleep(1)
                except:
                    print(space + styleDef + foreMain +
                          dictionary['Input a number!'][language])
                    sleep(1)

            elif choice == '2':
                for i in range(len(COLORS)):
                    print(space + styleDef + foreMain + str(i + 1) + ') ' +
                          COLORS[i][0] + dictionary[COLORS[i][1]][language])
                print()
                print(space + styleDef + foreMain +
                      dictionary['Your choice: '][language],
                      end='')
                col = input()
                try:
                    col = int(col)
                    if col in range(1, len(COLORS) + 1):
                        foreSub = COLORS[col - 1][0]
                        foreSub_ = COLORS[col - 1][1]
                    else:
                        print(space + styleDef + foreMain +
                              dictionary['No such option!'][language])
                        sleep(1)
                except:
                    print(space + styleDef + foreMain +
                          dictionary['Input a number!'][language])
                    sleep(1)
            elif choice == '3':
                for i in range(len(BRIGHTNESS)):
                    print(space + styleDef + foreMain + str(i + 1) + ') ' +
                          BRIGHTNESS[i][0] +
                          dictionary[BRIGHTNESS[i][1]][language])
                print()
                print(space + styleDef + foreMain +
                      dictionary['Your choice: '][language],
                      end='')
                col = input()
                try:
                    col = int(col)
                    if col in range(1, len(BRIGHTNESS) + 1):
                        styleDef = BRIGHTNESS[col - 1][0]
                        styleDef_ = BRIGHTNESS[col - 1][1]
                    else:
                        print(space + styleDef + foreMain +
                              dictionary['No such option!'][language])
                        sleep(1)
                except:
                    print(space + styleDef + foreMain +
                          dictionary['Input a number!'][language])
                    sleep(1)
            elif choice == '4':
                print(space + styleDef + foreMain +
                      dictionary['Input a number of spaces: '][language],
                      end='')
                col = input()
                try:
                    col = int(col)
                    if col < 0:
                        print(space + styleDef + foreMain +
                              dictionary['Input a number!'][language])
                        sleep(1)
                    else:
                        space_ = str(col)
                        space = ' ' * col
                except:
                    print(space + styleDef + foreMain +
                          dictionary['Input a number!'][language])
                    sleep(1)
            elif choice == '5':
                for i in range(len(LANGUAGE)):
                    print(space + styleDef + foreMain + str(i + 1) + ') ' +
                          dictionary[LANGUAGE[i]][language])
                print()
                print(space + styleDef + foreMain +
                      dictionary['Your choice: '][language],
                      end='')
                lang = input()
                try:
                    lang = int(lang)
                    if lang in range(1, len(LANGUAGE) + 1):
                        language_ = LANGUAGE[lang - 1]
                        language = lang - 1
                        win32api.SetConsoleTitle(
                            dictionary['### Concole Chat ###'][language])
                    else:
                        print(space + styleDef + foreMain +
                              dictionary['No such option!'][language])
                        sleep(1)
                except:
                    print(space + styleDef + foreMain +
                          dictionary['Input a number!'][language])
                    sleep(1)
            elif choice == '0':
                mode = 'main'
            else:
                print(space + styleDef + foreMain +
                      dictionary['No such option!'][language])
                sleep(1)
            data = {
                'foreMain': foreMain_,
                'foreSub': foreSub_,
                'styleDef': styleDef_,
                'space': space_,
                'language': language_,
            }

            line = '{'
            for i in data.keys():
                line += '"' + i + '"' + str(': ') + '"' + data[i] + '"' + ',\n'
            line = line[:-2]
            line += '}'
            f = open('conf.txt', 'w', encoding='utf-8')
            f.write(line)
            f.close()
示例#18
0
----------------------------------------------------------------------------

 ██████╗ ██████╗ ██╗   ██╗██████╗     ██╗   ██╗██╗███████╗██╗    ██╗███████╗
██╔════╝██╔═══██╗██║   ██║██╔══██╗    ██║   ██║██║██╔════╝██║    ██║██╔════╝
██║     ██║   ██║██║   ██║██████╔╝    ██║   ██║██║█████╗  ██║ █╗ ██║███████╗
██║     ██║   ██║██║   ██║██╔══██╗    ╚██╗ ██╔╝██║██╔══╝  ██║███╗██║╚════██║
╚██████╗╚██████╔╝╚██████╔╝██████╔╝     ╚████╔╝ ██║███████╗╚███╔███╔╝███████║
 ╚═════╝ ╚═════╝  ╚═════╝ ╚═════╝       ╚═══╝  ╚═╝╚══════╝ ╚══╝╚══╝ ╚══════╝

---------------------------------[by GIFUS]---------------------------------
      The author is not responsible for the blocking of your account!
                  You use the software at your own risk!
"""

print(intro)
win32api.SetConsoleTitle('COUB VIEWS')

proxy_loading = input(
    "[1] Load Proxys from APIs\n[2] Load Proxys from proxys.txt\nOption: ")
uid = input("Coub id: ")


class main(object):
    def __init__(self):
        self.combolist = Queue()
        self.Writeing = Queue()
        self.printing = []
        self.botted = 0
        self.combolen = self.combolist.qsize()

    def printservice(self):  #print screen
示例#19
0
#!/usr/bin/env python

# normally, the win32 platform code redirects the output to a log file
# this script disables that and is compiled as "Xpra_cmd.exe"
# instead of "Xpra.exe"

import sys
from xpra.platform.win32 import set_redirect_output
set_redirect_output(False)

try:
    import win32api  #@UnresolvedImport
    win32api.SetConsoleTitle("Xpra")
except:
    pass
from xpra.scripts.main import main
code = main("Xpra.exe", sys.argv)
sys.exit(code)
示例#20
0
$Header: /nfs/slac/g/glast/ground/cvs/pointlike/python/uw/utilities/minuit.py,v 1.17 2011/06/07 17:22:34 lande Exp $

"""
import sys, os
# normal CMT setup does not put ROOT.py in the python path
if sys.platform == 'win32':
    import win32api
    console_title = win32api.GetConsoleTitle()
try:
    import ROOT
except:
    sys.path.append(os.path.join(os.environ['ROOTSYS'], 'bin'))
    import ROOT

if sys.platform == 'win32':
    win32api.SetConsoleTitle(console_title)  #restore title bar!
    import pyreadline  # fix for tab completion
    pyreadline.parse_and_bind('set show-all-if-ambiguous on')

from ROOT import TMinuit, Long, Double

import numpy as np
from numpy.linalg import inv


def rosenbrock(x):
    """Rosenbrock function, to use for testing."""
    return (1 - x[0])**2 + 100 * (x[1] - x[0]**2)**2


def rosengrad(x):
import pyautogui
import time
import win32api
import random
import keyboard
import yaml
from threading import Timer

win32api.SetConsoleTitle('Soldier 76 | Recoil-Control')


def config():
    with open("settings.yml", 'r', encoding="utf8") as stream:
        try:
            f = yaml.safe_load(stream)
        except yaml.YAMLError as err:
            print(err)
    global horizontal_range
    global min_vertical
    global max_vertical
    global min_firerate
    global max_firerate
    global toggle_button
    horizontal_range = f['horizontal_range']
    min_vertical = f['min_vertical']
    max_vertical = f['max_vertical']
    min_firerate = f['min_firerate']
    max_firerate = f['max_firerate']
    toggle_button = f['toggle_button']
    Timer(1, config).start()