Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

pyautogui and extendscript

Participant ,
Jan 30, 2019 Jan 30, 2019

Hey guys,

I've recently discovered the wonders of Python and pyautogui's gui automation potential, and I'm wondering if I can use it to get around some of the clunkier behaviors of my Extendscripts, when they use menu commands.

For example, if one of my scripts uses the collect feature, I'd like to be able to write the destination and press ok.

Or when my script needs to automatically save a preset, right now I have to have two dialogs pop up. One with the full path of the preset that my script will assume the new preset's name will be, so the user can copy it, and then the actual save preset dialog that they paste it into. If I were able to automate the gui, only one dialog would be necessary here, and the user wouldn't have to even interact with that one.

The problem I'm running into is that I can call a python script while Extendscript is running, but it won't call DURING a dialog. I can call it BEFORE opening these dialogs, or AFTER they close. I could try to get around this by having python call the command from the menu, instead of using Extendscript's app.executeCommand(app.findMenuCommandId, but then I run into the following problem: pyautogui can't interact with AE while an Extendscript is running, just like you can't manually interact with AE while it's running, since you get the spinning wait mouse cursor until it finishes executing.

Is there any way around this?

TOPICS
Scripting
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Feb 04, 2019 Feb 04, 2019

What about having your AE script execute a .py file on disk that has a timer in it? Unsure whether it'd work, but could be worth trying.

So:

  • Extendscript calls a python file to execute
  • Extendscript triggers the menu opening
  • Your system-level (not running in AE, just running on the OS) py script waits a second or so (however long the menu takes to open)
  • Py script does what it needs to do and then stops
  • Extendscript sees that the dialog is closed and continues its process
Translate
Contributor ,
Feb 04, 2019 Feb 04, 2019

What about having your AE script execute a .py file on disk that has a timer in it? Unsure whether it'd work, but could be worth trying.

So:

  • Extendscript calls a python file to execute
  • Extendscript triggers the menu opening
  • Your system-level (not running in AE, just running on the OS) py script waits a second or so (however long the menu takes to open)
  • Py script does what it needs to do and then stops
  • Extendscript sees that the dialog is closed and continues its process
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2019 Feb 08, 2019

I've tried this, but unfortunately, when I try to run a .bat externally to call my python script, Extendscript still waits for the python script to finish before resuming. Is there any way to run them in parallel?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 08, 2019 Feb 08, 2019

How are you calling the .bat?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 11, 2019 Feb 11, 2019

var file = new File('myBat.bat');

file.open('w');

file.write(myCommand);

file.close();

file.execute();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 21, 2019 Feb 21, 2019
LATEST

My mistake. It was working this whole time - it was just taking a long time to invoke the initial call to python. Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines