Unable to use paperless office from an external BOI script yet the same script will work when launched from a button or table script

SOLVED

Hi community, running sage 100 advanced version 2015.

I've got a puzzling scenario.

If i attempt to launch a rpt business object from a button script, i can leverage and send the document to paperless office.

Yet if i run the same code formatted as an external script, it will say it was unable to initialize the pdf converter.

So i got to thinking maybe my script just wasn't initializing something that happens when the task (SO_InvoicePrinting_UI) is launched from the menu.

So i changed my external script to get the object and use the process method to show the UI, i then  attempted to change the paperless output to PDF all and clicked print, it then attempted to install the pdf converter and failed.

When i launched the task from the menu, i can select pdf all and click print and it works fine so there is not a problem with the pdf converter installed.

I then changed my external script to get the PL_AdvancedOptions_UI object, i then attempted to installed the pdf converter and it failed. Below is from the log when launched from the external which interestingly enough, the log was created in this folder "C:\Sage\Sage 100 Advanced ERP\MAS90\Home" whereas if i launch PL_AdvancedOptions_UI from file > run, the log is created in "C:\Sage\Sage 100 ERP Workstation\MAS90\Home"

Windows 64-bit x86 Install
------------------------------------------------------------------------------------
Checking for existing PDF printer
------------------------------------------------------------------------------------
Installing using .inf file
------------------------------------------------------------------------------------
Copying cdintf.dll file
------------------------------------------------------------------------------------
Copying xmllite.dll file
------------------------------------------------------------------------------------
Copying cdintf64.dll file
------------------------------------------------------------------------------------
Copying xmllite64.dll file
------------------------------------------------------------------------------------
Installing Amyuni PDF printer driver
------------------------------------------------------------------------------------
Installing Amyuni PDF printer
Error Code: 1801
The printer name is invalid.
------------------------------------------------------------------------------------
Printer setup failed
Error Code: 1801
The printer name is invalid.

So it seems the session object, when launched from an external script is unable to see the pdf converter and is also unable to read the values from the [Paperless] section of the SOTA.ini file.

I even tried using the following to verify the pdf converter

Set oPaperless = oSO_InvoicePrinting_rpt.ocoPLCommon
oPaperless.sFormPrintUISelection = "7" ' Number of selection in dropbox on the Sales Order Printing Screen
sName = ""
sDriver = ""
sPrinter = ""
sVersion = ""
retval = oPaperless.nGetPDFConverterInfo(sName, sDriver, sPrinter, sVersion)
nretval = oUI.MessageBox("", "" _
& "PDF Device Info: " & vbcrlf _
& "------------------------" & vbcrlf _
& sName & vbcrlf _
& sDriver & vbcrlf _
& sPrinter & vbcrlf _
& sVersion & vbcrlf _
& "Retval: " & retval)

When the above code is run on a button script, it returns the values in the SOTA.ini file, when ran from an external script, it just returns a couple different characters, i think it was an * and /.

Does anybody have any ideas?

EDIT:

I have confirmed the PDF converter is seen as installed correctly when this script in ran on v2014 advanced running as an application. When ran on v2015 advanced and v2016 advanced, the task does not detect the PDF converter as being installed. I have tried both running as an application and as a service.

Here's a simple script to test this. 

Set oPVXSession = CreateObject ("ProvideX.Script")
oPVXSession.Init("\\SRV2012R2\Sage\Sage 100 Advanced ERP\MAS90\Home")
Set oSS = oPVXSession.NewObject("SY_Session")
Set oUI = oSS.oInitiateUI()
retval = oSS.nSetUser("user", "password")
sCompanyCode = "ABC"
sModuleCode = "S/O"
sModuleDate = "20161228"
retval = oSS.nSetCompany(sCompanyCode)
retval = oSS.nSetDate(sModuleCode, sModuleDate)
retval = oSS.nSetModule(sModuleCode)
oSS.nSetProgram(oSS.nLookupTask("PL_AdvancedOptions_Ui"))
Set oSO_InvoicePrinting_ui = oSS.oGetObject("PL_AdvancedOptions_Ui")
retval = oSO_InvoicePrinting_ui.nProcess()