After a lot of digging trying to create
iDispatch pointers I could pass to ScriptBasic in a DLL call, it gets pretty ugly and I'm not sure the value created by ProvideX is actually an iDispatch pointer.
DEF OBJECT oSession_Proxy, "*PROXY";ON EVENT FROM oSession_Proxy PROCESS %SYS_SS;DEF OBJECT oSession_Variant, "*VARIANT";oSession_Variant'Val.Put(*oSession_Proxy);MSGBOX STR(oSession_Variant'Val)
See attached for the MSGBOX value.
I'm able to create a Customer Maintenance screen in ScriptBasic using
BOI as if it was created from the 100 launcher. At least in this environment I have iDispatch pointers to all the 100 objects to script the screen in anyway I wish.
' COM - AR_Customer
IMPORT COM.sbi
oscript = COM::CREATE(:SET, "ProvideX.Script")
COM::CBN oScript, "Init", :CALL, "C:\\Sage\\Sage 100 Standard\\MAS90\\Home"
osession = COM::CBN(oscript, "NewObject", :SET, "SY_Session")
COM::CBN osession, "nSetUser", :CALL, "UserID", "Password"
COM::CBN osession, "nsetcompany", :CALL, "ABC"
COM::CBN osession, "nSetModule", :CALL, "A/R"
mdate = COM::CBN(osession, "sModuleDate", :GET)
COM::CBN osession, "nSetDate", :CALL, "A/R", mdate
COM::CBN osession, "nSetProgram", :CALL, COM::CBN(osession, "nLookupTask", :CALL, "AR_Customer_ui")
oui = COM::CBN(oscript, "NewObject", :SET, "AR_Customer_ui", osession)
COM::CBN oui, "nProcess", :CALL, "01MAVRK"
COM::CBN oui,"DropObject", :CALL
COM::RELEASE oui
COM::CBN osession, "DropObject", :CALL
COM::RELEASE osession
COM::RELEASE oscript
I don't give up easy but trying to use ScriptBasic as an internal scripting engine seems like a waste of my time.