Skip to content

Commit e007b6f

Browse files
Update feather_trade.py
1 parent fa1c0ef commit e007b6f

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

feather_trade.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,37 @@
22
import time
33
import win32gui
44
import pyautogui
5-
5+
import yaml
6+
import core
67
import functions
78
from functions import find_Object_right, pick_item_right, image_Rec_inventory, pick_item
89

9-
def findWindow(data): # find window name returns PID of the window
10+
def gfindWindow(data): # find window name returns PID of the window
1011
global hwnd
1112
hwnd = win32gui.FindWindow(None, data)
1213
# hwnd = win32gui.GetForegroundWindow()860
1314
#print('findWindow:', hwnd)
1415
win32gui.SetActiveWindow(hwnd)
1516
# win32gui.ShowWindow(hwnd)
1617
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
1736

1837
def gerrants_shop_active():
1938
shop = functions.Image_count('gerrant_shop.png', 0.75)
@@ -94,6 +113,5 @@ def get_sandworms():
94113
Run_Duration_hours = 0.5
95114
t_end = time.time() + (60 * 60 * Run_Duration_hours)
96115
while time.time() < t_end:
97-
findWindow("RuneLite")
98116
trade_tynan()
99117
get_sandworms()

0 commit comments

Comments
 (0)