Notifications
Clear all

[Closed] q:script at definted time intervals

how do I start something at predefined time intervals? like something is happening every 5 minutes or every hour or so?

5 Replies
 JHN

there’s a timer tool for rollouts and there’s a dotnet timer http://www.scriptspot.com/bobo/mxs9/dotNet/Timer.html

The rollout tool only works when a rollout is constantly openend, so best go with the dotnet I think.

A callback that compares system time could be used to, now only to get a callback that get’s called a lot and not cause the system to slowdown…

Something like that?

-Johan

yes, but I would rather not have anything in the interface, no rollout, no anything.
I want to make something that checks periodically all the objects in the scene, and ensures they are named correctly. if they are not, a messagebox pops up.
This would be the last bit.
So I suppose if I can’t connect it to time, I can use a scene event or something…
still, the time would be my safest bet. How can I make it happen?

There’s no proper system for doing that sort of thing in Max, unfortunately.

You can do that sort of thing with the rollout timer like Johan suggested, but keep the floater it’s in offscreen somewhere by setting its pos to -500,-500 or something. I tried that once long ago and it more or less worked.

The issues with rollout timers used to be that they wouldn’t reliably fire exactly when you wanted them to if the user was doing other operations (maybe that’s okay here), and whatever they execute is still a blocking call. Meaning if it takes a second or two to run what the timer triggered, the user is still waiting for it to finish. There’s no background processing aspect to it.

Maybe dotnet timers are more robust, I haven’t tried those.

 JHN

If you only want to check for name conventions why not do it with on a presave callback. Is it really necessary to check periodically?


 global checkNames()="your code here"
 callbacks.addScript #filePreSave "checkNames()" id:#uniqueIDhere
 

?

-Johan

P.s. Adam the dotnet timer will run when closing the script, it’s not constrained to a dialog. So it could work.

perfect. thank you, guys.
I used the callbacks.addscript with presave and fileopen options. It works just as I intended. And giving the fact max saves the scene from time to time, guess what…my remainder pops up!