Using Python Script to run an Alteryx workflow via the Microsoft Task Scheduler on Remote Desktop

Viewed 557

my python script works perfectly fine as long as I'm logged into the remote desktop while the task scheduler initiates it. However, if I'm no longer connected to the remote desktop, it terminates because pyautogui has a Failsafe. When I turn the failsafe to false, the whole workflow just doesn't run at all (no matter where in the workflow I put it). My goal is for this to run on remote desktop while I don't have to be logged onto it.

Current path:

  1. Windows Task Scheduler
  2. Runs Run_Alteryx_Workflow.bat
  3. Runs Run_Alteryx_Workflow.py
  4. Runs Alteryx_Workflow.yxmd

Code for Run_Alteryx_Workflow.py:

import pyautogui as pg
import os
import time

# pg.moveTo(800, 800, 1.5)
# pg.FAILSAFE = False

time.sleep(10)

# OPEN ALTERYX

os.startfile(r'C:\Users\eXXXXXX\Desktop\Alteryx_Workflow.yxmd')
time.sleep(30) #build in enough time for Alteryx to open the workflow

# RUN ALTERYX WORKFLOW

pg.hotkey('ctrl', 'r')
# time.sleep(300)
time.sleep(100)

# CLOSE ALTERYX

pg.hotkey('alt', 'F4')

Code for Batch File (Run_Alteryx_Workflow.bat):

C:\Users\eXXXXXX\Desktop>"python" "C:\Users\eXXXXXX\Desktop\Run_Alteryx_Workflow.py"

Thank you for your help! This is my first post to StackOverflow! Much of my code is commented out as I've tested things. My biggest issue is running it while I'm not logged into my remote desktop!

1 Answers

You can't automate Alteryx like this, it just doesn't work.

You need to purchase Desktop Automation.

Related