Beispiel #1
0
def check_is_whatsapp():
    is_whatsapp = pyautogui.getActiveWindowTitle()

    while is_whatsapp != "WhatsApp":
        is_whatsapp = pyautogui.getActiveWindowTitle()
        if is_whatsapp == "WhatsApp":
            pass
Beispiel #2
0
def setPP():
    # pag.hotkey('alt', 'space')
    # pag.press('n')
    if pag.getActiveWindowTitle()[-10:] != "PowerPoint":
        pag.alert("Abra la instruccion a modificar, y después presione Iniciar")
        exit()
    else:
        pag.alert("Comenzará la modificación automática")
        pag.press('alt')
        pag.press('w')
        pag.press('f')
        pag.press('2')
Beispiel #3
0
 def activeWinName(self, WinTitle: str):
     ActiveWindow: str = pyautogui.getActiveWindowTitle()
     try:
         if WinTitle in ActiveWindow:
             print(WinTitle + " is active window")
             return True
         else:
             print(WinTitle + " is not active window" + "-" + ActiveWindow)
             return False
     except Exception as e:
         print("Exception occured- ")
         print(e)
Beispiel #4
0
def switch_windows():
    global GWENT_WINDOW_NAME
    if not GWENT_WINDOW_NAME:
        open_gwent()
        GWENT_WINDOW_NAME = pyautogui.getWindowsWithTitle('Gwent')[0]
    if pyautogui.getActiveWindowTitle()[0] == 'Gwent':
        return True
    try:
        GWENT_WINDOW_NAME.activate()
        GWENT_WINDOW_NAME.maximize()
        pyautogui.screenshot()
    except IndexError:
        return False
    return False
Beispiel #5
0
 def bot():
     nonlocal STATUS
     while STATUS:
         nonlocal main_process, need_title, action, dtime
         if main_process:
             try:
                 focus_title = str(pyautogui.getActiveWindowTitle()).lower()
             except:
                 pass
             if focus_title == need_title or 'r2online' in focus_title or 'r2 online' in focus_title:
                 threads = [
                     threading.Thread(target=target,
                                      name=str(args),
                                      args=args) for target, args in action
                 ]
                 [t.start() for t in threads]
                 [t.join() for t in threads]
             time.sleep(dtime)
         time.sleep(dtime)
Beispiel #6
0
 }, {
     "label": random.choice(code_button_2_text),
     "url": random.choice(code_button_2_url)
 }]
 RPC.update(
     # start=start_time,
     large_text=random.choice(code_quotes_large_text),
     small_text=random.choice(code_quotes_small_text),
     large_image=random.choice(code_quotes_large_image),
     small_image=random.choice(code_quotes_small_image),
     buttons=buttons_list,
     details="Change everything you are",
     state="And everything you were...")
 time.sleep(int(settings["GeneralSettings"]["next_layer_time"]))
 try:
     current = pyautogui.getActiveWindowTitle()
     activity_details = ""
     last = None
     #for browsers in range(len(web_browsers)):
     #    if str(web_browsers) in current:
     #        activity_details = "Web-Surfing:"
     if "Discord" in current:
         activity_details = "In Discord | Watching:"
     else:
         activity_details = "Current Activity:"
     if len(current) >= 128:
         continue
     if current != last:
         RPC.update(
             start=start_time,
             large_text=random.choice(quotes_large_image_text),
Beispiel #7
0
def fg_check(title):
    if pyautogui.getActiveWindowTitle() == title:
        return True
Beispiel #8
0
import os
import pyautogui
import time

login='******'
password='******'

#stars TWS
os.startfile('C:\Jts\\tws.exe')

while pyautogui.getActiveWindowTitle() != "Login":
    time.sleep(.5)

pyautogui.write(login)
pyautogui.press('tab')
pyautogui.write(password)
time.sleep(.5)
pyautogui.press('enter')

while pyautogui.getActiveWindowTitle() != "Second Factor Authentication":
    time.sleep(.5)

pyautogui.press('tab')

pyautogui.press('space')

while pyautogui.getActiveWindowTitle() != "U2359138 Interactive Brokers":
    #print(pyautogui.getActiveWindowTitle()) cute bit of status update code
    time.sleep(.5)

print("done")
Beispiel #9
0
def check_window_activity():
    return 'Telegram' in pyautogui.getActiveWindowTitle()
Beispiel #10
0
def main():
    tilaukset = []
    pya.PAUSE = 0.03
    file = 'pakasteet.xlsx'
    pvm = '5.1.2020'
    sheet = pd.read_excel(file)
    sheetstring = sheet.to_string()
    wordlist = sheetstring.split()
    for i in range(len(wordlist)):
        if wordlist[i].startswith("s"):
            asnro = wordlist[i]
            eurlava = wordlist[i+2]
            rullakko = wordlist[i+3]
            finlava = wordlist[i+4]
            if eurlava == "NaN":
                eurlava = "0"
            if rullakko == "NaN":
                rullakko = "0"
            if finlava == "NaN":
                finlava = "0"
            eurlava = int(eurlava)
            rullakko = int(rullakko)
            finlava = int(finlava)
            tilaus = Tilaus(asnro, rullakko, eurlava, finlava)
            if(tilaus.onkoPakkasia()):
                tilaukset.append(tilaus)
    
    x, y = VerifyStartPosition()
    pya.click(x, y)
    
    while len(tilaukset) > 0:

        if pya.getActiveWindowTitle() == "Nimetön – Muistio":
            tilaus = tilaukset[0]
            print(tilaus)
            time.sleep(1)
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.typewrite("0018")
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.press('tab')
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.typewrite("5018")
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.press('tab')
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.typewrite(tilaus.asiakasnumero)
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.press('tab')
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.press('tab')
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.press('tab')
            if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                continue
            pya.press('tab')
            if tilaus.rullakot > 0:
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('rll')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite(str(tilaus.rullakot))
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('0004')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('PAKASTE')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')

            if tilaus.eurolavat > 0:
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('eur')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite(str(tilaus.eurolavat))
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('0004')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('PAKASTE')

            if tilaus.finlavat > 0:
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('fin')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite(str(tilaus.finlavat))
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('0004')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.press('tab')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
                pya.typewrite('PAKASTE')
                if pya.getActiveWindowTitle() != "Nimetön – Muistio":
                    continue
            pya.press('enter')
            tilaukset.pop(0)
        else:
            print("Muistio ei ole aktiivinen")
Beispiel #11
0
import pyautogui
import time
import pandas as pd

df = pd.read_csv("data.csv")

s = 0

while True:
    i = df[df.task == pyautogui.getActiveWindowTitle()].index.values

    if len(i) == 0:
        d = {'task': pyautogui.getActiveWindowTitle(), 'time(seconds)': 1}
        df = df.append(d, ignore_index=True)
        time.sleep(1)
    else:
        df.iat[i[0], 1] += 1
        time.sleep(1)

    df.to_csv("data.csv", index=False)
#! python3

# pInstantMessengerBot.py - sends a message into a specific Discord channel

import pyautogui

discordIcon = r"Chapter 20\i_discord.PNG"
channelIcon = r"Chapter 20\i_channel.PNG"
subChannelIcon = r"Chapter 20\i_subchannel.PNG"
textBoxScreen = r"Chapter 20\i_textBox.PNG"

print('Initiating...')
pyautogui.countdown(10)

if not pyautogui.getActiveWindowTitle().endswith("Discord"):
    pyautogui.click(discordIcon)

window = pyautogui.getActiveWindow()
pyautogui.sleep(1)
window.maximize()
pyautogui.sleep(1)
pyautogui.click(channelIcon)
pyautogui.sleep(1)
pyautogui.click(subChannelIcon)
pyautogui.sleep(1)
pyautogui.click(textBoxScreen)

pyautogui.write("Instant messenger bot greets this server o7")
pyautogui.sleep(1)
pyautogui.write(['enter'])
Beispiel #13
0
#! python

# pGetText.py - finds a notepad window and get all the text in it
import pyautogui, pyperclip

NoteIcon = r"Chapter 20\NotepIcon.PNG"

print('Prepare for initiation!')
pyautogui.countdown(10)

if not pyautogui.getActiveWindowTitle().endswith('Beležnica'):
    pyautogui.click(NoteIcon)

window = pyautogui.getActiveWindow()

window.maximize()

pyautogui.moveTo(window.height/2, window.width/2, duration = 0.3)

pyautogui.click()
pyautogui.hotkey('ctrl','a')
pyautogui.hotkey('ctrl','c')

print('The text in your notepad is: ' + pyperclip.paste())

print("Done")
Beispiel #14
0
import pyautogui as pya
import time

while True:
    print(pya.getActiveWindowTitle())
    time.sleep(1)