On Thu, 26 Sep 2019 at 05:18, tesonep@gmail.com <tesonep@gmail.com> wrote:
Do you have any use case in mind to start working on?
I can suggest something I did in the past (it's the idea behind PlantUML Gizmo). With Roassal, we can generate visualizations (PNG?) that go into a Word document. The source (which is a kind of DSL to produce an image, like PlantUML) can be in a playground. The problem is when you insert the image into word, you can't re-do it unless you have the source, which is in some Pharo image or Git repository... it's nicer to be able to keep the source inside your documentation (Word). So, a use-case would be to automate (with COM) the insertion of the visualization (a morph in the form of a GIF or PNG?) into the currently-open Word document. The Roassal source (DSL, from the playground) would be attached to the image as ALT_TEXT. That way, you could recover the source into Pharo later if/when you want to modify it after it's in your Word document. There would be a complementary function to recover the "selected" image/source from word back into Pharo. This is a rough description I know. I have made a plugin for Word (VSTO, VB.net) that does this using PlantUML.com and it works quite well. But you could easily imagine Pharo/Roassal as the DSL + image generator (it's a little more complex). Maybe not the most interesting use case, but it's something to test out the COM library. The source of the method to replace/insert an image in VB.NET I wrote is here [1] (the context is VSTO, so it's surely different in COM, but it might be useful to someone). Cris [1]: https://github.com/fuhrmanator/plantuml-word-add-in-vsto/blob/6f917e94779a1c...
Thanks, Pablo
On Wed, Sep 25, 2019 at 10:29 PM eftomi <tomaz.turk@ef.uni-lj.si> wrote:
Hi,
I finally got some time to check Pablo's PharoCOM package closely. At
first
I had problems with simple things, like making Word visible with properyNamed:put: (it's frustrating when you see the app on the processes list but you cannot control it :-)) but then I found the reason - it was a tiny detail in Win32VariantBool>>#write:to:, and then - voila!
Here's an example of opening Word for Windows, adding a blank document, typing some text and getting this text back to Pharo:
Ole32Lib uniqueInstance initLibrary. wrd := COMDispatchInstance createInstanceByName: 'Word.Application'. wrd propertyNamed: 'Visible' put: true.
docs := wrd propertyNamed: 'Documents'. docs dispatch: 'Add'.
sel := wrd propertyNamed: 'Selection'. sel dispatch: 'TypeText' withArguments: {'Hello from Pharo!'}.
sel dispatch: 'WholeStory' . Transcript show: (sel propertyNamed: 'Text'); cr.
Another example is with Active Data Objects to get DB access:
conn := COMDispatchInstance createInstanceByName: 'ADODB.Connection' . conn dispatch: 'Open' withArguments: { 'DSN=this; Uid=that; Pwd=theOther;' } . conn propertyNamed: 'State' . --> true! rst := (COMDispatchInstance createInstanceByName: 'ADODB.Recordset') . rst dispatch: 'Open' withArguments: { 'SomeTableName' . conn . 3 . 1 }.
The last line raises an exception because not all of the data types that functions are reporting are implemented yet, as Pablo mentioned in his post.
The package is really nicely prepared. The most impressive is it's reflective capability. My "proof of concept" work with DispHelper library that I mentioned in another forum topic was successful (I can get to the SQL Server :-)), however it's a dead-end regarding the reflection.
I'm very interested in COM implementation since I found Pharo to be very useful as a tool, and since I work in "windowed" environment the COM interaction is crucial to me. I decided to spent my free evenings working on the project finalization. I'm not sure of how long will it take though :-) Pablo, I hope that I can count on your help regarding the questions about the overall architecture that you set.
Is anybody else interested in this? Maybe we can join our efforts.
Best wishes, Tomaz
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
-- Pablo Tesone. tesonep@gmail.com
-- Christopher Fuhrman, P.Eng., PhD *Professeur au Département de génie logiciel et des technologies de l'informationÃTS (Ãcole de technologie supérieure)* http://profs.etsmtl.ca/cfuhrman +1 514 396 8638 *L'ÃTS est une constituante de l'Université du Québec*