|
2 | 2 | import time
|
3 | 3 | import win32gui
|
4 | 4 | import pyautogui
|
5 |
| - |
| 5 | +import yaml |
| 6 | +import core |
6 | 7 | import functions
|
7 | 8 | from functions import find_Object_right, pick_item_right, image_Rec_inventory, pick_item
|
8 | 9 |
|
9 |
| -def findWindow(data): # find window name returns PID of the window |
| 10 | +def gfindWindow(data): # find window name returns PID of the window |
10 | 11 | global hwnd
|
11 | 12 | hwnd = win32gui.FindWindow(None, data)
|
12 | 13 | # hwnd = win32gui.GetForegroundWindow()860
|
13 | 14 | #print('findWindow:', hwnd)
|
14 | 15 | win32gui.SetActiveWindow(hwnd)
|
15 | 16 | # win32gui.ShowWindow(hwnd)
|
16 | 17 | win32gui.MoveWindow(hwnd, 0, 0, 865, 830, True)
|
| 18 | + |
| 19 | + |
| 20 | +with open("pybot-config.yaml", "r") as yamlfile: |
| 21 | + data = yaml.load(yamlfile, Loader=yaml.FullLoader) |
| 22 | + |
| 23 | +try: |
| 24 | + gfindWindow(data[0]['Config']['client_title']) |
| 25 | +except BaseException: |
| 26 | + print("Unable to find window:", data[0]['Config']['client_title'], "| Please see list of window names below:") |
| 27 | + core.printWindows() |
| 28 | + pass |
| 29 | + |
| 30 | +try: |
| 31 | + x_win, y_win, w_win, h_win = core.getWindow(data[0]['Config']['client_title']) |
| 32 | +except BaseException: |
| 33 | + print("Unable to find window:", data[0]['Config']['client_title'], "| Please see list of window names below:") |
| 34 | + core.printWindows() |
| 35 | + pass |
17 | 36 |
|
18 | 37 | def gerrants_shop_active():
|
19 | 38 | shop = functions.Image_count('gerrant_shop.png', 0.75)
|
@@ -94,6 +113,5 @@ def get_sandworms():
|
94 | 113 | Run_Duration_hours = 0.5
|
95 | 114 | t_end = time.time() + (60 * 60 * Run_Duration_hours)
|
96 | 115 | while time.time() < t_end:
|
97 |
| - findWindow("RuneLite") |
98 | 116 | trade_tynan()
|
99 | 117 | get_sandworms()
|
0 commit comments