#! python3
import pyautogui
#import pygetwindow as gw
import sys

# print('Press Ctrl-C to quit.')
# try:
   # while True:
        # x, y = pyautogui.position()
        # positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
        # print(positionStr)
       
# except KeyboardInterrupt:
    # print('\nDone.')
    
file = sys.argv[1]
print('File received as arg: ', file)

#fw = pyautogui.getActiveWindow()
#print('Active window: ', fw)
#print('Maximized: ',  fw.isMaximized)
#print('Minimized: ', fw.isMinimized)
#print('isActive: ', fw.isActive)
#print('Title: ', fw.title)

#fileUploadWindow = gw.getWindowsWithTitle('File Upload')[0]
#print('Target window: ', fileUploadWindow)
#fileUploadWindow.activate()

#fileUploadWindow = pyautogui.getWindowsWithTitle('File Upload')[0]
#fileUploadWindow.activate()
pyautogui.PAUSE = 3
pyautogui.hotkey('ctrl', 'l')
pyautogui.typewrite(file, interval=0.1)
pyautogui.press('enter')
print('I am done.')
sys.exit(1)