Setinterval for Adobe ExtendScript

If you start working on an extension for one of Adobe CS products it can be really annoying or even disappointing once you find out that there is not any of java-script timing events available!
No setInterval, no timeout! no nothing! which means you don’t even have a choice, all the code you write, HAS TO be blocking!
That was (and probably is still kind of!) my situation! in fact, I’m working on my memoir, and both in my university and our lab place I have access to the whole set of Adobe products, (Oh, forgot to say: I’ll use Indesign to publish/design (page-making) my memoir), and since it have never been convenient for me to do things the easy way, I decided to write a plugin for In-Design so it will do for me what I wanted to do! Yeah, pretty much my first essay on creating an extension for an Adobe product…

Let’s make it short for you (I’ll probably talk more about that plugin, once it was ready!), I did a lot of research and read almost 500 pages of (really bad documented) adobe documents! to find out that there is no way to write a non-blocking check-loop; BUT…

But after I gave up, I thought it will bother me if I don’t try the last, and least probable idea! and that was the answer! (kind of) in fact I read almost all the possible event objects in Adobe ID and none of them were useful, but one of them raised my curiosity at-least and I thought give it a try! It is onIdle event and obviously it trigers on software IDLE time but it is more than that! in-fact you can check for system state in really short amounts of time (or long!) and it will return it to you, and that’s called an interval!! I would guess probably it won’t be precise but it would be enough good most certainly to help one to write a non-blocking UI or atleast give the option to user to choose the way s/he prefer (having the entire software freezes for the duration of the process or do it in the backrgund!)

Voila quoi!

Sample code:

Please let me know if you need more info / samples on it! my problem is solved now but I couldn’t find any helpful information online AT ALL, so I though I’d share it, 😉

 

there is an $.sleep() method available which that too, of course, is blocking!

Hi there in future!

This is the hello world post!

I just created this blog today, at 30, May, 2014 but I’m not new in blogging universe! In fact, something, someone kept me back, not letting me blog! And it was me!
As an artist who just happened to be a (so called) “developer” as well, you’ll get the worst of both worlds! Artists are perfectionist; they’ll never finish a project, a painting, a film, or a blog!

So I ended up installing more blogging platforms, CMSs, WP, MODx, Bolt, etc. and designing more themes and custom versions than blogging at all!

My first blogs date to many years ago, with always unfinished features hanging around on pages! You may still find bunch of them semi-alive here and there on wordpress.com or blogspot or …, my personal hosted blogs but I guess are expired (maybe because the domain name wasn’t perfect and I bought new ones which I’d like more, so the old ones gone by time)

But that’s enough of it! I have still lots of unfinished / semi-finished / let’s call it finished projects and I’m working on them, because that’s what I love to do, but for blogging part of me, that’s enough of waiting for other parts (of me!); Here it is so, a simple empty Word-Press slate, with Twenty something theme!! ofcourse I’ll update/ change/create or customize the theme in future, but 1. I’m not waiting for that to surprise the world anymore! 2. I’ll put it here once it was production-ready (at least to my least standards for my personal use!) so I will work on it on a sand-box.

That’s it to say right now but I like to add the reason why I write (or log) anyway:

I don’t have any audience in my mind and I’m not writing anything here for anyone, I’m just writing for myself, to satisfy this internal need to write! To document! And to put an end to all scattered footnotes here and there in my sketchbooks, books and papers! (I know though that’d continue anyway!)
These are notes to myself, to my future-self, to remember and to relax and not worry to forget again for my current-self!

Mim,, 30.5.2014, Paris