Smile package releases

The engine.
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Smile package releases

Post by JRowe »

All I'm seeing is a bunch of headers and a few compiled libs.

Is there a dll release, or a visual studio solution available? Or should I just use the dll that comes with GeNIe?

I'm not so much interested in developing or changing anything in SMILE as I am in using it, and Smilex doesn't work with Unicode, so the COM interface seems to be out of the question.

Thanks!
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Re: Smile package releases

Post by shooltz[BayesFusion] »

The only '.dll release' is the wrapper for .Net. What's your programming environment?
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

I use a windows scripting language called AutoIt. It's capable of using dlls much the same way c and c++ can. It can also use com objects, but AutoIt recently became strictly Unicode, which is what I assume is causing the issues with SmileX.

Is there an easy way to recompile SmileX with Unicode compatibility? Otherwise, I'll have to create a windows dll and expose the functions, which shouldn't be too hard. The source code provided is nicely written. Thanks for the quick reply.
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Post by shooltz[BayesFusion] »

JRowe wrote:I use a windows scripting language called AutoIt. It's capable of using dlls much the same way c and c++ can.
Yes, but it's not going to consume the exported C++ classes (due to decorated names, thiscalls instead of stdcalls, objects passed as arguments - just to name a few problems with that approach).
Is there an easy way to recompile SmileX with Unicode compatibility
SmileX implements IDispatch and uses BSTRs for strings. Is it possible to use AutoIt with BSTRs?
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

I think so. I'm looking at the forums now, if I can't find anything specific, I'll ask. That's the information I needed, I think.
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

I'm passing a valid BSTR object to the com interface, and in turn getting a catastrophic failure.

I use SysAllocString to create a valid BSTR pointing to my filepath (which is valid.)

So, it looks like this:
I initialize the com object

Code: Select all

$Smilex = ObjCreate("SMILEX.SmileXCtrl.1")
Much like VB, I can now access SMILEX methods using the $Smilex object.

I first get a BSTR to pass to ReadFile()

Code: Select all

$hBSTR = DllCall("oleaut32.dll", "hwnd", "SysAllocString", "wstr", "c:/test/Animals.dsl")
I've verified that $hBSTR[0] is indeed a valid BSTR (the function returns an array, in which index[0] contains the result of the dll call). I in turn attempt to pass it to $Smilex.Readfile, like so:

Code: Select all

$Smilex.ReadFile($hBSTR[0])
So, $Smilex.ReadFile() is receiving a BSTR.

Is it expecting a pointer to a BSTR pointer, or a pointer to the text? Passing the BSTR itself doesnt seem to be working.

http://msdn.microsoft.com/en-us/library/ms221458.aspx is where I was shown to create BSTRs.

The error I'm receiving is "catastrophic failure", which I'm assuming just means that whatever the error is, it wasn't specifically handled, so I'm not too worried about that.

Much thanks! Could it be an issue with me having exported a .dsl from Genie 2, instead of using Genie 1?
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

I used a Genie 1 .dsl to the same effect, so I know it's not a version issue, at least.
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Post by shooltz[BayesFusion] »

I suspect it's more general problem with object activation. Can you invoke UpdateBeliefs method before loading the .xdsl or .dsl file?
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

Nope, its crashing on $Smilex.UpdateBeliefs(). I'll work on getting that running first, lol. Thanks for the help, I appreciate it. :)
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Post by shooltz[BayesFusion] »

JRowe wrote:Nope, its crashing on $Smilex.UpdateBeliefs(). I'll work on getting that running first, lol. Thanks for the help, I appreciate it. :)
I checked that with VBScript and AutoIt. AutoIt can create an instance of SMILEX.SmileXCtrl.1, but UpdateBeliefs can't be invoked. VBScript fails to create the object.
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

Is there a working example of Smilex around somewhere? I can't seem to find a complete script, just the snippets in the documentation.
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Post by shooltz[BayesFusion] »

JRowe wrote:Is there a working example of Smilex around somewhere? I can't seem to find a complete script, just the snippets in the documentation.
You can try at http://genie.sis.pitt.edu/SmileX/manual/SmileX_0.html

SmileX is no longer developed. We keep it on the site just for the people who need easy access to SMILE functionality from VBA.
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

I've tested on my systems, and it appears that the Smilex object from the download is broken. The javascript, vbs, and autoit calls to the com object all result in catastrophic failure, from win XP SP3, SP2, and on the Acer netbook. Another guy on the AutoIt forum has the same issues.

VB test:

Code: Select all

Dim Smilex : Set Smilex = CreateObject("SMILEX.SmileXCtrl.1")

Smilex.AboutBox
Set Smilex = Nothing
JS test:

Code: Select all

var Smilex = new ActiveXObject("SMILEX.SmileXCtrl.1")

Smilex.AboutBox()
delete SmileX
Are the sources for the activex control available, or could they be made available for fixing? Failing that, I think I'll have a go at recreating the functionality in a regular c++ dll and calling it from AutoIt.

Thanks again :)
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Post by shooltz[BayesFusion] »

It turns out that the issue is not related to Unicode. SmileX is an ActiveX control and expects to be hosted in proper ActiveX container (so the control initialization is done), not the automation host like scripting engine. However, the fix is quite simple - see http://support.microsoft.com/kb/146120 for boring tech details. New SmileX build is ready for download. I tested it from VBScript, it seems to work fine.
JRowe
Posts: 10
Joined: Sat Oct 17, 2009 5:31 am

Post by JRowe »

You sir, are a wonderful person. As it was my birthday yesterday, I want to thank you very, very much for this present.

Your kung fu is great.

:D
Post Reply