The way you have done it is not good in such situation. WindowWaitOpen should be used in cases when you start a program or some process and want to catch the moment when certain window is opened. Do not use it to wait for the window to appear indefinitely. WindowWaitOpen with 0 wait parameter causes it internally to constantly loop through all opened windows checking which window's title matches the specified value. This of course causes heavy load on the system. You have several options. 1. Set the job priority to "Low". This will allow the system to give less CPU ticks to the job process. 2. Set the agent main process priority to "Low". This also will allow the system to give less CPU ticks to the job process. 3. Rewrite the job to use a less CPU intensive method, for example Dim window_handle,number TRY_AGAIN: OnErrorResumeNext WindowFind "Retail%",window_handle OnErrorStop Ifthen window_handle, CLOSE_IT Wait 10 GoTo TRY_AGAIN CLOSE_IT: WindowClose window_handle : I am running remote agent on a windows 2000 server with SQL Server 2000. : I have one script: Dim window_handle,number : WindowWaitOpen "Retail%",0 : WindowFind "Retail%",window_handle : WindowActivate window_handle : WindowClose window_handle : I have the scheduler set to restart the script when it finishes so it : will wait for the dialog box to appear and automatically close it. : Whenever I run this using the remote agent, the task manager shows a : dramatic increase in CPU resouces (85-90%) being allocated to the 24x7 : process. This slows all other program on the system to a crawl. : I have considered using a loopwhile statement in the script but I don't : want to create an endless loop in the script. Is there anything I can do to : reduce the CPU usage while runnign this script?
|