hello guys
I've written a quick maya mel file that outputs the coordinates of the camera every 1 second or so to a text file, and I'm trying to fetch the data of the text file in AE. I can read it in no problem, but my question is, can I do it with a kind of 'threading'.
Can I have a script that checks the contents of the file every x seconds and updates the AE camera coordinates as needed ?
I'm clueless as to how I can implement some kind of 'wait' function so my script doesn't just endlessly loop (kind of like 'setTimeout()').
delayed / timed / threaded script ?
Moderator: Paul Tuersley
-
- Posts: 33
- Joined: February 7th, 2005, 7:32 am
- Contact:
Boom boom boom.
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
You can try using a while loop like this:
adjust the value as necessary.
You can also experiment with scheduleTask (from p29 in the CS3 scripting guide):
Code: Select all
while(i < 1000000) i++;
You can also experiment with scheduleTask (from p29 in the CS3 scripting guide):
LloydApplication scheduleTask() method
app.scheduleTask(stringToExecute, delay, repeat)
Description
Schedules the specified JavaScript for delayed execution.
Parameters
Returns
Integer, a unique identifier for this task, which can be used to cancel it with app.cancelTask().
stringToExecute A string containing JavaScript to be executed.
delay A number of milliseconds to wait before executing the JavaScript. A floating-point value.
repeat When true, execute the script repeatedly, with the specified delay between each execution. When false
the script is executed only once.
You could use the sleep() function which is part of the Dollar ($) Object debugging facility.
See the Javascript Tools Guide for details.
Works for me when used as
See the Javascript Tools Guide for details.
Works for me when used as
Code: Select all
$.sleep(5000); // wait 5 seconds