ElegantSol
(Fresh Scripter)
2002-12-03 06:39 PM
SLEEP USAGE ADVICE

I was trying to do a search to get more info on the usage, need for and time values for the SLEEP command.

Unfortunatly, I mostly get Lonkero's signature instead of the boards message text.

Signatures should be excluded from the search.


Sealeopard
(KiX Master)
2002-12-03 06:41 PM
Re: SLEEP USAGE ADVICE

What is the problem with SLEEP? It is well documented in the KiXtart Manual!
quote:
Action: Halts script execution for the number of seconds specified.

Syntax: SLEEP <seconds>



[ 03. December 2002, 18:48: Message edited by: sealeopard ]


Les
(KiX Master)
2002-12-03 06:47 PM
Re: SLEEP USAGE ADVICE

Welcome to the board. The functionality of the search tool is under the control of the UBB software authors so those sort of suggestions would be better directed to www.infopop.com instead. As Jens said, SLEEP is a pretty simple command and not likely to be used in creative ways.

LonkeroAdministrator
(KiX Master Guru)
2002-12-03 07:14 PM
Re: SLEEP USAGE ADVICE

heh, good to know that I'm answer for any sleep related questions...
well, at least board seems to think so [Big Grin]


NTDOCAdministrator
(KiX Master)
2002-12-03 09:29 PM
Re: SLEEP USAGE ADVICE

Hello ElegantSol and Welcome to the board.

Here is an example of using SLEEP

code:
IF EXIST("%windir%\DESKTOP\SAP*.LNK") DEL ("%windir%\DESKTOP\SAP*.LNK") ENDIF
SLEEP 2

This would cause the script to pause execution for 2 seconds before continuing with the rest of the script. You could also use .2 .5 .9 etc... to have it pause for 2/10th of a second etc.


ElegantSol
(Fresh Scripter)
2002-12-04 01:21 PM
Re: SLEEP USAGE ADVICE

Yes, the syntax of SLEEP is obvious, especially in the case of delaying the script to allow the user to read the screen output. What is not obvious is its usage in other places. I have looked at numerous scripts on the boards and seen it in places other than text display. It appears it is being used to allow a prior command to complete.

If command completion is the reason, then which commands require a delay and how does one determine the proper amount of time to allow, other than trial and error.

[ 04. December 2002, 14:31: Message edited by: ElegantSol ]


Sealeopard
(KiX Master)
2002-12-04 04:24 PM
Re: SLEEP USAGE ADVICE

Most of the time you see the sLEEP command in othe rpeoples code it's actually a non-necessary line of code inserted by mostly inexperienced KiXtart coders.
code:
use r: '\\server\share'
sleep5

for example doesn't do anything except delaying the script execution by 5 seconds. KiXtart is a sequential language, thus a command is only executed after the previous one finished. In this case SLEEP is unnecessary.

There are not many uses for SLEEP. The main use in within LOOPs to decrease CPU stress.


JochenAdministrator
(KiX Supporter)
2002-12-04 04:51 PM
Re: SLEEP USAGE ADVICE

Also !

One can use 'sleep 0.001' in excessive loops in order to prevent CPU stress ...