Simulating a sleep in ArcScript

  • 11 January 2024
  • 0 replies

Userlevel 5

As of the publishing of this entry, there is nothing inherent in ArcScript that performs the equivalent of a sleep or delay - all commands in ArcScript are executed immediately. 


In most cases, it is desirable to execute scripting operations immediately, but there may be times when a sleep between calls would be useful (for example, when interspersing calls to an API that may be rate limited). In that situation, you can effectively create a delay in ArcScript through use of the sysExecute operation, which allows for the execution of external processes on the machine. 


On a Windows environment, for example, you can call out to a batch file which itself implements the delay:


<arc:set attr="sys.Name"  value="C:\\ProgramData\\CData\\Arc\\Sleep_2s.bat" />
<arc:call op="sysExecute" item="sys" />


In the batch file itself, you can implement your own code for a delay, such as:

timeout 2


0 replies

Be the first to reply!