2

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!

Gerhard
  • 22,678
  • 7
  • 27
  • 43
KeyaD77
  • 21
  • 6
  • Your issue is unclear, as it seems you're wanting to run something remotely, when you're not remotely connected. If you want to run something on another PC, and there's a chance that both PC's may not be connected at that time, then obviously the other PC would need to have all of the files needed for that execution to happen. Also `C:\Users\eXXXXXX\Desktop>` is the Prompt message from a cmd.exe window, and would never be entered in a [[tag:batch-file]], as you have indicated. Additionally you've included information not relevant to a [mcve] of your code, or insufficient code for that info. – Compo Dec 29 '21 at 15:02
  • When I run the Windows Task Scheduler by executing the batch file, everything runs perfectly. I've provided my exact code (removing personal data) as it's a very short code piece. It all works perfectly except when it's running on remote desktop while I'm not logged in as the error I get is that the Failsafe to pyautogui was triggered for some reason. – KeyaD77 Dec 30 '21 at 16:43
  • Have you found a solution to this? I’m doing the same thing and having the same issues.. – Mystical Me Feb 10 '22 at 05:20

1 Answers1

1

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

You need to purchase Desktop Automation.

cmcau
  • 555
  • 2
  • 10