Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, July 5, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: How to wait for WshShell command to complete (and not use resources) in VB Script
Scot Zimmerman
Posts: 2
 
How to wait for WshShell command to complete (and not use resources) in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Mar 06 9:43 AM

imurel solarium

imurel pentasa imurel wikipedia imurel netdoktor
I've created a script to push a PO from SLX into MAS200 and receive the PO# back. The only problem is that I must wait in a loop (using 100% of the cpu) while the Shell command completes so that I can then retrieve the PO# from the clipboard. This slows down the execution of the Shell command. I tried using the sleep method in the loop below as specified in the MSDN library, but I get an error message that the Wscript variable is not defined.

set WshShell = CreateObject ("Wscript.Shell")
set objExec = WshShell.Exec(strCommand)

Do While objExec.Status = 0
Wscript.Sleep 100
Loop
Set WshShell = Nothing

Another way to do this is to look at the contents of the clipboard in a loop and when a value has been posted by MAS 200, exit the loop. However, this ties up resources as well. Do you have any suggestions on how to sleep or wait for a designated period of time in a VBScript?

Thanks for your help.
Scot
[Reply][Quote]
Rob Seiwert
Posts: 6
 
Re: How to wait for WshShell command to complete (and not use resources) in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Mar 06 8:42 AM

amoxicillin without prescription

amoxicillin price without insurance
Been thru this before myself. You should try the Wscript.Shell run method. This takes a couple of extra parameters which determine the window style and if to wait for completion or not. Basically cc=wshell.run(strCommand,1,true). The 1 specifies a normal window, the true tells it to wait till the program exits and returns the exit code. Here is a link to msdn which I hope will remain valid for a little while.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/6f28899c-d653-4555-8a59-49640b0e32ea.asp
[Reply][Quote]
Scot Zimmerman
Posts: 2
 
Re: How to wait for WshShell command to complete (and not use resources) in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Mar 06 11:14 AM

fluoxetine alcohol liver

fluoxetine and alcohol
Thanks, Rob. Your suggestion solved half of my issue. The WshShell process waits until MAS 200 has completed the import of the PO. However, MAS keeps the clipboard open for about 5 seconds after the process has completed. When I try to read the clipboard I trap the error and loop until it is available. This monopoizes 100% of the CPU on the client PC until MAS releases the clipboard. Do you know how I could wait for 1 second between tries to read the clipboard?

Thanks
[Reply][Quote]
Rob Seiwert
Posts: 6
 
Re: How to wait for WshShell command to complete (and not use resources) in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Mar 06 3:17 PM

nootropil

nootropil redirect
One suggestion would be to add a doevents command to your loop. You will find the CPU utilization lowers and that all other apps and events are allowed to respond. This also will slow your loop. Personally I really don't like waiting in a loop for a result. My prefered way would be to use the timer control. For a long time I wished I had this feature in SLX and now that it's there I have yet to use it. First of all you need to call your code from a form probably from the form load event. If someone knows of a way to use this control without a form please let me know. On form load make sure you disable the timer and set the interval in milliseconds. The max is 10000. If it takes 5 secs to release I would set it for 6000. When your shell.run returns then enable the timer. Your code to get the clipboard should be tied to the onTimer event and then would unload the form when you have successfully retrived the results.
[Reply][Quote]
Jon Davis
Posts: 65
 
Re: How to wait for WshShell command to complete (and not use resources) in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Mar 06 11:59 AM

otc inhaler rite aid

asthma rescue inhaler not working bistromc.org
fiogf49gjkf0d
Quote:
Originally posted by Rob Seiwert

One suggestion would be to add a doevents command to your loop. You will find the CPU utilization lowers and that all other apps and events are allowed to respond. This also will slow your loop.


I'm a little surprised no one pointed it out yet, but it needs to be said: There is no DoEvents in VBScript. Someone mentioned Application.DoEvents, as well--that's a VB.NET method.

Fortunately, we are not at a loss. Here is the SLX equivalent:

Sub DoEvents()
Application.BasicFunctions.ProcessWindowMessages()
End Sub


HTH,
Jon
[Reply][Quote]
marcos
Posts: 1
 
Re: How to wait for WshShell command to complete (and not use resources) in VB ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jun 11 5:08 AM
fiogf49gjkf0d

Hi, I tried that function but it is not recognised:


I wrote it like this ActiveDocument.GetApplication.BasicFunctions.ProcessWindowMessages() and I get this error:


Object doesn't support this property or method: 'ActiveDocument.GetApplication.BasicFunctions'


Thanks in advance for your help

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/5/2025 6:41:15 AM