.Net help or COM alternatives?

Boingo oboingo at gmail.com
Thu Mar 29 02:22:37 UTC 2007


Hello all,

With the help of some people on the list, I have made some progress
with using COM automation with Squeak.  I am still stuck with a few
steps, so I asking the list again, to see if anyone can push me in the
right direction.

I am trying to access a particular COM object from Squeak.  Most of
the indicators I can find, say to use it through the .NetBridge.  The
site <http://wiki.squeak.org/squeak/3773> shows how to turn a COM
object into a .Net assembly.  I have done this and that part works
fine.  The documentation for the COM object I am trying to access can
be found at <http://www.sagesoftware.com/education/webinar/MAS90ObjectInterface.pdf>.
 It has code in VBS in the documentation that works.  I also have
sample code in VB and C# that works against the original COM object.
I have the .Net assembly working to a point.  Once I get to a certain
point in the code, I can get no further.  The code is below.

Hopefully someone can nudge me in the right direction, as I have tried
to contact the author, with no success.  Or, alternatively, if anyone
knows a better way to access COM from Squeak, I am all ears.

The code is below, with the part that fails commented.  Thank you in
advance to anyone who can help me out.

-----------------------------------------------------------
companyCode := 'ABC'.
username := 'sup'.
password := 'sup'.
oScript := nil.
oSS := nil.
Transcript clear; cr.
dotNet := DotNet startNew.
dotNet Assembly loadFrom: 'ProvideX.dll'.
oScript := dotNet ScriptClass new.
init := oScript Init: 'C:\Program Files\Sage Software\MAS
90\Version4\MAS90\Home'.
Transcript show: 'State: ',oScript State asString;cr.
oSS := oScript NewObject: 'Sy_Session'.
Transcript show: 'PathSystem: ',oSS sPathSystem;cr.
Transcript show: 'nLogon: ',oSS nLogon asString; cr.
r := oSS nSetUser: username pass: password.
(r = 0)
	ifTrue:
		[Transcript show: 'User set failed: '; show: oSS sLastErrorMsg; cr]
	ifFalse:
		[Transcript show: 'User set: '; show: oSS sUserName; cr].
Transcript show: 'nLogon: ',oSS nLogon asString; cr.
Transcript show: 'nInitialized: ',oSS nInitialized asString; cr.
Transcript show: 'sWorkstationName: ',oSS sWorkstationName; cr.
r := oSS nSetCompany: companyCode.
(r = 0)
	ifTrue:
		[Transcript show: 'Company code failed: '; show: oSS sLastErrorMsg;
show: companyCode; cr]
	ifFalse:
		[Transcript show: 'Company code set: '; show: oSS sCompanyCode; cr].
r := oSS nSetDate: 'G/L' Date: '20070321'.
(r = 0)
	ifTrue:
		[Transcript show: 'Date set failed: '; show: oSS sLastErrorMsg; cr]
	ifFalse:
		[Transcript show: 'Date set.'; cr].
r := oSS nSetModule: 'G/L'.
(r = 0)
	ifTrue:
		[Transcript show: 'Module set failed: '; show: oSS sLastErrorMsg; cr]
	ifFalse:
		[Transcript show: 'Module set.'; cr].

" ************* This line fails with: doesNotUnderstand ***********"
mySecur := oScript NewObject: 'Sy_Security' with: oSS with: 0 .
task := oSS nLookupTask: 'AR_Customer_ui'.
Transcript show: 'LookupTask: ',task asString; cr.

mySecur := oSS nSetProgram: task.
Transcript show: mySecur; cr.
sec := oSS oSecurity.
Transcript show: sec.

z := mySecur RoleList.
x := mySecur nCreateAccess.
Transcript show: x.

r := oSS nCleanUp.
r := oSS DropObject.
Transcript cr.
-----------------------------------------------------------



More information about the Squeak-dev mailing list