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

Need an ExtendScript timer

Advocate ,
May 08, 2014 May 08, 2014

Copy link to clipboard

Copied

I've done a lot of research and even found this question asked on another website, but no answers have been found. Has anyone been able to create a non-blocking timer? Something not involving $.sleep(), as that is blocking. I've tried app.scheduleTask(), but had issues with it not seeing any of my objects or variables when it runs within a dockable script. Perhaps I'm misunderstanding the use of it, but maybe someone can shed some light on it. The base goal is to have a progress bar update, but not via a loop of any kind. I am checking a system folder for files and as the folder gets more files I want the progress bar to update accordingly. A simple function is being used and just needs to be launched on an interval basis to process the folder. Appreciate any help.

TOPICS
Scripting

Views

4.3K

Translate

Translate

Report

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 , May 09, 2014 May 09, 2014

With app.scheduleTask(), you need to be sure that your variable within its scope - generaly if your variable is inside a function, it might be outside of the scope as the variable might not exist anymore.

Also, the app.scheduleTask() will stop working whenever an after effects window pop up, eg. alert window, open window, preferences window...

The only way we were able to have a task being scheduled and still working with those window was with a flash object, the timer inside it was calling intera

...

Votes

Translate

Translate
Contributor ,
May 09, 2014 May 09, 2014

Copy link to clipboard

Copied

With app.scheduleTask(), you need to be sure that your variable within its scope - generaly if your variable is inside a function, it might be outside of the scope as the variable might not exist anymore.

Also, the app.scheduleTask() will stop working whenever an after effects window pop up, eg. alert window, open window, preferences window...

The only way we were able to have a task being scheduled and still working with those window was with a flash object, the timer inside it was calling interacting with extendscript using the invokePlayerFunction and externalInterface.call() functions. However, flash support in CC seems discontinued, so it is not working anymore.

Votes

Translate

Translate

Report

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
Advocate ,
May 12, 2014 May 12, 2014

Copy link to clipboard

Copied

With app.scheduleTask(), you need to be sure that your variable within its scope - generaly if your variable is inside a function, it might be outside of the scope as the variable might not exist anymore.

Also, the app.scheduleTask() will stop working whenever an after effects window pop up, eg. alert window, open window, preferences window...

Exactly the issues I was coming across.

Time to file a feature request it sounds like.

Votes

Translate

Translate

Report

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 ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

I have a script that checks every second if a project has been opened in AE and then clears the interval once one has. I used to run into problems with this in CC 2014 if I did File Open (getting the script cannot execute while modal window is expecting a response error), so I had to use Open Recent or always double-click a file. (Also, trying beginSuppressDialog() and endSuppressDialog(false) didn't work).

This seems to have been resolved in CC 2015. Just curious if anyone figured out a way to get around it in CC 2014 since some of the people where I work still use that?

Votes

Translate

Translate

Report

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
Community Expert ,
Aug 06, 2015 Aug 06, 2015

Copy link to clipboard

Copied

Maybe you can try using an HTML5 panel instead of a traditional script? Not sure whether the timer functions are more robust there, but maybe worth a try.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

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 ,
Aug 06, 2015 Aug 06, 2015

Copy link to clipboard

Copied

thanks, I should have mentioned that I am using a HTML5 panel and angular that loads in stored project data from a database when it detects a file has been opened and matches the file name to a database that stores that project's data. Everything works except that annoying script error in CC 2014.

Votes

Translate

Translate

Report

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
Community Expert ,
Aug 06, 2015 Aug 06, 2015

Copy link to clipboard

Copied

And it does not make a difference whether you use the app.scheduleTask() from ExtendScript or a timer from the jacascript/HTML5 part of the app?

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

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 ,
Aug 07, 2015 Aug 07, 2015

Copy link to clipboard

Copied

I had not tried the scheduleTask approach. I will give it a shot. Thanks!

Votes

Translate

Translate

Report

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
Enthusiast ,
Aug 09, 2015 Aug 09, 2015

Copy link to clipboard

Copied

I found this to be useful.  It's from the Illustrator Scripting forum.  Those guys are mad talented!  Check out Matthias Guntrum's answer at the bottom.  It gave me a good place to start.  It's "non-blocking" while the function it executes is not running, but for all practical purposes, it does block the user from doing things.

Anything similar to javascript's setInterval in ExtendScript?

—Arie

Votes

Translate

Translate

Report

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 ,
Aug 10, 2015 Aug 10, 2015

Copy link to clipboard

Copied

Thanks. I will try that out as well

Votes

Translate

Translate

Report

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
Advocate ,
Aug 10, 2015 Aug 10, 2015

Copy link to clipboard

Copied

I know you are still using 2014, but they did add these to CC 2015 finally and they appear to be non-blocking.

app.setTimeout()

app.cancelTimeout()

Votes

Translate

Translate

Report

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
Enthusiast ,
Aug 10, 2015 Aug 10, 2015

Copy link to clipboard

Copied

Sweet!  Thanks, David!

I had no idea, thank you for letting me know.  Can you point me to the latest scripting docs / notes?

Votes

Translate

Translate

Report

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
Advocate ,
Aug 10, 2015 Aug 10, 2015

Copy link to clipboard

Copied

This is where the latest docs usually end up. http://www.adobe.com/devnet/aftereffects.html‌ , but since there is no new doc for 2015, I just used my ExtendScript Developer Utility script to view the methods and properties that are available.

You can also just use the reflection object in ExtendScript as well.

app.reflect.methods

app.reflect.properties

That'll tell you what is in there for the app object. Just watch yourself though, you can definitely launch things you shouldn't, break things you don't want to, and deactivate the app if not careful.

Votes

Translate

Translate

Report

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 ,
Aug 11, 2015 Aug 11, 2015

Copy link to clipboard

Copied

Thanks, David and Arie. Yes, we noticed that as of CC 2015, even the setInterval and clearInterval methods on the angular side of our app started working, but we were trying to retro-engineer for users who still used CC 2014. Luckily, yesterday I was told we no longer have to do that.

Thanks for you help, everyone. If/when I have time, just for fun, I am still going to see if I can come up with some kind of non-blocking solution for 2014 using the scheduleTask methods.

Votes

Translate

Translate

Report

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
Advocate ,
Aug 11, 2015 Aug 11, 2015

Copy link to clipboard

Copied

If/when I have time, just for fun, I am still going to see if I can come up with some kind of non-blocking solution for 2014 using the scheduleTask methods.

It would be appreciated by all if you do find a viable workaround. Plus having a coding challenge like this is always fun. I know I've been trying for awhile now to figure it out.

Votes

Translate

Translate

Report

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 ,
Aug 11, 2015 Aug 11, 2015

Copy link to clipboard

Copied

LATEST

I will keep you posted. May not be until next week when things calm down a bit but will definitely give it a shot!

Votes

Translate

Translate

Report

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