digitalmars.D - Windows ole word automatism
- Gregor Kopp (23/23) Nov 14 2006 Hi guys !
- BLS (8/40) Nov 14 2006 Hi Gregor,
- JohnC (6/46) Nov 14 2006 You're better off using early binding than late binding. It's faster and...
- Gregor Kopp (16/24) Nov 15 2006 Hm. I played around with it now for several hours. With Tlbimpd I always...
- JohnC (41/56) Nov 15 2006 Sorry it's not documented. I'm readying a new release of my Juno library...
- Gregor Kopp (51/132) Nov 15 2006 Hi JohnC,
- Gregor Kopp (5/159) Nov 15 2006 I went to another computer with Windows XP, and there it generated the d...
- JohnC (47/179) Nov 15 2006 sqlite3.dll doesn't contain a COM type library! Try something like
- Gregor Kopp (8/89) Nov 15 2006 I have only one last question (hope so).
- Gregor Richards (3/35) Nov 14 2006 Oh no, another Gregor! Oh, the confusion that will ensue!
- Gregor Kopp (10/49) Nov 15 2006 Thank you all for the tipps ;)
Hi guys ! I'm fresh to D and really happy about the easy syntax compared to C++. I would like to do automation with winword on my job here. First of all, a little Ruby code, so that you can see what I mean: Code starts here: require "win32ole" word.documents.add(File.expand_path("myownfiletemplate.dot")) word.Visible = 1 word.selection.find.text = "Text to Search" word.selection.find.execute word.selection.typetext "Replaced by this Text" Code ends here Das a similiar lib (like this win32ole lib from ruby) exist for the D language? I also tried to work with dfl it does have a module named dfl.wincom, but there is no usable documentation about it, and I really don't know if its the right module. Greets, Gregor
Nov 14 2006
Hi Gregor, Have a look at the dmd samples directory. dclient.d As far as I can see your ruby sample is a typical late binding scenario. D can do more, or, in other words D can do what C++ can do, but in a readable way. Have a look at the JUNO tool chain at dsource.org ... projects JUNO. Björn // btw : dsource is not avail. at the moment. Gregor Kopp schrieb:Hi guys ! I'm fresh to D and really happy about the easy syntax compared to C++. I would like to do automation with winword on my job here. First of all, a little Ruby code, so that you can see what I mean: Code starts here: require "win32ole" word.documents.add(File.expand_path("myownfiletemplate.dot")) word.Visible = 1 word.selection.find.text = "Text to Search" word.selection.find.execute word.selection.typetext "Replaced by this Text" Code ends here Das a similiar lib (like this win32ole lib from ruby) exist for the D language? I also tried to work with dfl it does have a module named dfl.wincom, but there is no usable documentation about it, and I really don't know if its the right module. Greets, Gregor
Nov 14 2006
"BLS" <Killing_Zoe web.de> wrote in message news:ejd1g9$2g0c$1 digitaldaemon.com...Hi Gregor, Have a look at the dmd samples directory. dclient.d As far as I can see your ruby sample is a typical late binding scenario. D can do more, or, in other words D can do what C++ can do, but in a readable way. Have a look at the JUNO tool chain at dsource.org ... projects JUNO. Björn // btw : dsource is not avail. at the moment. Gregor Kopp schrieb:You're better off using early binding than late binding. It's faster and a lot easier to use. You'll first need to translate the msword.olb type library to a D module. Tlbimpd should help you with that (look for Juno on DSource). Or use OleView and do it by hand.Hi guys ! I'm fresh to D and really happy about the easy syntax compared to C++. I would like to do automation with winword on my job here. First of all, a little Ruby code, so that you can see what I mean: Code starts here: require "win32ole" word.documents.add(File.expand_path("myownfiletemplate.dot")) word.Visible = 1 word.selection.find.text = "Text to Search" word.selection.find.execute word.selection.typetext "Replaced by this Text" Code ends here Das a similiar lib (like this win32ole lib from ruby) exist for the D language? I also tried to work with dfl it does have a module named dfl.wincom, but there is no usable documentation about it, and I really don't know if its the right module. Greets, Gregor
Nov 14 2006
Hm. I played around with it now for several hours. With Tlbimpd I always get an access violation, i dont know why. But I must say, that I don't know if I did it the right way. I seems that ive always the poor stupid guy who does always wants to learn something about new technologies and always gets undocumented pieces of software :( Its really annoying. I thought about using OleView and do it by hand about 2 seconds ;) Im a Noob about such things, I think I need 3-4 years of experience before I know what I'm doing with that *g* Anyway, enough mimimimi... Can anyone tell me what I could do to reach my goal? I would be really be sad if i have to drop my interest on D because the lack of my knowledge about windows programming. But maybe Im just to dump to use Tlbimpd :/ I don't know... JohnC schrieb:You're better off using early binding than late binding. It's faster and a lot easier to use. You'll first need to translate the msword.olb type library to a D module. Tlbimpd should help you with that (look for Juno on DSource). Or use OleView and do it by hand.
Nov 15 2006
"Gregor Kopp" <gk cutcopy.com> wrote in message news:ejepvc$1h3m$1 digitaldaemon.com...Hm. I played around with it now for several hours. With Tlbimpd I always get an access violation, i dont know why. But I must say, that I don't know if I did it the right way. I seems that ive always the poor stupid guy who does always wants to learn something about new technologies and always gets undocumented pieces of software :( Its really annoying.Sorry it's not documented. I'm readying a new release of my Juno library and related tools, and will provide documentation this time around. It should be done by late December. For now, get the latest test version of tlbimpd from http://wwwpaperocean.org/d/tlbimpd.zip. The /? switch on the command line explains the various options. Tlbimpd attempts to generate a D source module from a COM type library. It doesn't work on every type library yet. And when it does work you might need to tweak the generated files to get them to compile. I just ran this version of tlbimpd on msword.olb, and it generated word.d without any errors. Here's what you need to do to get Word automation working: 1) Run tlbimpd (the latest version from the above link) on msword.olb, mso.dll and vbe6ext.olb. I had to search my system for vbe6ext.olb. It was buried in a CAB file - if that's the same for you, copy it to another location before using tlbimpd on it. 2) Download http://www.paperocean.org/d/comtest.zip and use the com module from there instead of the one from Juno. 3) Import the resulting "office" and "vbide" modules into word.d, like this: private import com, office, vbide; Import the "office" module into vbide.d. 4) office.d requires IPictureDisp, which isn't defined in the included com module (I'll add it in the next release) so add the following lines to the bottom of the "com" module: interface IPictureDisp : IDispatch { static GUID IID = { 0x7BF80981, 0xBF32, 0x101A, 0x8B, 0xBB, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB }; } 5) Try to compile everything, using DMD. You'll get a few errors saying something like "Range is used as a type". This means that Range is defined as a type but is also the name of a function, and they clash. So just go through them in turn and prefix the function names where the errors occur with "get_". For example change the function named Range to get_Range. After following these steps, it should all compile. I know I said it was easier to use early binding rather than late binding, and while this may make you think otherwise, it'll save you a lot of work in the long run.I thought about using OleView and do it by hand about 2 seconds ;) Im a Noob about such things, I think I need 3-4 years of experience before I know what I'm doing with that *g* Anyway, enough mimimimi... Can anyone tell me what I could do to reach my goal? I would be really be sad if i have to drop my interest on D because the lack of my knowledge about windows programming. But maybe Im just to dump to use Tlbimpd :/ I don't know...If you follow the guidance above, you shouldn't need to drop either.
Nov 15 2006
Hi JohnC, thank you very very much for your time and helping. I downloaded your new version of Tlbimpd, found the 3 named files and now im stucking again with Tlbimpd (step 1). But i don not know what I can do. I tried tlbimpd with the options, without the options, with full path in \ and / notation, a always get the Access Violation on all 3 files. I too tried, just to find out how, to generate it with the sqlite3.dll to see if it is tlbimpd, or me but here tlbimpd says, that he cannot open the dll file. Could it be, that tlbimpd don't do the job on a Windows 2000? tlbimpd.exe is stored in my c:/dmd/bin directory wich is in my PATH Variable, if that helps. Whatever i try to do with it, here is an example output: C:\Documents and Settings\gk>f: F:\>cd \dfiles\mswordolb F:\dfiles\mswordolb>dir Volume in drive F is Daten Volume Serial Number is 6833-CBCE Directory of F:\dfiles\mswordolb 11/15/2006 02:13p <DIR> . 11/15/2006 02:13p <DIR> .. 09/01/2006 03:02p 9,816,840 MSO.DLL 02/19/2001 08:12p 626,688 MSWORD.OLB 01/22/2001 06:39p 45,056 VBE6EXT.OLB 3 File(s) 10,488,584 bytes 2 Dir(s) 928,391,168 bytes free F:\dfiles\mswordolb>tlbimpd /? Type Library to D Module Converter 1.0 Syntax: tlbimpd TypeLibName [Options] Options: /comments Adds documentation as comments /noblanks Omits blank lines between members /noenums Prevents generating named enums /nologo Omits display of logo /silent Suppresses all output except errors /tabs Indents new lines with tabs instead of spaces /indent:indentCount Indents new lines with the specified number of spaces /braces:newLine Places braces on a new line /module:moduleName Name of module to be produced /out:fileName File name of module to be produced /propget:prefix Prefix to use for property getters /propput:prefix Prefix to use for property setters /unnamed:value Value for unnamed parameters /order:verbatim Generate types in original order /? or /help Displays this usage message F:\dfiles\mswordolb>tlbimpd MSWORD.OLB /module:msword /out:msword.d Type Library to D Module Converter 1.0 Access Violation F:\dfiles\mswordolb> JohnC schrieb:"Gregor Kopp" <gk cutcopy.com> wrote in message news:ejepvc$1h3m$1 digitaldaemon.com...Hm. I played around with it now for several hours. With Tlbimpd I always get an access violation, i dont know why. But I must say, that I don't know if I did it the right way. I seems that ive always the poor stupid guy who does always wants to learn something about new technologies and always gets undocumented pieces of software :( Its really annoying.Sorry it's not documented. I'm readying a new release of my Juno library and related tools, and will provide documentation this time around. It should be done by late December. For now, get the latest test version of tlbimpd from http://wwwpaperocean.org/d/tlbimpd.zip. The /? switch on the command line explains the various options. Tlbimpd attempts to generate a D source module from a COM type library. It doesn't work on every type library yet. And when it does work you might need to tweak the generated files to get them to compile. I just ran this version of tlbimpd on msword.olb, and it generated word.d without any errors. Here's what you need to do to get Word automation working: 1) Run tlbimpd (the latest version from the above link) on msword.olb, mso.dll and vbe6ext.olb. I had to search my system for vbe6ext.olb. It was buried in a CAB file - if that's the same for you, copy it to another location before using tlbimpd on it. 2) Download http://www.paperocean.org/d/comtest.zip and use the com module from there instead of the one from Juno. 3) Import the resulting "office" and "vbide" modules into word.d, like this: private import com, office, vbide; Import the "office" module into vbide.d. 4) office.d requires IPictureDisp, which isn't defined in the included com module (I'll add it in the next release) so add the following lines to the bottom of the "com" module: interface IPictureDisp : IDispatch { static GUID IID = { 0x7BF80981, 0xBF32, 0x101A, 0x8B, 0xBB, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB }; } 5) Try to compile everything, using DMD. You'll get a few errors saying something like "Range is used as a type". This means that Range is defined as a type but is also the name of a function, and they clash. So just go through them in turn and prefix the function names where the errors occur with "get_". For example change the function named Range to get_Range. After following these steps, it should all compile. I know I said it was easier to use early binding rather than late binding, and while this may make you think otherwise, it'll save you a lot of work in the long run.I thought about using OleView and do it by hand about 2 seconds ;) Im a Noob about such things, I think I need 3-4 years of experience before I know what I'm doing with that *g* Anyway, enough mimimimi... Can anyone tell me what I could do to reach my goal? I would be really be sad if i have to drop my interest on D because the lack of my knowledge about windows programming. But maybe Im just to dump to use Tlbimpd :/ I don't know...If you follow the guidance above, you shouldn't need to drop either.
Nov 15 2006
I went to another computer with Windows XP, and there it generated the d files! It seems, that its really a Windows2000 or Windows XP issue! And i thought im a jerky jerk *hrhr* I keep you informed about my future experience about it. Gregor Kopp schrieb:Hi JohnC, thank you very very much for your time and helping. I downloaded your new version of Tlbimpd, found the 3 named files and now im stucking again with Tlbimpd (step 1). But i don not know what I can do. I tried tlbimpd with the options, without the options, with full path in \ and / notation, a always get the Access Violation on all 3 files. I too tried, just to find out how, to generate it with the sqlite3.dll to see if it is tlbimpd, or me but here tlbimpd says, that he cannot open the dll file. Could it be, that tlbimpd don't do the job on a Windows 2000? tlbimpd.exe is stored in my c:/dmd/bin directory wich is in my PATH Variable, if that helps. Whatever i try to do with it, here is an example output: C:\Documents and Settings\gk>f: F:\>cd \dfiles\mswordolb F:\dfiles\mswordolb>dir Volume in drive F is Daten Volume Serial Number is 6833-CBCE Directory of F:\dfiles\mswordolb 11/15/2006 02:13p <DIR> . 11/15/2006 02:13p <DIR> .. 09/01/2006 03:02p 9,816,840 MSO.DLL 02/19/2001 08:12p 626,688 MSWORD.OLB 01/22/2001 06:39p 45,056 VBE6EXT.OLB 3 File(s) 10,488,584 bytes 2 Dir(s) 928,391,168 bytes free F:\dfiles\mswordolb>tlbimpd /? Type Library to D Module Converter 1.0 Syntax: tlbimpd TypeLibName [Options] Options: /comments Adds documentation as comments /noblanks Omits blank lines between members /noenums Prevents generating named enums /nologo Omits display of logo /silent Suppresses all output except errors /tabs Indents new lines with tabs instead of spaces /indent:indentCount Indents new lines with the specified number of spaces /braces:newLine Places braces on a new line /module:moduleName Name of module to be produced /out:fileName File name of module to be produced /propget:prefix Prefix to use for property getters /propput:prefix Prefix to use for property setters /unnamed:value Value for unnamed parameters /order:verbatim Generate types in original order /? or /help Displays this usage message F:\dfiles\mswordolb>tlbimpd MSWORD.OLB /module:msword /out:msword.d Type Library to D Module Converter 1.0 Access Violation F:\dfiles\mswordolb> JohnC schrieb:"Gregor Kopp" <gk cutcopy.com> wrote in message news:ejepvc$1h3m$1 digitaldaemon.com...Hm. I played around with it now for several hours. With Tlbimpd I always get an access violation, i dont know why. But I must say, that I don't know if I did it the right way. I seems that ive always the poor stupid guy who does always wants to learn something about new technologies and always gets undocumented pieces of software :( Its really annoying.Sorry it's not documented. I'm readying a new release of my Juno library and related tools, and will provide documentation this time around. It should be done by late December. For now, get the latest test version of tlbimpd from http://wwwpaperocean.org/d/tlbimpd.zip. The /? switch on the command line explains the various options. Tlbimpd attempts to generate a D source module from a COM type library. It doesn't work on every type library yet. And when it does work you might need to tweak the generated files to get them to compile. I just ran this version of tlbimpd on msword.olb, and it generated word.d without any errors. Here's what you need to do to get Word automation working: 1) Run tlbimpd (the latest version from the above link) on msword.olb, mso.dll and vbe6ext.olb. I had to search my system for vbe6ext.olb. It was buried in a CAB file - if that's the same for you, copy it to another location before using tlbimpd on it. 2) Download http://www.paperocean.org/d/comtest.zip and use the com module from there instead of the one from Juno. 3) Import the resulting "office" and "vbide" modules into word.d, like this: private import com, office, vbide; Import the "office" module into vbide.d. 4) office.d requires IPictureDisp, which isn't defined in the included com module (I'll add it in the next release) so add the following lines to the bottom of the "com" module: interface IPictureDisp : IDispatch { static GUID IID = { 0x7BF80981, 0xBF32, 0x101A, 0x8B, 0xBB, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB }; } 5) Try to compile everything, using DMD. You'll get a few errors saying something like "Range is used as a type". This means that Range is defined as a type but is also the name of a function, and they clash. So just go through them in turn and prefix the function names where the errors occur with "get_". For example change the function named Range to get_Range. After following these steps, it should all compile. I know I said it was easier to use early binding rather than late binding, and while this may make you think otherwise, it'll save you a lot of work in the long run.I thought about using OleView and do it by hand about 2 seconds ;) Im a Noob about such things, I think I need 3-4 years of experience before I know what I'm doing with that *g* Anyway, enough mimimimi... Can anyone tell me what I could do to reach my goal? I would be really be sad if i have to drop my interest on D because the lack of my knowledge about windows programming. But maybe Im just to dump to use Tlbimpd :/ I don't know...If you follow the guidance above, you shouldn't need to drop either.
Nov 15 2006
"Gregor Kopp" <gk cutcopy.com> wrote in message news:ejf52t$1t2q$1 digitaldaemon.com...Hi JohnC, thank you very very much for your time and helping. I downloaded your new version of Tlbimpd, found the 3 named files and now im stucking again with Tlbimpd (step 1). But i don not know what I can do. I tried tlbimpd with the options, without the options, with full path in \ and / notation, a always get the Access Violation on all 3 files. I too tried, just to find out how, to generate it with the sqlite3.dll to see if it is tlbimpd, or me but here tlbimpd says, that he cannot open the dll file. Could it be, that tlbimpd don't do the job on a Windows 2000?sqlite3.dll doesn't contain a COM type library! Try something like msxml4.dll instead. I have no way of testing on operating systems other than XP, but I don't think there's anything in the program that would prevent it from working on Windows 2000. Just tried it on each of my XP machines in Windows 2000 compatibility mode, and it worked fine. See my further comments below...tlbimpd.exe is stored in my c:/dmd/bin directory wich is in my PATH Variable, if that helps. Whatever i try to do with it, here is an example output: C:\Documents and Settings\gk>f: F:\>cd \dfiles\mswordolb F:\dfiles\mswordolb>dir Volume in drive F is Daten Volume Serial Number is 6833-CBCE Directory of F:\dfiles\mswordolb 11/15/2006 02:13p <DIR> . 11/15/2006 02:13p <DIR> .. 09/01/2006 03:02p 9,816,840 MSO.DLL 02/19/2001 08:12p 626,688 MSWORD.OLB 01/22/2001 06:39p 45,056 VBE6EXT.OLB 3 File(s) 10,488,584 bytes 2 Dir(s) 928,391,168 bytes free F:\dfiles\mswordolb>tlbimpd /? Type Library to D Module Converter 1.0 Syntax: tlbimpd TypeLibName [Options] Options: /comments Adds documentation as comments /noblanks Omits blank lines between members /noenums Prevents generating named enums /nologo Omits display of logo /silent Suppresses all output except errors /tabs Indents new lines with tabs instead of spaces /indent:indentCount Indents new lines with the specified number of spaces /braces:newLine Places braces on a new line /module:moduleName Name of module to be produced /out:fileName File name of module to be produced /propget:prefix Prefix to use for property getters /propput:prefix Prefix to use for property setters /unnamed:value Value for unnamed parameters /order:verbatim Generate types in original order /? or /help Displays this usage message F:\dfiles\mswordolb>tlbimpd MSWORD.OLB /module:msword /out:msword.d Type Library to D Module Converter 1.0 Access Violation F:\dfiles\mswordolb>I don't think you're doing anything wrong. So it's running on Windows 2000, but there's clearly a bug in tlbimpd that's causing an access violation. Well, it is untested pre-beta software, so things will go wrong. I've generated the word, office and vbide modules for you so that you can get started. Just add the IPictureDisp definition as described earlier, and you should be good to go. http://www.paperocean.org/d/mso.zip Here's some code (untested and without error checking) that creates a Word object: import com, office, word; void main() { _Application application = Application.coCreate!(_Application)(CoClassContext.LocalServer); Documents documents; application.get_Documents(documents); VARIANT empty; // for empty arguments VARIANT templateName = VARIANT("template.dot"); Document templateDoc; documents.Add(&templateName, &empty, &empty, templateDoc); templateName.clear(); application.set_Visible(VARIANT_TRUE); Selection selection; application.get_Selection(selection); Find find; selection.get_Find(find); wchar* text = utf8ToBstr("find this text"); find.set_Text(text); freeBstr(text); short dummy; find.Execute(&empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, &empty, dummy); // And so on... // release our COM objects. find.Release(); selection.Release(); templateDoc.Release(); documents.Release(); application.Release(); }JohnC schrieb:"Gregor Kopp" <gk cutcopy.com> wrote in message news:ejepvc$1h3m$1 digitaldaemon.com...Hm. I played around with it now for several hours. With Tlbimpd I always get an access violation, i dont know why. But I must say, that I don't know if I did it the right way. I seems that ive always the poor stupid guy who does always wants to learn something about new technologies and always gets undocumented pieces of software :( Its really annoying.Sorry it's not documented. I'm readying a new release of my Juno library and related tools, and will provide documentation this time around. It should be done by late December. For now, get the latest test version of tlbimpd from http://wwwpaperocean.org/d/tlbimpd.zip. The /? switch on the command line explains the various options. Tlbimpd attempts to generate a D source module from a COM type library. It doesn't work on every type library yet. And when it does work you might need to tweak the generated files to get them to compile. I just ran this version of tlbimpd on msword.olb, and it generated word.d without any errors. Here's what you need to do to get Word automation working: 1) Run tlbimpd (the latest version from the above link) on msword.olb, mso.dll and vbe6ext.olb. I had to search my system for vbe6ext.olb. It was buried in a CAB file - if that's the same for you, copy it to another location before using tlbimpd on it. 2) Download http://www.paperocean.org/d/comtest.zip and use the com module from there instead of the one from Juno. 3) Import the resulting "office" and "vbide" modules into word.d, like this: private import com, office, vbide; Import the "office" module into vbide.d. 4) office.d requires IPictureDisp, which isn't defined in the included com module (I'll add it in the next release) so add the following lines to the bottom of the "com" module: interface IPictureDisp : IDispatch { static GUID IID = { 0x7BF80981, 0xBF32, 0x101A, 0x8B, 0xBB, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB }; } 5) Try to compile everything, using DMD. You'll get a few errors saying something like "Range is used as a type". This means that Range is defined as a type but is also the name of a function, and they clash. So just go through them in turn and prefix the function names where the errors occur with "get_". For example change the function named Range to get_Range. After following these steps, it should all compile. I know I said it was easier to use early binding rather than late binding, and while this may make you think otherwise, it'll save you a lot of work in the long run.I thought about using OleView and do it by hand about 2 seconds ;) Im a Noob about such things, I think I need 3-4 years of experience before I know what I'm doing with that *g* Anyway, enough mimimimi... Can anyone tell me what I could do to reach my goal? I would be really be sad if i have to drop my interest on D because the lack of my knowledge about windows programming. But maybe Im just to dump to use Tlbimpd :/ I don't know...If you follow the guidance above, you shouldn't need to drop either.
Nov 15 2006
I have only one last question (hope so). I went now from 1 to 5, i got my files - i think all is correctly done. If you have some sparetime, can you post me a really small example how to use the resulting files? Maybe only start a Word, Insert "Hello World" and quit the program? Thank you very much in advance, it would be a great help to avoid further headache *g* JohnC schrieb:"Gregor Kopp" <gk cutcopy.com> wrote in message news:ejepvc$1h3m$1 digitaldaemon.com...Hm. I played around with it now for several hours. With Tlbimpd I always get an access violation, i dont know why. But I must say, that I don't know if I did it the right way. I seems that ive always the poor stupid guy who does always wants to learn something about new technologies and always gets undocumented pieces of software :( Its really annoying.Sorry it's not documented. I'm readying a new release of my Juno library and related tools, and will provide documentation this time around. It should be done by late December. For now, get the latest test version of tlbimpd from http://wwwpaperocean.org/d/tlbimpd.zip. The /? switch on the command line explains the various options. Tlbimpd attempts to generate a D source module from a COM type library. It doesn't work on every type library yet. And when it does work you might need to tweak the generated files to get them to compile. I just ran this version of tlbimpd on msword.olb, and it generated word.d without any errors. Here's what you need to do to get Word automation working: 1) Run tlbimpd (the latest version from the above link) on msword.olb, mso.dll and vbe6ext.olb. I had to search my system for vbe6ext.olb. It was buried in a CAB file - if that's the same for you, copy it to another location before using tlbimpd on it. 2) Download http://www.paperocean.org/d/comtest.zip and use the com module from there instead of the one from Juno. 3) Import the resulting "office" and "vbide" modules into word.d, like this: private import com, office, vbide; Import the "office" module into vbide.d. 4) office.d requires IPictureDisp, which isn't defined in the included com module (I'll add it in the next release) so add the following lines to the bottom of the "com" module: interface IPictureDisp : IDispatch { static GUID IID = { 0x7BF80981, 0xBF32, 0x101A, 0x8B, 0xBB, 0x00, 0xAA, 0x00, 0x30, 0x0C, 0xAB }; } 5) Try to compile everything, using DMD. You'll get a few errors saying something like "Range is used as a type". This means that Range is defined as a type but is also the name of a function, and they clash. So just go through them in turn and prefix the function names where the errors occur with "get_". For example change the function named Range to get_Range. After following these steps, it should all compile. I know I said it was easier to use early binding rather than late binding, and while this may make you think otherwise, it'll save you a lot of work in the long run.I thought about using OleView and do it by hand about 2 seconds ;) Im a Noob about such things, I think I need 3-4 years of experience before I know what I'm doing with that *g* Anyway, enough mimimimi... Can anyone tell me what I could do to reach my goal? I would be really be sad if i have to drop my interest on D because the lack of my knowledge about windows programming. But maybe Im just to dump to use Tlbimpd :/ I don't know...If you follow the guidance above, you shouldn't need to drop either.
Nov 15 2006
"Gregor Kopp" <gk cutcopy.com> wrote in message news:ejf7nl$1vog$1 digitaldaemon.com...I have only one last question (hope so). I went now from 1 to 5, i got my files - i think all is correctly done. If you have some sparetime, can you post me a really small example how to use the resulting files? Maybe only start a Word, Insert "Hello World" and quit the program? Thank you very much in advance, it would be a great help to avoid further headache *g*See my response to your previous post for an example.
Nov 15 2006
== Quote from Gregor Kopp (gk cutcopy.com)'s articleI have only one last question (hope so). I went now from 1 to 5, i got my files - i think all is correctly done. If you have some sparetime, can you post me a really small example how to use the resulting files? Maybe only start a Word, Insert "Hello World" and quit the program? Thank you very much in advance, it would be a great help to avoid further headache *g*I've gotten TLibImpD to create some files on Windows 2000/XP, but most of the time it fails with an "Access Violation". After editing the source code to Juno/TLibImpD, I've been able to make some progress (such as at least getting TLibImpD to generate mostly correct files that just need some hand-editing). But I'm not sure that even that trick helps with the Word header file. I've come up with a few usage tips: http://www.dsource.org/projects/juno/wiki/TypeLibraryImporterTips But that's just a start. There's a lot more that could be said about using TLibImpD and Juno. I could try to help getting you started with Word automation (not that I'm an expert on the topic or anything), but it'd be helpful if you could e-mail the header file that you've managed to create. I've only created and used headers for a few COM libraries such as ADODB, MSScriptControl, and Scripting. By the way, which operating system did you finally manage to get TLibImpD to work on? WindowsME? Windows98?
Nov 15 2006
"jcc7" <technocrat7 gmail.com> wrote in message news:ejfajs$22l3$1 digitaldaemon.com...I've gotten TLibImpD to create some files on Windows 2000/XP, but most of the time it fails with an "Access Violation". After editing the source code to Juno/TLibImpD, I've been able to make some progress (such as at least getting TLibImpD to generate mostly correct files that just need some hand-editing). But I'm not sure that even that trick helps with the Word header file. I've come up with a few usage tips: http://www.dsource.org/projects/juno/wiki/TypeLibraryImporterTipsThanks for doing that.
Nov 15 2006
Gregor Kopp wrote:Hi guys ! I'm fresh to D and really happy about the easy syntax compared to C++. I would like to do automation with winword on my job here. First of all, a little Ruby code, so that you can see what I mean: Code starts here: require "win32ole" word.documents.add(File.expand_path("myownfiletemplate.dot")) word.Visible = 1 word.selection.find.text = "Text to Search" word.selection.find.execute word.selection.typetext "Replaced by this Text" Code ends here Das a similiar lib (like this win32ole lib from ruby) exist for the D language? I also tried to work with dfl it does have a module named dfl.wincom, but there is no usable documentation about it, and I really don't know if its the right module. Greets, GregorOh no, another Gregor! Oh, the confusion that will ensue! - Gregor Richards
Nov 14 2006
Thank you all for the tipps ;) I'll take a look at JUNO, when dsource is online again. Tried the last days to reach that site. But I think it will be back again soon. Hehe, youre not the only Gregor *g* But nevermind, I know lot's of people which don't draw distinctions between Georg and Gregor and THAT is annoying for me. But only a little bit ;) Sorry my english, it isn't my natural language and thank you for your friendly acceptance. Gregor Richards schrieb:Gregor Kopp wrote:Hi guys ! I'm fresh to D and really happy about the easy syntax compared to C++. I would like to do automation with winword on my job here. First of all, a little Ruby code, so that you can see what I mean: Code starts here: require "win32ole" word.documents.add(File.expand_path("myownfiletemplate.dot")) word.Visible = 1 word.selection.find.text = "Text to Search" word.selection.find.execute word.selection.typetext "Replaced by this Text" Code ends here Das a similiar lib (like this win32ole lib from ruby) exist for the D language? I also tried to work with dfl it does have a module named dfl.wincom, but there is no usable documentation about it, and I really don't know if its the right module. Greets, GregorOh no, another Gregor! Oh, the confusion that will ensue! - Gregor Richards
Nov 15 2006