Discussion Topics > Script BASIC

ScriptLess Scripting

(1/1)

John Spikowski:
I wanted to get ScriptBasic to work as my scripting engine for Sage 100 when the Sage Custom Office scripting solution falls short of my needs. I'm still putting the pieces together but here is a few examples I've got working so far. I should be able to create any type of control to script and not just buttons. Sage development personal has cautioned me that my direction may cause issues with existing functionality. I think they also feel better about keeping development within their defined scope.

My focus with Sage 100 is extending it externally without having to be a Master Developer to offer custom solutions.  Sage supports 100 if modifications are done via scripting as they can be turned off and default functionality restored for support debugging if a problem surfaces.

The Test Button attachment calls ScriptBasic as a DLL and runs the messagebox script with whatever Sage 100 variables I chose to pass. (script object, current business object, ...) Since ScriptBasic is seen as a DLL call in the same Windows process as Sage 100, I'm able to pass pointers to object references and use them within a ScriptBasic script.

The Zip Code attachment shows handling a focus event when the user enters an already defined 100 control.

I plan on using this scripting method with projects I do for clients.

ScriptBasic is a great option for external scripting and as a web server getting your business connected to the cloud.

 

John Spikowski:
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.


--- Code: ---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)

--- End code ---

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.


--- Code: Script BASIC ---' 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", mdateCOM::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", :CALLCOM::RELEASE ouiCOM::CBN osession, "DropObject", :CALLCOM::RELEASE osessionCOM::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.

John Spikowski:
Here is an example of creating the Sales Order entry screen in BOI.


--- Code: Script BASIC ---' COM - BOI Sales Order 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, "S/O"mdate = COM::CBN(osession, "sModuleDate", :GET)COM::CBN osession, "nSetDate", :CALL, "S/O", mdateCOM::CBN osession, "nSetProgram", :CALL, COM::CBN(osession, "nLookupTask", :CALL, "SO_SalesOrder_ui")oui = COM::CBN(oscript, "NewObject", :SET, "SO_SalesOrder_ui", osession)COM::CBN(oui, "nProcess", :CALL) COM::CBN oui,"DropObject", :CALLCOM::RELEASE ouiCOM::CBN osession, "DropObject", :CALLCOM::RELEASE osessionCOM::RELEASE oscript 

Navigation

[0] Message Index

Go to full version