Trying to Schedule VBScript that prints Sales Orders

We are on Sage 100 Advanced v2017 and I have a VBScript that prints Sales Orders using the SO_SalesOrderPrinting_UI object.

Does anyone know if this object requires an active Windows session in order to run? 

The script runs perfectly when I run it manually.  It also runs correctly when I schedule it with Task Schedule to "run only when user is logged on".  However, we want to schedule this to run when I'm not logged on, and that doesn't work.  Our IT has narrowed down to the script, because we can get other VBScript files to run correctly with this setting, such as a script that creates another file.  

I've scheduled VBScripts to run that create Sales Orders from files etc, but I've never tried this printing object on the scheduler.  So I'm wondering if this is the issue - after all, it does have UI right in its name.  

If this is not going to run without a Windows session, does anyone have a solution for printing Sales Orders on a schedule?  

(Background:  some sales orders require 2 different forms to be printed, and the CSR forgets.  So we have a script on SO entry that checks the SO lines for the criteria that tells us it needs to be printed, and then writes the SO number to a UDT.  The scheduled script is to pick up the SO's from the UDT and print them.)

Parents
  • 0

    Along the lines of what Kevin said, where is the print output going to - a printer, to Paperless, to Deferred? Since there presumably could be normal UI that appears with form printing, these things come to mind IF they are relevant for you:

    oSS.nTerminateUI() 'an oldie so not sure if it's still supported or has been deprecated.
    Also obviously suppress any explicit MessageBox's, ProgressBar's, other UI you are issuing yourself.

    If printing to Paperless:
    If oReport.PDFEnabled Then oReport.PDFSilent = 1
    'Assuming oReport points to SO_SalesOrderPrinting_Rpt (NOT SO_SalesOrderPrinting_UI)

  • 0 in reply to Alnoor

    I was not able to get the SO_SalesOrderPrinting_Rpt  object to work for me, maybe because I am using the QuickPrint method.  I will post my code to see if anyone has suggestions.

Reply Children
  • 0 in reply to hyanaga

    ** EDIT ** Changed oReport.QuickPrint to oReport.sQuickPrint



    I'm guessing you just need to do add this:

    oReport.sQuickPrint = sOrderNo 'where sOrderNo is your Sales Order No

    If it's not there it will attempt to chain into the next form/report. E.g. it may attempt to show you the "Do you want to print Picking Sheets Y/N ? " messsage. Setting the QuickPrint property will bypass that.