Sleep function

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 27, 2023
Company:

Hi experts,
   how to wait code for 1 second.

 
#2
People who like this:0Yes/0No
Administrator
Rating: 32
Joined: Oct 3, 2019
Company:

Hello Selim!

The 1C company promised to add the "CallSleep" method in the 8.3.25 language version, which should implement a pause. But unfortunately, this has not been done yet :-(

Therefore, developers have to figure out how to implement a pause when executing code themselves.

In fact, there are many different options for making a pause, for example, a loop (never do this, since executing a loop puts a lot of load on the processor!) or running a script using VBScript and the WScript.Shell COM object method (this method will only work on Windows).

So as you can see, each of these methods has certain disadvantages...

For my part, I suggest using the HTTPConnection object and its Get method:


Code
Procedure Sleep(PeriodInSeconds)
   
   Try
      connection = New HTTPConnection("127.0.0.0",,,,,PeriodInSeconds);
      connection.Get(New HTTPRequest());
   Except
      
   EndTry;
   
EndProcedure

 
#3
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 27, 2023
Company:

Thank you for your help brother :)

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.