User Tools

Site Tools


dictionary:xtension:startidler

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dictionary:xtension:startidler [2017/02/23 17:36] – external edit 127.0.0.1dictionary:xtension:startidler [2023/02/13 14:52] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====Start Idler==== ====Start Idler====
 +
 This verb takes it's name from the "idle" handler in a compiled applescript. It can be used to re-execute a global script very quickly or continually without having to clog up the schedule events window. Scheduled events only have a granularity of 1 second anyway, but if you wanted something to run faster than that you'd need to use this. This verb can be called from anywhere. This is considered an advanced scripting topic and you should use the "execute script" verb whenever possible as opposed to this. This verb takes it's name from the "idle" handler in a compiled applescript. It can be used to re-execute a global script very quickly or continually without having to clog up the schedule events window. Scheduled events only have a granularity of 1 second anyway, but if you wanted something to run faster than that you'd need to use this. This verb can be called from anywhere. This is considered an advanced scripting topic and you should use the "execute script" verb whenever possible as opposed to this.
  
Line 6: Line 7:
  
 ===Example=== ===Example===
 +<code>
 start idler (ThisScript) handler “StepTwo” in 500 start idler (ThisScript) handler “StepTwo” in 500
  
-would execute the handler “on stepTwo()” in half a second.+on StepTwo() 
 +  write log “your idle timer is running!" 
 +  return 5000 
 +end StepTwo 
 +</code> 
 + 
 + 
 +would execute the handler “on stepTwo()” in half a second. The return of 5000 would keep the callback happening every 5 seconds after that. You must return a value other than 0 to keep the idler running. If there is an unhandled error in the handler or if the handler returns 0 the idle callback will be stopped. You can change the timing of the next callback for whatever reason by returning a different number of milliseconds.  
 + 
 +Note that this is not a perfect timer. When the callback will actually happen will be no sooner than the number of milliseconds that you request, but will be some small random amount more than that due to system and program load at the time that it expires. 
 + 
 +The minimum value for a callback is 10ms but you definitely do not want to do that repeatedly for very long as you could definitely start to lag the program. While XTension will not let you set a callback in less than 10 milliseconds, there is little chance it will actually happen quite that quickly.
  
 You can also execute handlers in unit ON scripts or in Interface scripts (like the DIY interface) with this verb. While the name parameter is optional if you’re starting a handler in a script because it can use the global (thisScript) value you must include the unit or interface name in order to have the idle timer be called back into either of those types of scripts. You can also execute handlers in unit ON scripts or in Interface scripts (like the DIY interface) with this verb. While the name parameter is optional if you’re starting a handler in a script because it can use the global (thisScript) value you must include the unit or interface name in order to have the idle timer be called back into either of those types of scripts.
dictionary/xtension/startidler.1487871367.txt.gz · Last modified: 2023/02/13 14:51 (external edit)