XRunAndWait - Python - App close detected, Exit code=1

Hey Everyone,

I’ve begun using the XRunAndWait module and my second macro is getting a strange issue. I call it, it never runs, and the log shows:

  • [info] App close detected, Exit code=1

I’ve copied the exact setup as a working call (python.exe location). I can confirm when I manually call the .py script, it works.

 {
      "Command": "XRunAndWait",
      "Target": "C:\\Users\\MyName\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
      "Value": "C:\\Users\\MyName\\Desktop\\Python-Click-Button\\button.py",
      "Description": ""
    }

My python script:

import pyautogui
x, y = pyautogui.locateCenterOnScreen('./button.png')

def clicksubmit():
    pyautogui.moveTo(x, y, duration=4)
    pyautogui.click()

clicksubmit()

(1) Are you sure it never runs, or does the pyautogui click “just” not work? You can add a simple logfile to find out.

(2) Have you seen How to call python script in UIVision ? Does this file work ok?

(3) Why are you using pyautogui when you have uivision? Or is this just a test? :wink:

(1) Are you sure it never runs, or does the pyautogui click “just” not work? You can add a simple logfile to find out.
-In my testing, it does not move the mouse or click the button. However, once the scripts I can open the .py script manually and the mouse moves and clicks.

(2) Have you seen How to call python script in UIVision ? Does this file work ok?

I believe so, I searched the forums and found the chunk of code I’m using now.

(3) Why are you using pyautogui when you have uivision? Or is this just a test?
I’ve tried using Xmodules/Xclick to grab a screen of the button, however it times out and says cannot be found. This lead me to thinking if I could some how practice python and come up with a solution to try.