Sage 100

 View Only
  • 1.  Is there a WAIT clause for server-run Script lines - I'm having a traffic jam

    Posted 10-20-2022 10:27
    All,
    ?? I'm invoking 2 scripts from another script.
    Each script works fine individually, but invoking them consecutively in another script causes problems in the sales order and added paya charges.

    The first script is long, writes to the order line file.?? The 2nd script prints the order.?? Both scripts on server.
    Seems like some kind of WAIT clause after invoking the first script might solve this.?? Anyone know of a scripting clause for WAITING.
    The script is simply:
    retVal = oScript.InvokeButton("BT_Link6") ' which gets order line UDF's from another system and writes to order.
    retVal = oScript.InvokeButton("BT_Print")
    --

    Friendly Systems, Inc.

    Visit us on the web at www.friendlysystems.com
    Office:?? 678.273.4010 ext 4
    Mobile: 404.202.9065
    Fax:?????????? ??678.273.4012
    See our blog at www.friendlysystems.com/blog


    Virus-free.www.avg.com


  • 2.  RE: Is there a WAIT clause for server-run Script lines - I'm having a traffic jam

    Posted 10-21-2022 14:55
    You could either run cmd with the /c switch and the timeout command.  You could use the Windows Shell to run the command.  Alternatively, you could just use oScript.Execute "Wait 10" to wait for 10 seconds.  oScript.Execute will execute valid ProvideX and Wait is a directive that will tell the program to wait for the number of seconds that follows the directive.

    However, I personally wouldn't do it this way because you may not really know when you can expect the first script to finish and if you pad it to something too large, you are just wasting time.  I would get it to run sequentially instead.  I was under the impression that InvokeButton would normally run sequentially and wait for each one to finish but if that is not what you are experiencing, then what you might have to do is try putting a retVal = oUIObj.HandleScriptUI() after each InvokeButton line. 

    The other option would be to call the button script in another manner.  At one point, I recall figuring out how to trigger a User Defined Script event within another script but I can't recall if I ever did that for a button script but suspect it is doable.  Alternatively, you might be able to get away with reading the script file assigned to the button and then executing it in-line with your code but this approach to read and execute the .vbs file should be tested to make sure there aren't any conflicts with variables and object handles.
    Include other files in VBScript – CTGlobal (ctglobalservices.com)

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 3.  RE: Is there a WAIT clause for server-run Script lines - I'm having a traffic jam

    Posted 10-27-2022 06:31
    David,
        Thanks.   I think we fixed some problems on the first script.   Kevin's storage variable is a good idea also.

    Lee

    ------------------------------
    Lee Graham
    Friendly Systems, Inc.
    ------------------------------



  • 4.  RE: Is there a WAIT clause for server-run Script lines - I'm having a traffic jam

    Posted 10-21-2022 15:48
    I have a work-around kind of idea.
    • SetStorageVar to blank string.
    • Trigger your first button (which does a SetStorageVar to a non-blank value at the end).
    • Add a loop in your main script to wait until the GetStorageVar is non-blank before continuing...
    This requires that the SetStorageVar in the button can be "seen" by the main script's GetStorageVar... which might not be true (be sure to test).  I've never been sure on the technical details of how those values shared between different scripts / objects / events...

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 5.  RE: Is there a WAIT clause for server-run Script lines - I'm having a traffic jam

    Posted 10-21-2022 15:54
    That is a good alternative, I wouldn't use oScript for that though, I would use oSession.AsObject(oSession.ScriptObject).

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 6.  RE: Is there a WAIT clause for server-run Script lines - I'm having a traffic jam

    Posted 10-27-2022 06:29
    Good idea, Thanks

    Lee

    ------------------------------
    Lee Graham
    Friendly Systems, Inc.
    ------------------------------