Re: C#, Perl and COM objects (PerlNET / Win32::OLE)
Hi Miriam, I wish I could be more helpful, but unfortunately most of the PerlNET expertise here at ActiveState was with my predecessor, and I am still coming up to speed on it. You are probably already aware of it, but I would point you at this old book on PerlNET that may be of some help: http://amzn.com/0130652067 If you could put together a simple test case that demonstrates the problem you're having, I would be happy to take a look at it. --- Andy Grundman Lead Perl Language Developer, ActiveState an...@activestate.com On Thu, Oct 22, 2015 at 5:51 PM, Miriam Heinz <miriam.he...@itk-austria.com> wrote: > Hello! > > > > I’m trying to pass a COM object from C# code to perl. > > At the moment I’m wrapping my perl code with PerlNET and I have defined a > simple subroutine to pass objects from C# to the wrapped perl module. > > It seems that the objects I pass are not recognized as COM objects. > > > > An example: > > In C#, the ScriptControl is used to load a simple class from a file > written in VBScript. > > > > var host = new ScriptControl(); > > host.Language = "VBScript"; > > var text = File.ReadAllText("TestScript.vbs"); > > host.AddCode(text); > > > > dynamic obj = ost.Run("GetTestClass"); > > > > What I get (`obj`) is of type `System.__ComObject`. When I pass it to my > perl/PerlNET assembly and try to call method `Xyz()` in perl I get the > following (runtime) exception: > > > > Can't locate public method Xyz() for System.__ComObject > > > > If, however, I do more or less the same thing in perl, it works. (In the > following case, passing only the contents of my .vbs file as parameter.) > > I can even use the script control : > > > > sub UseScriptControl { > > my ($self, $text, $) = @_; > > my $script = Win32::OLE->new('ScriptControl'); > > $script->{Language} = 'VBScript'; > > $script->AddCode($text); > > my $obj = $script->Run('GetTestClass'); > > > > $obj->Xyz(); > > } > > > > Now, calling `Xyz()` on `obj` works without any problems. > > > > In both cases I use > > use strict; > > use Win32; > > use Win32::OLE::Variant; > > > > > > Now I’m trying to figure out what could cause this problem - and if I can > solve it or if it is an issue related with the wrapping done by PerlNET. > > Or if I can maybe extract some information of the __ComObject for it to be > identified correctly as COM object. > > > > I have to add that I posted on the PDK discussion site too (but didn’t get > any response yet): http://community.activestate.com/node/18247 > > > > > > I would greatly appreciate any help - or advise on where to look further. > > mihe > > > > > > > > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
AW: C#, Perl and COM objects (PerlNET / Win32::OLE)
> Rob (2015-10-23, sisyph...@optusnet.com.au): > This is a very inactive list, and you may well get no helpful response to > your request. thank you for the information regarding this mailing list. I thought I'd start here, as this seems to be a problem closely related to the inner workings of PerlNET (-> ActiveState). > Rob (2015-10-23, sisyph...@optusnet.com.au): > That being the case, I would suggest posting to perlmonks ( > http://www.perlmonks.org/?node=Seekers%20of%20Perl%20Wisdom ). > Another option might be a post to stackoverflow > http://stackoverflow.com/) - which is a forum I haven't tried, but one that > seems to be fairly well attended. > Jason (2015-10-23, kirk...@hotmail.com): >To that end, if you do post the question elsewhere would you post a link to your post back here. I would like to read the resolution. I now added some details to my question at the community site: http://community.activestate.com/node/18247 And additionally posted my question to both PerlMonks and StackOverflow - since I'm not quite sure if this is more a perl or C#/.NET question: PerlMonks: http://www.perlmonks.org/?node_id=1146244 StackOverflow: http://stackoverflow.com/questions/33388853/passing-a-com-object-from-c-shar p-to-perl-using-perlnet --- Some further details: In the meantime I discovered that I can invoke methods on the passed COM (`$obj`) object by using `InvokeMember` of ` System.Type ` which I initially thought didn't work. It does work if I specify *exactly* which overload I want to use and which types I'm passing: use PerlNET qw(typeof); typeof($obj)->InvokeMember("Xyz", PerlNET::enum("System.Reflection.BindingFlags.InvokeMethod"), PerlNET::null("System.Reflection.Binder"), $obj, "System.Object[]"->new()); Using this approach would mean rewriting the whole wrapped perl module. And using this syntax.. Now I am wondering if I am losing both the advantages of the dynamic keyword in .NET 4.0 and the dynamic characteristics of perl (with Win32::OLE) by using PerlNET with COM objects. It seems like my preferred solution boils down to some way of mimicking the behaviour of the `dynamic` keyword in C#/.NET 4.0. Or finding some way of converting the passed COM object to something that will be recognized as compatible with Win32::OLE. Thanks again, Miriam ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: C#, Perl and COM objects (PerlNET / Win32::OLE)
From: Miriam Heinz Sent: Friday, October 23, 2015 8:51 AM To: perl-win32-users@listserv.ActiveState.com Subject: C#, Perl and COM objects (PerlNET / Win32::OLE) > I would greatly appreciate any help - or advise on where to look further. Hi Miriam, This is a very inactive list, and you may well get no helpful response to your request. That being the case, I would suggest posting to perlmonks ( http://www.perlmonks.org/?node=Seekers%20of%20Perl%20Wisdom ). Another option might be a post to stackoverflow http://stackoverflow.com/) - which is a forum I haven't tried, but one that seems to be fairly well attended. Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: C#, Perl and COM objects (PerlNET / Win32::OLE)
You can hear crickets around here for a while now, but I learned so much from the Q on here that I hang around. To that end, if you do post the question elsewhere would you post a link to your post back here. I would like to read the resolution. Thanks,Jason > From: sisyph...@optusnet.com.au > To: miriam.he...@itk-austria.com; perl-win32-users@listserv.ActiveState.com > Subject: Re: C#, Perl and COM objects (PerlNET / Win32::OLE) > Date: Sat, 24 Oct 2015 00:56:19 +1100 > > From: Miriam Heinz > Sent: Friday, October 23, 2015 8:51 AM > To: perl-win32-users@listserv.ActiveState.com > Subject: C#, Perl and COM objects (PerlNET / Win32::OLE) > > > I would greatly appreciate any help - or advise on where to look further. > > Hi Miriam, > > This is a very inactive list, and you may well get no helpful response to > your request. > That being the case, I would suggest posting to perlmonks ( > http://www.perlmonks.org/?node=Seekers%20of%20Perl%20Wisdom ). > Another option might be a post to stackoverflow > http://stackoverflow.com/) - which is a forum I haven't tried, but one that > seems to be fairly well attended. > > Cheers, > Rob > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
C#, Perl and COM objects (PerlNET / Win32::OLE)
Hello! I'm trying to pass a COM object from C# code to perl. At the moment I'm wrapping my perl code with PerlNET and I have defined a simple subroutine to pass objects from C# to the wrapped perl module. It seems that the objects I pass are not recognized as COM objects. An example: In C#, the ScriptControl is used to load a simple class from a file written in VBScript. var host = new ScriptControl(); host.Language = "VBScript"; var text = File.ReadAllText("TestScript.vbs"); host.AddCode(text); dynamic obj = ost.Run("GetTestClass"); What I get (`obj`) is of type `System.__ComObject`. When I pass it to my perl/PerlNET assembly and try to call method `Xyz()` in perl I get the following (runtime) exception: Can't locate public method Xyz() for System.__ComObject If, however, I do more or less the same thing in perl, it works. (In the following case, passing only the contents of my .vbs file as parameter.) I can even use the script control : sub UseScriptControl { my ($self, $text, $) = @_; my $script = Win32::OLE->new('ScriptControl'); $script->{Language} = 'VBScript'; $script->AddCode($text); my $obj = $script->Run('GetTestClass'); $obj->Xyz(); } Now, calling `Xyz()` on `obj` works without any problems. In both cases I use use strict; use Win32; use Win32::OLE::Variant; Now I'm trying to figure out what could cause this problem - and if I can solve it or if it is an issue related with the wrapping done by PerlNET. Or if I can maybe extract some information of the __ComObject for it to be identified correctly as COM object. I have to add that I posted on the PDK discussion site too (but didn't get any response yet): http://community.activestate.com/node/18247 I would greatly appreciate any help - or advise on where to look further. mihe ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE Module - Excel chart Generation Problem
While I don't have your exact setup, this script works fine in perl 5.8 (32-bit), Excel 2003 (32-bit) on Win Server 2003 (32-bit).. Yes, it's a dated config.. But it's running fine for now. As well, I ran this on Win7 (x64), Perl 5.8 (32-bit), Excel 2010 (32-bit). it worked fine again. (Which seems to point to the version of office not being an issue -- 2003 - 2010 should work fine if 2003 and 2010 do. I'd suspect that the Office you have might be 32-bit and you are trying to use Perl64 which may have issues calling a 32-bit object (64-bit calls to a 32-bit COM object) although I can't guarantee that .. I just know that I run into this particualr problem in VBScript unless I use the 32-bit VBScript engine in %SYSTEMROOT%\syswow64\cscript.exe when invoking 32-bit COM objects (like my office apps). If the script you provided is the exact script you used to generate the error, it seems as though it's complaining about this line... Which somewhat points to charting being a suspect for a 32-bit COM object. Line 20 = $Chart-{ChartType} = xlAreaStacked; But again, I've ignored the possibility of Perl having an issue as I don't have v5.16 or perl64 handy to test in your particular config, nor did you tell us if the Office you have is 64 or 32-bit (which would add to the troubleshooting of this issue). FYI and HTH Steven From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of ketan patel Sent: Tuesday, April 09, 2013 2:21 PM To: perl-win32-users@listserv.ActiveState.com Subject: Win32::OLE Module - Excel chart Generation Problem Hello All, I am running following simple script on perl64 to generate chart on excel but I am getting following errors without generating any chart. It opens excel sheet, write data into sheet but no chart. Win32::OLE(0.1709) error 0x80020003: Member not found in PROPERTYPUT ChartType at C:\path\test.pl line 20. Here is my system spec PERL version : Perl 64 v5.16.3 WIN32 OLE : 0.1709 Excel Version : Excel 2007 SP3 Can anyone please give me some input on how I can remove this error and generate chart ? Thank you, ==Script === use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $Excel = Win32::OLE-new(Excel.Application); $Excel-{Visible} = 1; $Win32::OLE::Warn = 3; my $Book = $Excel-Workbooks-Add; my $Sheet = $Book-Worksheets(1); my $Range = $Sheet-Range(A2:C7); $Range-{Value} = [['Delivered', 'En route', 'To be shipped'], [504, 102, 86], [670, 150, 174], [891, 261, 201], [1274, 471, 321], [1563, 536, 241]]; my $Chart = $Excel-Charts-Add; $Chart-{ChartType} = xlAreaStacked; $Chart-SetSourceData({Source = $Range, PlotBy = xlColumns}); $Chart-{HasTitle} = 1; ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE Module - Excel chart Generation Problem
Hello All, I am running following simple script on perl64 to generate chart on excel but I am getting following errors without generating any chart. It opens excel sheet, write data into sheet but no chart. Win32::OLE(0.1709) error 0x80020003: Member not found in PROPERTYPUT ChartType at C:\path\test.pl line 20. Here is my system spec PERL version : Perl 64 v5.16.3 WIN32 OLE : 0.1709 Excel Version : Excel 2007 SP3 Can anyone please give me some input on how I can remove this error and generate chart ? Thank you, ==Script === use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $Excel = Win32::OLE-new(Excel.Application); $Excel-{Visible} = 1; $Win32::OLE::Warn = 3; my $Book = $Excel-Workbooks-Add; my $Sheet = $Book-Worksheets(1); my $Range = $Sheet-Range(A2:C7); $Range-{Value} = [['Delivered', 'En route', 'To be shipped'], [504, 102, 86], [670, 150, 174], [891, 261, 201], [1274, 471, 321], [1563, 536, 241]]; my $Chart = $Excel-Charts-Add; $Chart-{ChartType} = xlAreaStacked; $Chart-SetSourceData({Source = $Range, PlotBy = xlColumns}); $Chart-{HasTitle} = 1; ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: dealing with Win32::OLE in when on non-win32 platforms?
On Fri, Nov 2, 2012 at 2:39 PM, Dave Horner d...@thehorners.com wrote: Hello, I found this address from the following: http://vlsicad.ucsd.edu/Resources/SoftwareLinks/ActivePerl/Perl-Win32/perlwin32faq12.html I am looking for guidance on how to use Win32::OLE qw(in) on multiple platforms. It works fine on windows, but on other platforms, I'd like the code to not be used. I tried using tricks like: eval 'require Win32::OLE qw( in )'; if ($@) { But I am still getting: Array found where operator expected at myscript.pm line 1693, at end of line (Do you need to predeclare in?) Which is coming from the line: my @drivelist=$objnet-EnumNetworkDrives(); foreach my $value (in @drivelist) { inside of the if ($@) { block, which I was hoping wouldn't be compiled and checked on non-win32 platforms. Any suggestions on how I go about defining in or properly conditionally including Win32::OLE and it's in definition. You need to make sure that the Perl compiler understands that 'in' is a function and not a bareword. You can do this by either adding this line to your file (before you make any calls to 'in'): sub in; Or you can write all calls to in() with parenthesis: foreach my $value (in(@drivelist)) { Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE events callback not executed
I'm willing to pay anyone that can make this work. If anyone is interested, send me a personal email. Thanks On Sun, Mar 25, 2012 at 12:52 AM, haratron harat...@gmail.com wrote: I'm so desperate about this. Could anyone at least point in the right direction? Is WithEvents broken? There's the pyTTS module in Python that succeeds in firing the events. Yet I can't figure out how to port it. On Mon, Mar 19, 2012 at 9:46 PM, Howard Tanner tan...@optonline.net wrote: Thanks anyway Jan. -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Jan Dubois Sent: Monday, March 19, 2012 3:45 PM To: 'Howard Tanner'; 'haratron' Cc: perl-win32-users@listserv.activestate.com Subject: RE: Win32::OLE events callback not executed On Mon, 19 Mar 2012, Howard Tanner wrote: I couldn't get any events to be fired either. Perhaps Jan can weigh in since he seems to be around today. Sorry, I don't know _why_ it isn't working, but I've seen others run into the same problem with SAPI. Unfortunately I don't have time to play with SAPI stuff myself, so I won't be able to help much. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE events callback not executed
I'm so desperate about this. Could anyone at least point in the right direction? Is WithEvents broken? There's the pyTTS module in Python that succeeds in firing the events. Yet I can't figure out how to port it. On Mon, Mar 19, 2012 at 9:46 PM, Howard Tanner tan...@optonline.net wrote: Thanks anyway Jan. -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Jan Dubois Sent: Monday, March 19, 2012 3:45 PM To: 'Howard Tanner'; 'haratron' Cc: perl-win32-users@listserv.activestate.com Subject: RE: Win32::OLE events callback not executed On Mon, 19 Mar 2012, Howard Tanner wrote: I couldn't get any events to be fired either. Perhaps Jan can weigh in since he seems to be around today. Sorry, I don't know _why_ it isn't working, but I've seen others run into the same problem with SAPI. Unfortunately I don't have time to play with SAPI stuff myself, so I won't be able to help much. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE events callback not executed
Hello, I want to implement karaoke functionality on my TTS (text to speech) editor. Meaning that I want to highlight words the moment they are spoken by the TTS system. I read that I need to watch for the onWord event. I have the same problem with this person: http://www.mail-archive.com/perl-win32-users@listserv.activestate.com/msg27530.html The callback never gets executed. How can I fix this? Thank you, haratron ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE events callback not executed
From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of haratron Sent: Monday, March 19, 2012 11:21 AM To: perl-win32-users@listserv.ActiveState.com Subject: Win32::OLE events callback not executed Hello, I want to implement karaoke functionality on my TTS (text to speech) editor. Meaning that I want to highlight words the moment they are spoken by the TTS system. I read that I need to watch for the onWord event. I have the same problem with this person: http://www.mail-archive.com/perl-win32-users@listserv.activestate.com/msg275 30.html The callback never gets executed. How can I fix this? Thank you, haratron ___ Here's the dox from M$ on the Word event: http://msdn.microsoft.com/en-us/library/ms723593(v=vs.85).aspx It includes a VB example that does exactly what you want. Perhaps someone here better at Perl than me can help you translate it. I don't know where Mr. James Brown got his ordinal from, but I suspect the number 32, if that's correct at all, will be O/S version dependent, since different versions of Windows have slightly different versions of SAPI. Perhaps there's a better way in Perl to trap the Word event than using the ordinal. And note that the event is Word, not onWord. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE events callback not executed
I couldn't get any events to be fired either. Perhaps Jan can weigh in since he seems to be around today. Here's my test code: use strict; use Win32::OLE qw(EVENTS); my $vox = Win32::OLE-new ('SAPI.SpVoice') || die Unable to create SAPI object\n; sub Event { my ($Obj, $Event, @Args) = @_; print Event: $Event\n; } Win32::OLE-WithEvents ($vox, \Event); $vox-{'EventInterests'} = 32; #Fire only new word events my $text = This is the Microsoft Speech Library.; $vox-Speak ($text, 1); #Read text asynchronously Win32::OLE-MessageLoop (); -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of haratron Sent: Monday, March 19, 2012 1:54 PM To: Howard Tanner Cc: perl-win32-users@listserv.activestate.com Subject: Re: Win32::OLE events callback not executed Thanks for the answer. I've also found these links that can help maybe: http://code.activestate.com/lists/activeperl/13161/ -- tried it, callback still doesn't get executed http://www.perlmonks.org/?node_id=429272 -- tried it, doesn't work I'm finding it difficult to translate that VB code to Perl. If anyone can help, much appreciated. On Mon, Mar 19, 2012 at 7:01 PM, Howard Tanner tan...@optonline.net wrote: From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of haratron Sent: Monday, March 19, 2012 11:21 AM To: perl-win32-users@listserv.ActiveState.com Subject: Win32::OLE events callback not executed Hello, I want to implement karaoke functionality on my TTS (text to speech) editor. Meaning that I want to highlight words the moment they are spoken by the TTS system. I read that I need to watch for the onWord event. I have the same problem with this person: http://www.mail-archive.com/perl-win32-users@listserv.activestate.com/ msg275 30.html The callback never gets executed. How can I fix this? Thank you, haratron ___ Here's the dox from M$ on the Word event: http://msdn.microsoft.com/en-us/library/ms723593(v=vs.85).aspx It includes a VB example that does exactly what you want. Perhaps someone here better at Perl than me can help you translate it. I don't know where Mr. James Brown got his ordinal from, but I suspect the number 32, if that's correct at all, will be O/S version dependent, since different versions of Windows have slightly different versions of SAPI. Perhaps there's a better way in Perl to trap the Word event than using the ordinal. And note that the event is Word, not onWord. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE events callback not executed
On Mon, 19 Mar 2012, Howard Tanner wrote: I couldn't get any events to be fired either. Perhaps Jan can weigh in since he seems to be around today. Sorry, I don't know _why_ it isn't working, but I've seen others run into the same problem with SAPI. Unfortunately I don't have time to play with SAPI stuff myself, so I won't be able to help much. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE
Try this: http://stackoverflow.com/questions/837754/call-routine-in-access-module-from-net On Wed, Jun 29, 2011 at 10:19 AM, John Harrington bearti...@gmail.com wrote: Hi Leo, Thanks for this. I tried this script on one of the machines that wasn't working yesterday and received only this error: Last OLE32 error: Win32::OLE(0.1709) error 0x800a9d9f in METHOD/PROPERTYGET Run Any suggestions? So far I've tried automation on four separate machines: All with Access 2007 12.0.6535.5005 SP2 MSO 12.0.6554.5001 OS bits Perl version Works? XP 32 5.10.1 yes XP 32 5.12.4 no W7 64 5.12.4 yes W7? 64? 5.10.1 no I believe OS, bits, Perl version, and Access version can be ruled out as the explanation. Thank you again, John On Tue, Jun 28, 2011 at 5:35 PM, Leo Susanto leosusa...@gmail.com wrote: Thank, so Access 2007 is installed in all of the machine Could you please run this and see if there is any error? use strict; use warnings; use Win32::OLE; my $oAccess; eval {$oAccess = Win32::OLE-GetActiveObject(Access.Application)}; if ($@) { die Access.Application is not installed\n; } unless (defined $oAccess) { unless ($oAccess = Win32::OLE-new(Access.Application, sub {$_[0]-Quit;})) { die Can not start Access.Application\n; } } $oAccess-OpenCurrentDatabase(C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb); print Last OLE32 error: . Win32::OLE-LastError() if (Win32::OLE-LastError()); $oAccess-Run(AutomationTest); print Last OLE32 error: . Win32::OLE-LastError() if (Win32::OLE-LastError()); On Tue, Jun 28, 2011 at 4:36 PM, John Harrington bearti...@gmail.com wrote: I have a very simple script using Win32::OLE that works perfectly on my machine but not on other people's machines and I can't figure out why. The script is as follows: use strict; use warnings; use Win32::OLE; my $oAccess; $oAccess = Win32::OLE-new('Access.Application') or die Unable to start Access; $oAccess-OpenCurrentDatabase(C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb); $oAccess-Run(AutomationTest) When I run it on my machine, it successfully runs a Public Function called AutomationTest in my database. This function writes two files to the cwd, a text file and a simple Excel spreadsheet. When I run this script on other people's machines, the script executes (same OS, same version of ActiveState Perl (5.10.1), same database, same permissions) but the files are not written, which suggests the automation is not working. No errors are generated. The script runs, but there are no files produced. Again, it works on my machine, not on theirs, with apparently the very same conditions. I even tried sharing my Perl folder so another user could be assured he was running the same version of the module and Perl. I am at my wit's end. Any help would be appreciated. Can you think of any reason such a simple application of the Win32::OLE module would work on one machine and not on another? Thanks, John ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE
Hi Leo, Yes, it turns out the security setting is the issue. On machines where this didn't work, the security settings were different than on the machines where it did work. Thank you very much for your help with this puzzling issue. It is very much appreciated. For any other users who may find this thread on Google, it was necessary to modify the Access security settings to get automation to run. To do that in Access 2007: 1. Open Access. 2. Click the Office button (the circle in the extreme upper right). 3. Select the Access Options... button. 4. On the Access Options dialog, click Trust Center. 5. Click Trust Center Settings 6. On the Trust Center dialog, click Macro Settings. 7. Select Enable all macros (last option). Best regards, John On Wed, Jun 29, 2011 at 11:06 AM, Leo Susanto leosusa...@gmail.com wrote: Try this: http://stackoverflow.com/questions/837754/call-routine-in-access-module-from-net On Wed, Jun 29, 2011 at 10:19 AM, John Harrington bearti...@gmail.com wrote: Hi Leo, Thanks for this. I tried this script on one of the machines that wasn't working yesterday and received only this error: Last OLE32 error: Win32::OLE(0.1709) error 0x800a9d9f in METHOD/PROPERTYGET Run Any suggestions? So far I've tried automation on four separate machines: All with Access 2007 12.0.6535.5005 SP2 MSO 12.0.6554.5001 OS bits Perl version Works? XP 32 5.10.1 yes XP 32 5.12.4 no W7 64 5.12.4 yes W7? 64?5.10.1no I believe OS, bits, Perl version, and Access version can be ruled out as the explanation. Thank you again, John On Tue, Jun 28, 2011 at 5:35 PM, Leo Susanto leosusa...@gmail.com wrote: Thank, so Access 2007 is installed in all of the machine Could you please run this and see if there is any error? use strict; use warnings; use Win32::OLE; my $oAccess; eval {$oAccess = Win32::OLE-GetActiveObject(Access.Application)}; if ($@) { die Access.Application is not installed\n; } unless (defined $oAccess) { unless ($oAccess = Win32::OLE-new(Access.Application, sub {$_[0]-Quit;})) { die Can not start Access.Application\n; } } $oAccess-OpenCurrentDatabase(C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb); print Last OLE32 error: . Win32::OLE-LastError() if (Win32::OLE-LastError()); $oAccess-Run(AutomationTest); print Last OLE32 error: . Win32::OLE-LastError() if (Win32::OLE-LastError()); On Tue, Jun 28, 2011 at 4:36 PM, John Harrington bearti...@gmail.com wrote: I have a very simple script using Win32::OLE that works perfectly on my machine but not on other people's machines and I can't figure out why. The script is as follows: use strict; use warnings; use Win32::OLE; my $oAccess; $oAccess = Win32::OLE-new('Access.Application') or die Unable to start Access; $oAccess-OpenCurrentDatabase(C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb); $oAccess-Run(AutomationTest) When I run it on my machine, it successfully runs a Public Function called AutomationTest in my database. This function writes two files to the cwd, a text file and a simple Excel spreadsheet. When I run this script on other people's machines, the script executes (same OS, same version of ActiveState Perl (5.10.1), same database, same permissions) but the files are not written, which suggests the automation is not working. No errors are generated. The script runs, but there are no files produced. Again, it works on my machine, not on theirs, with apparently the very same conditions. I even tried sharing my Perl folder so another user could be assured he was running the same version of the module and Perl. I am at my wit's end. Any help would be appreciated. Can you think of any reason such a simple application of the Win32::OLE module would work on one machine and not on another? Thanks, John ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE
I have a very simple script using Win32::OLE that works perfectly on my machine but not on other people's machines and I can't figure out why. The script is as follows: use strict; use warnings; use Win32::OLE; my $oAccess; $oAccess = Win32::OLE-new('Access.Application') or die Unable to start Access; $oAccess-OpenCurrentDatabase(C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb); $oAccess-Run(AutomationTest) When I run it on my machine, it successfully runs a Public Function called AutomationTest in my database. This function writes two files to the cwd, a text file and a simple Excel spreadsheet. When I run this script on other people's machines, the script executes (same OS, same version of ActiveState Perl (5.10.1), same database, same permissions) but the files are not written, which suggests the automation is not working. No errors are generated. The script runs, but there are no files produced. Again, it works on my machine, not on theirs, with apparently the very same conditions. I even tried sharing my Perl folder so another user could be assured he was running the same version of the module and Perl. I am at my wit's end. Any help would be appreciated. Can you think of any reason such a simple application of the Win32::OLE module would work on one machine and not on another? Thanks, John ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE
Thank, so Access 2007 is installed in all of the machine Could you please run this and see if there is any error? use strict; use warnings; use Win32::OLE; my $oAccess; eval {$oAccess = Win32::OLE-GetActiveObject(Access.Application)}; if ($@) { die Access.Application is not installed\n; } unless (defined $oAccess) { unless ($oAccess = Win32::OLE-new(Access.Application, sub {$_[0]-Quit;})) { die Can not start Access.Application\n; } } $oAccess-OpenCurrentDatabase(C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb); print Last OLE32 error: . Win32::OLE-LastError() if (Win32::OLE-LastError()); $oAccess-Run(AutomationTest); print Last OLE32 error: . Win32::OLE-LastError() if (Win32::OLE-LastError()); On Tue, Jun 28, 2011 at 4:36 PM, John Harrington bearti...@gmail.com wrote: I have a very simple script using Win32::OLE that works perfectly on my machine but not on other people's machines and I can't figure out why. The script is as follows: use strict; use warnings; use Win32::OLE; my $oAccess; $oAccess = Win32::OLE-new('Access.Application') or die Unable to start Access; $oAccess-OpenCurrentDatabase(C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb); $oAccess-Run(AutomationTest) When I run it on my machine, it successfully runs a Public Function called AutomationTest in my database. This function writes two files to the cwd, a text file and a simple Excel spreadsheet. When I run this script on other people's machines, the script executes (same OS, same version of ActiveState Perl (5.10.1), same database, same permissions) but the files are not written, which suggests the automation is not working. No errors are generated. The script runs, but there are no files produced. Again, it works on my machine, not on theirs, with apparently the very same conditions. I even tried sharing my Perl folder so another user could be assured he was running the same version of the module and Perl. I am at my wit's end. Any help would be appreciated. Can you think of any reason such a simple application of the Win32::OLE module would work on one machine and not on another? Thanks, John ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Question about calling my own Access VBA function using Win32::OLE
This question has to do with automating Access. I simply want to run my own function in Access and pass it parameters. Let's say I have written a public function called foo() in a module in my Access database. Foo() takes a couple of arguments, param1 and param2, the first a string, the second an int. I want to write a Perl script that runs this function in my Access database and passes it values for these parameters. What would that look like? It's not clear to me from reading the Win32::OLE documentation at CPAN how to do this. If this is not possible with Win32::OLE, can you tell me how I might accomplish this? Thanks, John ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: [OLE] Controlling AutoCAD = 2010 fails with Win32::OLE. Error 0x8001010a.
On Thu, 03 Mar 2011, Manuel Reimer wrote: Hi Manuel, [...] http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected- by-autocad-from-an-external-net-application.html This C# and so I tried to port this over to C++ to be able to add this to the OLE.xs file. I've attached the patch file with my proof of concept code. As you see in my patch, I commented out the code, initializing OLE in multi threading mode, to make the CoRegisterMessageFilter call succeed. The way to tell Win32::OLE to use OleInitialize() is to call Win32::OLE-Initialize(Win32::OLE::COINIT_OLEINITIALIZE()); right after you use Win32::OLE. Put it inside a BEGIN block if you may call any OLE functionality at compile time (e.g. while loading other code). Problem with this patch: It doesn't work. Anything, it does, is crashing the Perl interpreter... :-( It is not crashing for me just running the bundled test suite. Do you have some sample script that crashes that doesn't involve AutoCAD, as I don't have a copy of that application available. Is someone here able to have a look at this and perhaps fix this code? I haven't really looked at your code; just applied the patch, built the module and ran the tests, with no crash in sight. So I assume the crash only happens when the MessageFilter is actually being invoked. I'll try to look at your implementation to see if I can find anything that could go wrong, but having a reproducible crash would make this easier. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[OLE] Controlling AutoCAD = 2010 fails with Win32::OLE. Error 0x8001010a.
Hello, we use Perl and the Win32::OLE module to do some automatic drawing modifications with AutoCAD. Several scripts have been created and they work well with AutoCAD up to 2009. Starting with AutoCAD 2010 it unfortunately gets nearly impossible to get a stable communication between Perl and AutoCAD with Win32::OLE. I get errors like the following one: | Win32::OLE(0.1709) error 0x8001010a: Durch den Messagefilter wurde | angezeigt, dass die Anwendung ausgelastet ist | in METHOD/PROPERTYGET at C:\bin\test.pl line 20 Searching the net revealed, that such errors also occur with Excel, sometimes, but no solution. I tried several things like catching the error from Perl to retry the call and even tried to implement some retry code in the OLE.xs file until I found the following from Autodesk: http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected-by-autocad-from-an-external-net-application.html This C# and so I tried to port this over to C++ to be able to add this to the OLE.xs file. I've attached the patch file with my proof of concept code. As you see in my patch, I commented out the code, initializing OLE in multi threading mode, to make the CoRegisterMessageFilter call succeed. Problem with this patch: It doesn't work. Anything, it does, is crashing the Perl interpreter... :-( Is someone here able to have a look at this and perhaps fix this code? Thank you very much in advance. Mit freundlichen Grüßen / Best regards Manuel Reimer Bosch Rexroth. The Drive Control Company Tel. 09352/18-1578 manuel.rei...@boschrexroth.de www.boschrexroth.com Bosch Rexroth AG Maria-Theresien-Straße 23 97816 Lohr am Main GERMANY Firmensitz: Stuttgart, Registrierung: Amtsgericht Stuttgart HRB 23192 Vorstand: Dr. Karl Tragl (Vorsitzender), Dr. Georg Hanen; Reiner Leipold-Büttner; Dr. Stefan Spindler Vorsitzender des Aufsichtsrats: Dr. Siegfried Dais diff -U 6 -pr Win32-OLE-0.1709.org//OLE.xs Win32-OLE-0.1709/OLE.xs --- Win32-OLE-0.1709.org//OLE.xs2008-04-18 01:38:47.0 +0200 +++ Win32-OLE-0.1709/OLE.xs 2011-03-03 08:13:39.922118800 +0100 @@ -32,12 +32,13 @@ #define MY_VERSION Win32::OLE( XS_VERSION ) #include math.h /* this hack gets around VC-5.0 brainmelt */ #define _WIN32_DCOM #include windows.h #include ocidl.h +#include objidl.h #ifdef _DEBUG # include crtdbg.h # define DEBUGBREAK _CrtDbgBreak() #else # define DEBUGBREAK @@ -250,12 +251,22 @@ typedef struct _tagOBJECTHEADER #endif } OBJECTHEADER; #define OBJFLAG_DESTROYED 0x01 #define OBJFLAG_UNIQUE0x02 +class MsgFilter : public IMessageFilter { + public: + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*); + STDMETHOD_(ULONG,AddRef)(THIS); + STDMETHOD_(ULONG,Release)(THIS); + STDMETHOD_(DWORD,HandleInComingCall)(THIS_ DWORD,HTASK,DWORD,LPINTERFACEINFO); + STDMETHOD_(DWORD,RetryRejectedCall)(THIS_ HTASK,DWORD,DWORD); + STDMETHOD_(DWORD,MessagePending)(THIS_ HTASK,DWORD,DWORD); +}; + /* Win32::OLE object */ class EventSink; typedef struct { OBJECTHEADER header; @@ -1932,12 +1943,48 @@ NextEnumElement(pTHX_ IEnumVARIANT *pEnu return sv; } /* NextEnumElement */ // +STDMETHODIMP MsgFilter::QueryInterface(REFIID iid, void **ppv) +{ +if (iid == IID_IUnknown || iid == IID_IMessageFilter) +{ +*ppv = this; +return S_OK; +} +return E_NOINTERFACE; +} + +ULONG MsgFilter::AddRef(void) +{ +return 1; +} + +ULONG MsgFilter::Release(void) +{ +return 1; +} + +DWORD MsgFilter::HandleInComingCall (DWORD dwCallType, HTASK htaskCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo) +{ +return 0; // SERVERCALL_ISHANDLED +} + +DWORD MsgFilter::RetryRejectedCall(HTASK htaskCallee, DWORD dwTickCount, DWORD dwRejectType) +{ +return 1000; // Retry in a second +} + +DWORD MsgFilter::MessagePending(HTASK htaskCallee, DWORD dwTickCount, DWORD dwPendingType) +{ +return 1; // PENDINGMSG_WAITNOPROCESS +} + + EventSink::EventSink(pTHX_ WINOLEOBJECT *pObj, SV *events, REFIID riid, ITypeInfo *pTypeInfo) { DBG((EventSink::EventSink\n)); m_pObj = pObj; m_events = newSVsv(events); @@ -3229,33 +3276,40 @@ Initialize(pTHX_ HV *stash, DWORD dwCoIn g_pfnCoUninitialize = NULL; g_bInitialized = TRUE; DBG((Initialize dwCoInit=%d\n, dwCoInit)); - if (dwCoInit == COINIT_OLEINITIALIZE) { +// if (dwCoInit == COINIT_OLEINITIALIZE) { hr = OleInitialize(NULL); if (SUCCEEDED(hr)) g_pfnCoUninitialize = OleUninitialize; - } - else if (dwCoInit != COINIT_NO_INITIALIZE) { - if (g_pfnCoInitializeEx) - hr = g_pfnCoInitializeEx(NULL, dwCoInit); - else - hr = CoInitialize(NULL); - - if (SUCCEEDED(hr
Win32::OLE on MS Word using Selection.Find.Execute
Hi Peter, This is a translation of a script from technet that works: use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; # http://www.microsoft.com/technet/scriptcenter/resources/officetips/may05 /tips0512.mspx my $word = new Win32::OLE 'Word.Application','' or die Cannot start word!\n; $word-{visible}=1; my ( $file, $text ) = @ARGV; my $doc = $word-Documents-Open( $file ); $selection = $word-Selection; $selection-Find-{Text} = $text; $selection-Find-{Forward} = TRUE; $selection-Find-{MatchWholeWord} = TRUE; if ( $selection-Find-Execute ) { print The search text was found\n; } else { print The search text was not found\n; } Cheers, Kev. -Original Message- Date: Sun, 12 Sep 2010 16:43:24 -0400 From: Peter Buck pb...@his.com Subject: Win32::OLE on MS Word using Selection.Find.Execute To: perl-win32-users@listserv.ActiveState.com Message-ID: 4c8d3b6c.8010...@his.com Content-Type: text/plain; charset=ISO-8859-1; format=flowed Does anyone have an example of a perl script acting on MS Word documents using Win32::OLE and Selection.Find.Execute? I have read the Win32 man page but its examples for Excel and Access don't help. I found a Powershell script that does what I want but can't translate. The parts I'm confused on are (1) setting the parameters used in the Selection.Find.Execute() invocation (particularly the boolean values, since perl doesn't do booleans) and the actual invocation of Selection.Find.Execute(). I did find an example using $search- Execute() but this doesn't appear to allow setting all the parameters that Selection.Find.Execute() does. Also, it operates on $doc- Content-Find while Selection.Find.Execute() operates on $doc-Selection (if I'm right). And I'm using Homekey(6) to take me to the top of the document, which is linked to Selection and doesn't seem to work in my $doc-Content-Find attempts. Any help or direction to documentation much appreciated. Thanks - Toolsmith # ExpandAcronyms.ps1 # read acronym list, expand acronyms in target MS Word document # syntax: ExpandAcronyms wordDocument function make-change { $FindText = $args[0] $FullText = $args[1] $ReplaceText = $FullText ($FindText) $ReplaceAll = 1 $FindContinue = 1 $MatchCase = $True $MatchWholeWord = $True $MatchWildcards = $False $MatchSoundsLike = $False $MatchAllWordForms = $False $Forward = $True $Wrap = $FindContinue# don't want it wrapping, wish I knew what this meant $Format = $False $objWord.Selection.HomeKey(6) Null $result = $objSelection.Find.Execute($FindText,$MatchCase, $MatchWholeWord,$MatchWildcards,$MatchSoundsLike, $MatchAllWordForms,$Forward,$Wrap,$Format, $ReplaceText,$ReplaceAll) if ( $result -eq $true ) { $Findtext|$FullText } } if ( $args.count -lt 1 ) { cd $env:temp $strWordFile = [string](resolve-path(Read-Host Enter Path of Word file to be processed)) } else { $strWordFile = [string](resolve-path($args[0])) } $objWord = New-Object -ComObject word.application $objWord.Visible = $True $objDoc = $objWord.Documents.Open($strWordFile) $objSelection = $objWord.Selection $d = get-content d:/temp/acronyms.txt# read file of acronym | definition foreach ( $l in $d ) { ($acro, $def) = $l.split('|')# build array of acronym, definition make-change $acro $def } Finished $objWord.Selection.HomeKey(6) Null This e-mail (including any attachments) may be confidential and may contain legally privileged information. You should not disclose its contents to any other person. If you are not the intended recipient, please notify the sender immediately. Whilst the Council has taken every reasonable precaution to minimise the risk of computer software viruses, it cannot accept liability for any damage which you may sustain as a result of such viruses. You should carry out your own virus checks before opening the e-mail(and/or any attachments). Unless expressly stated otherwise, the contents of this e-mail represent only the views of the sender and does not impose any legal obligation upon the Council or commit the Council to any course of action. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE on MS Word using Selection.Find.Execute
Peter Buck wrote: Does anyone have an example of a perl script acting on MS Word documents using Win32::OLE and Selection.Find.Execute? I have read the Win32 man page but its examples for Excel and Access don't help. I found a Powershell script that does what I want but can't translate. The parts I'm confused on are (1) setting the parameters used in the Selection.Find.Execute() invocation (particularly the boolean values, since perl doesn't do booleans) and the actual invocation of Selection.Find.Execute(). I did find an example using $search- Execute() but this doesn't appear to allow setting all the parameters that Selection.Find.Execute() does. Also, it operates on $doc- Content-Find while Selection.Find.Execute() operates on $doc-Selection (if I'm right). And I'm using Homekey(6) to take me to the top of the document, which is linked to Selection and doesn't seem to work in my $doc-Content-Find attempts. Any help or direction to documentation much appreciated. The primary documentation for OLE apps is the Visual Basic Reference. The OLE browser supplied with Activestate Perl is also very useful, I find. Other than that, googling for examples can be useful, followed by an amount of trial and error. The amount of trial and error needed will depend on how closely the results of your googling match what you are trying to do. Thanks - Toolsmith # ExpandAcronyms.ps1 # read acronym list, expand acronyms in target MS Word document # syntax: ExpandAcronyms wordDocument function make-change { $FindText = $args[0] $FullText = $args[1] $ReplaceText = $FullText ($FindText) $ReplaceAll = 1 $FindContinue = 1 $MatchCase = $True $MatchWholeWord = $True $MatchWildcards = $False $MatchSoundsLike = $False $MatchAllWordForms = $False $Forward = $True $Wrap = $FindContinue# don't want it wrapping, wish I knew what this meant $Format = $False $objWord.Selection.HomeKey(6) Null $result = $objSelection.Find.Execute($FindText,$MatchCase, $MatchWholeWord,$MatchWildcards,$MatchSoundsLike, $MatchAllWordForms,$Forward,$Wrap,$Format, $ReplaceText,$ReplaceAll) if ( $result -eq $true ) { $Findtext|$FullText } } if ( $args.count -lt 1 ) { cd $env:temp $strWordFile = [string](resolve-path(Read-Host Enter Path of Word file to be processed)) } else { $strWordFile = [string](resolve-path($args[0])) } $objWord = New-Object -ComObject word.application $objWord.Visible = $True $objDoc = $objWord.Documents.Open($strWordFile) $objSelection = $objWord.Selection $d = get-content d:/temp/acronyms.txt# read file of acronym | definition foreach ( $l in $d ) { ($acro, $def) = $l.split('|')# build array of acronym, definition make-change $acro $def } Finished $objWord.Selection.HomeKey(6) Null That looks like shell script rather than Perl (Powershell perhaps?). Your Perl code would have been more useful. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE on MS Word using Selection.Find.Execute
Peter, OLE needs Variant values. Perl and the OLE modules will convert most of these on he fly for you, but sometimes I find I have a need to convert booleans explicitly. my $false = Win32::OLE::Variant-new(VT_VARIANT, 0); my $true = Win32::OLE::Variant-new(VT_VARIANT, 1); Mark On 9/12/2010 4:43 PM, Peter Buck wrote: Does anyone have an example of a perl script acting on MS Word documents using Win32::OLE and Selection.Find.Execute? I have read the Win32 man page but its examples for Excel and Access don't help. I found a Powershell script that does what I want but can't translate. The parts I'm confused on are (1) setting the parameters used in the Selection.Find.Execute() invocation (particularly the boolean values, since perl doesn't do booleans) and the actual invocation of Selection.Find.Execute(). I did find an example using $search- Execute() but this doesn't appear to allow setting all the parameters that Selection.Find.Execute() does. Also, it operates on $doc- Content-Find while Selection.Find.Execute() operates on $doc-Selection (if I'm right). And I'm using Homekey(6) to take me to the top of the document, which is linked to Selection and doesn't seem to work in my $doc-Content-Find attempts. Any help or direction to documentation much appreciated. Thanks - Toolsmith # ExpandAcronyms.ps1 # read acronym list, expand acronyms in target MS Word document # syntax: ExpandAcronyms wordDocument function make-change { $FindText = $args[0] $FullText = $args[1] $ReplaceText = $FullText ($FindText) $ReplaceAll = 1 $FindContinue = 1 $MatchCase = $True $MatchWholeWord = $True $MatchWildcards = $False $MatchSoundsLike = $False $MatchAllWordForms = $False $Forward = $True $Wrap = $FindContinue# don't want it wrapping, wish I knew what this meant $Format = $False $objWord.Selection.HomeKey(6) Null $result = $objSelection.Find.Execute($FindText,$MatchCase, $MatchWholeWord,$MatchWildcards,$MatchSoundsLike, $MatchAllWordForms,$Forward,$Wrap,$Format, $ReplaceText,$ReplaceAll) if ( $result -eq $true ) { $Findtext|$FullText } } if ( $args.count -lt 1 ) { cd $env:temp $strWordFile = [string](resolve-path(Read-Host Enter Path of Word file to be processed)) } else { $strWordFile = [string](resolve-path($args[0])) } $objWord = New-Object -ComObject word.application $objWord.Visible = $True $objDoc = $objWord.Documents.Open($strWordFile) $objSelection = $objWord.Selection $d = get-content d:/temp/acronyms.txt# read file of acronym | definition foreach ( $l in $d ) { ($acro, $def) = $l.split('|')# build array of acronym, definition make-change $acro $def } Finished $objWord.Selection.HomeKey(6) Null ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE on MS Word using Selection.Find.Execute
On Sun, 12 Sep 2010, Peter Buck wrote: Does anyone have an example of a perl script acting on MS Word documents using Win32::OLE and Selection.Find.Execute? Actually, I do, and it is even part of the Win32::OLE module distribution on CPAN. But since it is not being installed with the actual module itself it is somewhat hard to find: http://cpansearch.perl.org/src/JDB/Win32-OLE-0.1709/eg/word2pod.pl The script takes a Word document and tries to convert it to POD. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE on MS Word using Selection.Find.Execute
Does anyone have an example of a perl script acting on MS Word documents using Win32::OLE and Selection.Find.Execute? I have read the Win32 man page but its examples for Excel and Access don't help. I found a Powershell script that does what I want but can't translate. The parts I'm confused on are (1) setting the parameters used in the Selection.Find.Execute() invocation (particularly the boolean values, since perl doesn't do booleans) and the actual invocation of Selection.Find.Execute(). I did find an example using $search- Execute() but this doesn't appear to allow setting all the parameters that Selection.Find.Execute() does. Also, it operates on $doc- Content-Find while Selection.Find.Execute() operates on $doc-Selection (if I'm right). And I'm using Homekey(6) to take me to the top of the document, which is linked to Selection and doesn't seem to work in my $doc-Content-Find attempts. Any help or direction to documentation much appreciated. Thanks - Toolsmith # ExpandAcronyms.ps1 # read acronym list, expand acronyms in target MS Word document # syntax: ExpandAcronyms wordDocument function make-change { $FindText = $args[0] $FullText = $args[1] $ReplaceText = $FullText ($FindText) $ReplaceAll = 1 $FindContinue = 1 $MatchCase = $True $MatchWholeWord = $True $MatchWildcards = $False $MatchSoundsLike = $False $MatchAllWordForms = $False $Forward = $True $Wrap = $FindContinue# don't want it wrapping, wish I knew what this meant $Format = $False $objWord.Selection.HomeKey(6) Null $result = $objSelection.Find.Execute($FindText,$MatchCase, $MatchWholeWord,$MatchWildcards,$MatchSoundsLike, $MatchAllWordForms,$Forward,$Wrap,$Format, $ReplaceText,$ReplaceAll) if ( $result -eq $true ) { $Findtext|$FullText } } if ( $args.count -lt 1 ) { cd $env:temp $strWordFile = [string](resolve-path(Read-Host Enter Path of Word file to be processed)) } else { $strWordFile = [string](resolve-path($args[0])) } $objWord = New-Object -ComObject word.application $objWord.Visible = $True $objDoc = $objWord.Documents.Open($strWordFile) $objSelection = $objWord.Selection $d = get-content d:/temp/acronyms.txt# read file of acronym | definition foreach ( $l in $d ) { ($acro, $def) = $l.split('|')# build array of acronym, definition make-change $acro $def } Finished $objWord.Selection.HomeKey(6) Null ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: TaskScheduler and Win32::OLE
Thanks -- I tried that earlier this week and was getting Server 500 errors. It worked today and I'm glad. -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Justin Allegakoen Sent: Saturday, April 03, 2010 8:52 PM To: perl-win32-users@listserv.ActiveState.com Subject: Re: TaskScheduler and Win32::OLE On 3 April 2010 22:21, Brzezinski, Paul J paul.brzezin...@hp.com wrote: I should have stated that I did first try to download this module its missing from the Activestate repository. So I downloaded the source and attempted to compile and its _broken_. It hasnt been updated in several years and according to the CPAN testers site this module fails to compile so its not just me. ppm installs fine for me with 5.10 with the additional repositories: C:\Perl\Programsppm install Win32-TaskScheduler Downloading ActiveState Package Repository packlist...done Updating ActiveState Package Repository database...done Downloading bribes packlist...done Updating bribes database...done Downloading trouchelle packlist...done Updating trouchelle database...done Downloading uwinnipeg packlist...not modified Downloading Win32-TaskScheduler-2.0.2...done Unpacking Win32-TaskScheduler-2.0.2...done Generating HTML for Win32-TaskScheduler-2.0.2...done Updating files in site area...done 9 files installed Just in ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs smime.p7s Description: S/MIME cryptographic signature ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: TaskScheduler and Win32::OLE
http://search.cpan.org/~UNICOLET/Win32-TaskScheduler2.0.3/TaskScheduler.pm http://taskscheduler.sourceforge.net/ El 02/04/2010 11:05 p.m., Brzezinski, Paul J escribió: I'm trying to use Win32::OLE to access the TaskScheduler [on Win2K3]. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. I'm using OleView.exe to look at the SCHEDULERLib (Scheduler 1.0 Type Library). Schedule: Scheduler.EnumTask: CLSSID: {056ADD67-DDB0-47BE-9F7D-DC652206F766} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x139e35c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Schedule: CLSSID: {4EF17F94-3975-4ACF-B228-29485BDE5860} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb3cc) 1.0\ = Scheduler 1.0 Type Library Scheduler.Task: CLSSID: {3AEC7772-2766-4C67-8487-4189C55DDE4E} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb45c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Trigger: CLSSID: {D8D9EEBC-0640-47AC-84FF-97C3A6B2FC79} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0xdc6ff4) 1.0\ = Scheduler 1.0 Type Library I have to say I'm quite lost and have reviewed Jan Dubois' doco on Win32::OLE but just haven't been able to understand it well enough. use Win32::OLE qw(in); $obj = Win32::OLE-new(Scheduler.Schedule) or die Error OLE:.Win32::OLE-LastError(); $obj-Reset; $obj-Activate; foreach $tsk (in $obj-Invoke( 'EnumAllTask')) { # print $tsk-Name, \n; # this generates an error my %NAMES; my @props = map { $_-{Name} } ( in $tsk-{Properties_} ); print Props = , join( , , @props), \n; } # no output is produced -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: TaskScheduler and Win32::OLE
I should have stated that I did first try to download this module - it's missing from the Activestate repository. So I downloaded the source and attempted to compile and it's _broken_. It hasn't been updated in several years and according to the CPAN testers site this module fails to compile - so it's not just me. -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services From: Marcial Borde [mailto:marcialbo...@adinet.com.uy] Sent: Saturday, April 03, 2010 8:23 AM To: Brzezinski, Paul J Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: TaskScheduler and Win32::OLE http://search.cpan.org/~UNICOLET/Win32-TaskScheduler2.0.3/TaskScheduler.pm http://taskscheduler.sourceforge.net/ El 02/04/2010 11:05 p.m., Brzezinski, Paul J escribió: I'm trying to use Win32::OLE to access the TaskScheduler [on Win2K3]. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. I'm using OleView.exe to look at the SCHEDULERLib (Scheduler 1.0 Type Library). Schedule: Scheduler.EnumTask: CLSSID: {056ADD67-DDB0-47BE-9F7D-DC652206F766} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x139e35c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Schedule: CLSSID: {4EF17F94-3975-4ACF-B228-29485BDE5860} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb3cc) 1.0\ = Scheduler 1.0 Type Library Scheduler.Task: CLSSID: {3AEC7772-2766-4C67-8487-4189C55DDE4E} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb45c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Trigger: CLSSID: {D8D9EEBC-0640-47AC-84FF-97C3A6B2FC79} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0xdc6ff4) 1.0\ = Scheduler 1.0 Type Library I have to say I'm quite lost and have reviewed Jan Dubois' doco on Win32::OLE but just haven't been able to understand it well enough. use Win32::OLE qw(in); $obj = Win32::OLE-new(Scheduler.Schedule) or die Error OLE:.Win32::OLE-LastError(); $obj-Reset; $obj-Activate; foreach $tsk (in $obj-Invoke( 'EnumAllTask')) { # print $tsk-Name, \n; # this generates an error my %NAMES; my @props = map { $_-{Name} } ( in $tsk-{Properties_} ); print Props = , join( , , @props), \n; } # no output is produced -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.commailto:Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: TaskScheduler and Win32::OLE
Respectively, XML might be an option for Vista and above, but I'm talking about W2K3 server. Yes, I should have stated I looked at the WMI method and dismissed that because it only gets the tasks added to the system via the AT command. The OLE objects are different between W2K3/XP and older vs. Vista/Win7/W2K8 and up, when I realized this I stopped trying to figure out the TaskLibrary 1.1 interface... I'm looking to be able to do this in-process instead of any kind of shell-out to launch schtasks. My original issue still stands. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services From: Howard Tanner [mailto:tan...@optonline.net] Sent: Friday, April 02, 2010 10:41 PM To: Brzezinski, Paul J Cc: perl-win32-users@listserv.activestate.com Subject: RE: TaskScheduler and Win32::OLE There is no OLE object to work with tasks created by the Scheduled Tasks Wizard (the Win32_ScheduledJob object in WMI only works with tasks scheduled with AT). You can, however, use the schtasks command to produce a list of all scheduled tasks and then walk that list. schtasks can produce the output in several formats, xml probably being the most useful for your purposes. From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Brzezinski, Paul J Sent: Friday, April 02, 2010 10:05 PM To: perl-win32-users@listserv.activestate.com Subject: TaskScheduler and Win32::OLE I'm trying to use Win32::OLE to access the TaskScheduler [on Win2K3]. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. I'm using OleView.exe to look at the SCHEDULERLib (Scheduler 1.0 Type Library). Schedule: Scheduler.EnumTask: CLSSID: {056ADD67-DDB0-47BE-9F7D-DC652206F766} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x139e35c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Schedule: CLSSID: {4EF17F94-3975-4ACF-B228-29485BDE5860} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb3cc) 1.0\ = Scheduler 1.0 Type Library Scheduler.Task: CLSSID: {3AEC7772-2766-4C67-8487-4189C55DDE4E} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb45c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Trigger: CLSSID: {D8D9EEBC-0640-47AC-84FF-97C3A6B2FC79} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0xdc6ff4) 1.0\ = Scheduler 1.0 Type Library I have to say I'm quite lost and have reviewed Jan Dubois' doco on Win32::OLE but just haven't been able to understand it well enough. use Win32::OLE qw(in); $obj = Win32::OLE-new(Scheduler.Schedule) or die Error OLE:.Win32::OLE-LastError(); $obj-Reset; $obj-Activate; foreach $tsk (in $obj-Invoke( 'EnumAllTask')) { # print $tsk-Name, \n; # this generates an error my %NAMES; my @props = map { $_-{Name} } ( in $tsk-{Properties_} ); print Props = , join( , , @props), \n; } # no output is produced -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: TaskScheduler and Win32::OLE
Sorry, I don't have a Windows 2003 Server to test this on. However, I do have an XP virtual machine, and schtasks is indeed available, although the /XML option is not. So if XML isn't available on Win2K3, use a different format, like CSV. From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Brzezinski, Paul J Sent: Saturday, April 03, 2010 10:55 AM To: Howard Tanner Cc: perl-win32-users@listserv.activestate.com Subject: RE: TaskScheduler and Win32::OLE Respectively, XML might be an option for Vista and above, but I'm talking about W2K3 server. Yes, I should have stated I looked at the WMI method and dismissed that because it only gets the tasks added to the system via the AT command. The OLE objects are different between W2K3/XP and older vs. Vista/Win7/W2K8 and up, when I realized this I stopped trying to figure out the TaskLibrary 1.1 interface. I'm looking to be able to do this in-process instead of any kind of shell-out to launch schtasks. My original issue still stands. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services From: Howard Tanner [mailto:tan...@optonline.net] Sent: Friday, April 02, 2010 10:41 PM To: Brzezinski, Paul J Cc: perl-win32-users@listserv.activestate.com Subject: RE: TaskScheduler and Win32::OLE There is no OLE object to work with tasks created by the Scheduled Tasks Wizard (the Win32_ScheduledJob object in WMI only works with tasks scheduled with AT). You can, however, use the schtasks command to produce a list of all scheduled tasks and then walk that list. schtasks can produce the output in several formats, xml probably being the most useful for your purposes. From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Brzezinski, Paul J Sent: Friday, April 02, 2010 10:05 PM To: perl-win32-users@listserv.activestate.com Subject: TaskScheduler and Win32::OLE I'm trying to use Win32::OLE to access the TaskScheduler [on Win2K3]. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. I'm using OleView.exe to look at the SCHEDULERLib (Scheduler 1.0 Type Library). Schedule: Scheduler.EnumTask: CLSSID: {056ADD67-DDB0-47BE-9F7D-DC652206F766} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x139e35c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Schedule: CLSSID: {4EF17F94-3975-4ACF-B228-29485BDE5860} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb3cc) 1.0\ = Scheduler 1.0 Type Library Scheduler.Task: CLSSID: {3AEC7772-2766-4C67-8487-4189C55DDE4E} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb45c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Trigger: CLSSID: {D8D9EEBC-0640-47AC-84FF-97C3A6B2FC79} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0xdc6ff4) 1.0\ = Scheduler 1.0 Type Library I have to say I'm quite lost and have reviewed Jan Dubois' doco on Win32::OLE but just haven't been able to understand it well enough. use Win32::OLE qw(in); $obj = Win32::OLE-new(Scheduler.Schedule) or die Error OLE:.Win32::OLE-LastError(); $obj-Reset; $obj-Activate; foreach $tsk (in $obj-Invoke( 'EnumAllTask')) { # print $tsk-Name, \n; # this generates an error my %NAMES; my @props = map { $_-{Name} } ( in $tsk-{Properties_} ); print Props = , join( , , @props), \n; } # no output is produced -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: TaskScheduler and Win32::OLE
On 3 April 2010 22:21, Brzezinski, Paul J paul.brzezin...@hp.com wrote: I should have stated that I did first try to download this module – it’s missing from the Activestate repository. So I downloaded the source and attempted to compile and it’s _broken_. It hasn’t been updated in several years and according to the CPAN testers site this module fails to compile – so it’s not just me. ppm installs fine for me with 5.10 with the additional repositories: C:\Perl\Programsppm install Win32-TaskScheduler Downloading ActiveState Package Repository packlist...done Updating ActiveState Package Repository database...done Downloading bribes packlist...done Updating bribes database...done Downloading trouchelle packlist...done Updating trouchelle database...done Downloading uwinnipeg packlist...not modified Downloading Win32-TaskScheduler-2.0.2...done Unpacking Win32-TaskScheduler-2.0.2...done Generating HTML for Win32-TaskScheduler-2.0.2...done Updating files in site area...done 9 files installed Just in ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
TaskScheduler and Win32::OLE
I'm trying to use Win32::OLE to access the TaskScheduler [on Win2K3]. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. I'm using OleView.exe to look at the SCHEDULERLib (Scheduler 1.0 Type Library). Schedule: Scheduler.EnumTask: CLSSID: {056ADD67-DDB0-47BE-9F7D-DC652206F766} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x139e35c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Schedule: CLSSID: {4EF17F94-3975-4ACF-B228-29485BDE5860} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb3cc) 1.0\ = Scheduler 1.0 Type Library Scheduler.Task: CLSSID: {3AEC7772-2766-4C67-8487-4189C55DDE4E} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb45c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Trigger: CLSSID: {D8D9EEBC-0640-47AC-84FF-97C3A6B2FC79} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0xdc6ff4) 1.0\ = Scheduler 1.0 Type Library I have to say I'm quite lost and have reviewed Jan Dubois' doco on Win32::OLE but just haven't been able to understand it well enough. use Win32::OLE qw(in); $obj = Win32::OLE-new(Scheduler.Schedule) or die Error OLE:.Win32::OLE-LastError(); $obj-Reset; $obj-Activate; foreach $tsk (in $obj-Invoke( 'EnumAllTask')) { # print $tsk-Name, \n; # this generates an error my %NAMES; my @props = map { $_-{Name} } ( in $tsk-{Properties_} ); print Props = , join( , , @props), \n; } # no output is produced -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: TaskScheduler and Win32::OLE
There is no OLE object to work with tasks created by the Scheduled Tasks Wizard (the Win32_ScheduledJob object in WMI only works with tasks scheduled with AT). You can, however, use the schtasks command to produce a list of all scheduled tasks and then walk that list. schtasks can produce the output in several formats, xml probably being the most useful for your purposes. From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Brzezinski, Paul J Sent: Friday, April 02, 2010 10:05 PM To: perl-win32-users@listserv.activestate.com Subject: TaskScheduler and Win32::OLE I'm trying to use Win32::OLE to access the TaskScheduler [on Win2K3]. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. I'm using OleView.exe to look at the SCHEDULERLib (Scheduler 1.0 Type Library). Schedule: Scheduler.EnumTask: CLSSID: {056ADD67-DDB0-47BE-9F7D-DC652206F766} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x139e35c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Schedule: CLSSID: {4EF17F94-3975-4ACF-B228-29485BDE5860} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb3cc) 1.0\ = Scheduler 1.0 Type Library Scheduler.Task: CLSSID: {3AEC7772-2766-4C67-8487-4189C55DDE4E} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb45c) 1.0\ = Scheduler 1.0 Type Library Scheduler.Trigger: CLSSID: {D8D9EEBC-0640-47AC-84FF-97C3A6B2FC79} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0xdc6ff4) 1.0\ = Scheduler 1.0 Type Library I have to say I'm quite lost and have reviewed Jan Dubois' doco on Win32::OLE but just haven't been able to understand it well enough. use Win32::OLE qw(in); $obj = Win32::OLE-new(Scheduler.Schedule) or die Error OLE:.Win32::OLE-LastError(); $obj-Reset; $obj-Activate; foreach $tsk (in $obj-Invoke( 'EnumAllTask')) { # print $tsk-Name, \n; # this generates an error my %NAMES; my @props = map { $_-{Name} } ( in $tsk-{Properties_} ); print Props = , join( , , @props), \n; } # no output is produced -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to simulate VB Casting for $perl_objects via Win32::OLE?
Date sent: Thu, 17 Dec 2009 12:36:27 -0600 Subject:Re: How to simulate VB Casting for $perl_objects via Win32::OLE? From: w...@serensoft.com w...@serensoft.com To: Jenda Krynicky je...@krynicky.cz Copies to: perl-win32-users@listserv.activestate.com That looks like a utility to take an existing perl program and convert it to a .NET-savvy executable: http://docs.activestate.com/pdk/8.1/ = click PerlNET link If that's the case, it won't resolve our issue. If it's not the case, we misunderstood. :) The thing is that Win32::OLE is for accessing OLE/COM DLLs and processes, not .Net ones. PerlNET will let you use .Net classes from your Perl code. The fact that it will then have to build an executable is a bit inconvenient, but that's not the point. Jenda = je...@krynicky.cz === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to simulate VB Casting for $perl_objects via Win32::OLE?
Subject:How to simulate VB Casting for $perl_objects via Win32::OLE? Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. I believe you need PerlNET (http://www.activestate.com/perl_dev_kit/features/) not Win32::OLE. Jenda = je...@krynicky.cz === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to simulate VB Casting for $perl_objects via Win32::OLE?
That looks like a utility to take an existing perl program and convert it to a .NET-savvy executable: http://docs.activestate.com/pdk/8.1/ = click PerlNET link If that's the case, it won't resolve our issue. If it's not the case, we misunderstood. :) On Thu, Dec 17, 2009 at 10:58 AM, Jenda Krynicky je...@krynicky.cz wrote: Subject:How to simulate VB Casting for $perl_objects via Win32::OLE? Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. I believe you need PerlNET (http://www.activestate.com/perl_dev_kit/features/) not Win32::OLE. Jenda = je...@krynicky.cz === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?]
Woo hoo, yes indeed! That did the trick. Thanks, Jan! BTW -- Jan, I don't recall the last time I posted a newbie-ish question and got as much information-packed help as what you've been providing here. Kudos! Thanks a bunch, keep up the good work... On Wed, Dec 16, 2009 at 6:42 PM, Jan Dubois j...@activestate.com wrote: Ok, here is what Graham from ActiveState support tells me: You *may* also need to go to the “Security” tab in the “Internet Options”, select “Local intranet” and click on the “Sites” button. Then disable the “Automatically detect intranet network” and instead select the individual choices underneath manually. I wonder if we shouldn’t drop the OLE browser from ActivePerl; it is hard to get it working, and enabling it leaves you with a security vulnerability unless you can trust all web pages on your local intranet. Note that both Microsoft Visual Studio and Microsoft Office come with Object browsers themselves, so if you have either of them, it might be easier to use those browsers instead (the Win32::OLE browser is basically a re-implementation of the one from Office 97 in Perl and DHTML). Cheers, -Jan *From:* trill...@gmail.com [mailto:trill...@gmail.com] *On Behalf Of * w...@serensoft.com *Sent:* Wednesday, December 16, 2009 3:11 PM *To:* Jan Dubois *Cc:* perl-win32-users@listserv.activestate.com *Subject:* PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?] Thanks Jan. We've got the .NET wonks working on just this approach. BTW... what does it take to get the PerlScript OLE browser to work? I tried a quick test (below) and PerlScript is working in IE, but the OLE browser frames are all empty except for the default could not load gripe at the bottom. Is there a start-condition of some sort? (And Initialize and script ActiveX controls not marked as safe is set to Enable for the local intranet zone...) script language=PerlScript $window-{status} = 'Hi from PerlScript!'; # works! /script http://www.xav.com/perl/site/lib/Win32/OLE/Browser/Browser.html file:///C:/Perl/html/lib/Win32/OLE/Browser.html On Wed, Dec 16, 2009 at 2:10 PM, Jan Dubois j...@activestate.com wrote: Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different “objects” as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won’t be able to access them via Win32::OLE either. Cheers, -Jan *From:* perl-win32-users-boun...@listserv.activestate.com [mailto: perl-win32-users-boun...@listserv.activestate.com] *On Behalf Of * w...@serensoft.com *Sent:* Wednesday, December 16, 2009 11:40 AM *To:* perl-win32-users@listserv.ActiveState.com *Subject:* How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox
How to simulate VB Casting for $perl_objects via Win32::OLE?
Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How to simulate VB Casting for $perl_objects via Win32::OLE?
Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different objects as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won't be able to access them via Win32::OLE either. Cheers, -Jan From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of w...@serensoft.com Sent: Wednesday, December 16, 2009 11:40 AM To: perl-win32-users@listserv.ActiveState.com Subject: How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?]
Thanks Jan. We've got the .NET wonks working on just this approach. BTW... what does it take to get the PerlScript OLE browser to work? I tried a quick test (below) and PerlScript is working in IE, but the OLE browser frames are all empty except for the default could not load gripe at the bottom. Is there a start-condition of some sort? (And Initialize and script ActiveX controls not marked as safe is set to Enable for the local intranet zone...) script language=PerlScript $window-{status} = 'Hi from PerlScript!'; # works! /script http://www.xav.com/perl/site/lib/Win32/OLE/Browser/Browser.html file:///C:/Perl/html/lib/Win32/OLE/Browser.html On Wed, Dec 16, 2009 at 2:10 PM, Jan Dubois j...@activestate.com wrote: Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different “objects” as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won’t be able to access them via Win32::OLE either. Cheers, -Jan *From:* perl-win32-users-boun...@listserv.activestate.com [mailto: perl-win32-users-boun...@listserv.activestate.com] *On Behalf Of * w...@serensoft.com *Sent:* Wednesday, December 16, 2009 11:40 AM *To:* perl-win32-users@listserv.ActiveState.com *Subject:* How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?]
Ok, here is what Graham from ActiveState support tells me: You may also need to go to the Security tab in the Internet Options, select Local intranet and click on the Sites button. Then disable the Automatically detect intranet network and instead select the individual choices underneath manually. I wonder if we shouldn't drop the OLE browser from ActivePerl; it is hard to get it working, and enabling it leaves you with a security vulnerability unless you can trust all web pages on your local intranet. Note that both Microsoft Visual Studio and Microsoft Office come with Object browsers themselves, so if you have either of them, it might be easier to use those browsers instead (the Win32::OLE browser is basically a re-implementation of the one from Office 97 in Perl and DHTML). Cheers, -Jan From: trill...@gmail.com [mailto:trill...@gmail.com] On Behalf Of w...@serensoft.com Sent: Wednesday, December 16, 2009 3:11 PM To: Jan Dubois Cc: perl-win32-users@listserv.activestate.com Subject: PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?] Thanks Jan. We've got the .NET wonks working on just this approach. BTW... what does it take to get the PerlScript OLE browser to work? I tried a quick test (below) and PerlScript is working in IE, but the OLE browser frames are all empty except for the default could not load gripe at the bottom. Is there a start-condition of some sort? (And Initialize and script ActiveX controls not marked as safe is set to Enable for the local intranet zone...) script language=PerlScript $window-{status} = 'Hi from PerlScript!'; # works! /script http://www.xav.com/perl/site/lib/Win32/OLE/Browser/Browser.html file:///C:/Perl/html/lib/Win32/OLE/Browser.html file:///C:\Perl\html\lib\Win32\OLE\Browser.html On Wed, Dec 16, 2009 at 2:10 PM, Jan Dubois j...@activestate.com wrote: Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different objects as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won't be able to access them via Win32::OLE either. Cheers, -Jan From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of w...@serensoft.com Sent: Wednesday, December 16, 2009 11:40 AM To: perl-win32-users@listserv.ActiveState.com Subject: How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: WIN32::OLE WMI Out params
On Fri, 04 Dec 2009 17:10:26 -0800, Michael Ellery mi...@s2technologies.com wrote: Michael wrote: Okay - Just to sum up the whole thing. The original VBScript EOF; Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next EOF Returns the following: Child Group Count: 25 Name: {36716FD8-E600-46FB-90CA-1263E0C62509} Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25} Name: {3E575181-0225-4553-9722-46F841B9FA76} Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4} Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281} Name: OpenView_AIX Name: OpenView_External Name: OpenView_HPUX Name: OpenView_Linux Name: OpenView_NNM Name: OpenView_OpenVMS Name: OpenView_OpenVMS(itanium) Name: OpenView_SNMP Name: OpenView_Solaris Name: OpenView_Tru64 Name: OpenView_Unknown Name: OpenView_Windows2000 Name: OpenView_WindowsNT Name: OpenView_WindowsServer2003 Name: OpenView_WindowsServer2008 Name: OpenView_WindowsVista Name: OpenView_WindowsXP Name: Root_Special Name: Root_Unix Name: Root_Windows And the Perl-Script with the modification EOF; #!perl use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Variant; use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; if (Win32::OLE- LastError() != 0) { print Error calling GetObject: . Win32::OLE-LastError() . \n; exit 0; } my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); if (Win32::OLE- LastError() != 0) { print Error calling Get: . Win32::OLE-LastError() . \n; exit 0; } my $objGetRoot = $objOV_NodeGroup-GetRoot(); if (Win32::OLE- LastError() != 0) { print Error calling GetRoot: . Win32::OLE-LastError() . \n; exit 0; } my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True); if (Win32::OLE- LastError() != 0) { print Error calling GetChildNodeGroups: . Win32::OLE-LastError() . \n; exit 0; } print Child Group Count: . $objChildGroups . \n; print Dumper($nodes); foreach my $objItem (in $nodes) { print 'Name: ' . $objItem-{Name} . \n; } #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns ##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error 0x80010105: The server threw an exception ##in METHOD/PROPERTYGET GetChildNodeGroups #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. Does any of this, make any sense to you guys? /Michael so, it looks like your Dumper statement is indicating a valid object
Re: WIN32::OLE WMI Out params
On Sat, 05 Dec 2009 05:58:48 -0800, Michael Ellery mi...@s2technologies.com wrote: Michael wrote: On Fri, 04 Dec 2009 17:10:26 -0800, Michael Ellery mi...@s2technologies.com wrote: Michael wrote: Okay - Just to sum up the whole thing. The original VBScript EOF; Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next EOF Returns the following: Child Group Count: 25 Name: {36716FD8-E600-46FB-90CA-1263E0C62509} Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25} Name: {3E575181-0225-4553-9722-46F841B9FA76} Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4} Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281} Name: OpenView_AIX Name: OpenView_External Name: OpenView_HPUX Name: OpenView_Linux Name: OpenView_NNM Name: OpenView_OpenVMS Name: OpenView_OpenVMS(itanium) Name: OpenView_SNMP Name: OpenView_Solaris Name: OpenView_Tru64 Name: OpenView_Unknown Name: OpenView_Windows2000 Name: OpenView_WindowsNT Name: OpenView_WindowsServer2003 Name: OpenView_WindowsServer2008 Name: OpenView_WindowsVista Name: OpenView_WindowsXP Name: Root_Special Name: Root_Unix Name: Root_Windows And the Perl-Script with the modification EOF; #!perl use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Variant; use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; if (Win32::OLE- LastError() != 0) { print Error calling GetObject: . Win32::OLE-LastError() . \n; exit 0; } my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); if (Win32::OLE- LastError() != 0) { print Error calling Get: . Win32::OLE-LastError() . \n; exit 0; } my $objGetRoot = $objOV_NodeGroup-GetRoot(); if (Win32::OLE- LastError() != 0) { print Error calling GetRoot: . Win32::OLE-LastError() . \n; exit 0; } my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True); if (Win32::OLE- LastError() != 0) { print Error calling GetChildNodeGroups: . Win32::OLE-LastError() . \n; exit 0; } print Child Group Count: . $objChildGroups . \n; print Dumper($nodes); foreach my $objItem (in $nodes) { print 'Name: ' . $objItem-{Name} . \n; } #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns ##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error 0x80010105: The server threw an exception ##in METHOD/PROPERTYGET GetChildNodeGroups #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. Does any of this, make any sense to you guys? /Michael so, it looks
RE: WIN32::OLE WMI Out params
Below... -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Michael Sent: Thursday, December 03, 2009 6:45 AM To: perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE WMI Out params When troubleshooting OLE issues, it is best to have the following code after each OLE command... If (Win32::OLE- LastError() != 0) { print error calling blah: . Win32::OLE- LastError() . \n; exit 0; } ...Or something similar, so you can see what OLE had issues with (if anything). It might lead you in a direction that fixes it. Steven Added to the script, but no issues reported. /Michael Well, then my next guess is the use of the Variant module (because no error is thrown from OLE). Some OLE calls require to be cast of a certain type before they work. use Win32::OLE::Variant; my $nodes = Variant(VT_ARRAY|VT_VARIANT, 0); #I might also try VT_VARIANT or VT_ARRAY|VT_BSTR instead of VT_ARRAY|VT_VARIANT #then my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, TRUE); Play around with this... I'm not the greatest Variant script writer here, to know exactly which combination will work (if this is it) based on the object type as I've only run into this a few times before, but you can get examples from your perl install here (depending on your perl build version) of similar options to try and all the VT_* types: C:\Perl\html\lib\Win32\OLE\Variant.html HTH P.S. I googled OV_NodeGroup and found someone else with your same problem on an HP board (or so it seems). :( Steven ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE WMI Out params
Hi Steven, Well I tried your suggestion and I think that the Win32::OLE::Variant module might be the solution, as I have found some other examples where WMI [out] and variants are used. http://www.infoqu.com/dev/perl-programming/using-perl-with-wmi-to-set-folder-level-permissions-16930-1/ http://www.perlmonks.org/?node_id=325823 However I'm in way over my head here, so unless someone could cut it out in pieces , I don't think that I'll get any further. /Michael On Fri, 4 Dec 2009 02:12:03 -0700, Steven Manross ste...@manross.net wrote: Below... -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Michael Sent: Thursday, December 03, 2009 6:45 AM To: perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE WMI Out params When troubleshooting OLE issues, it is best to have the following code after each OLE command... If (Win32::OLE- LastError() != 0) { print error calling blah: . Win32::OLE- LastError() . \n; exit 0; } ...Or something similar, so you can see what OLE had issues with (if anything). It might lead you in a direction that fixes it. Steven Added to the script, but no issues reported. /Michael Well, then my next guess is the use of the Variant module (because no error is thrown from OLE). Some OLE calls require to be cast of a certain type before they work. use Win32::OLE::Variant; my $nodes = Variant(VT_ARRAY|VT_VARIANT, 0); #I might also try VT_VARIANT or VT_ARRAY|VT_BSTR instead of VT_ARRAY|VT_VARIANT #then my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, TRUE); Play around with this... I'm not the greatest Variant script writer here, to know exactly which combination will work (if this is it) based on the object type as I've only run into this a few times before, but you can get examples from your perl install here (depending on your perl build version) of similar options to try and all the VT_* types: C:\Perl\html\lib\Win32\OLE\Variant.html HTH P.S. I googled OV_NodeGroup and found someone else with your same problem on an HP board (or so it seems). :( Steven ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: WIN32::OLE WMI Out params
I haven't followed your thread closely, but it seems like the relevant bits from your first link are these: my $objSecDescriptor = Win32::OLE::Variant- new (VT_DISPATCH|VT_BYREF); my $retval = $objDirectorySecSetting-GetSecurityDescriptor($objSecDescriptor); ..which seems to be filling the $objSecDescriptor with an out param. If your out param is an array, you might need to add VT_ARRAY to the variant flags when you create it. Does something like that work for you ? -Mike Michael wrote: Hi Steven, Well I tried your suggestion and I think that the Win32::OLE::Variant module might be the solution, as I have found some other examples where WMI [out] and variants are used. http://www.infoqu.com/dev/perl-programming/using-perl-with-wmi-to-set-folder-level-permissions-16930-1/ http://www.perlmonks.org/?node_id=325823 However I'm in way over my head here, so unless someone could cut it out in pieces , I don't think that I'll get any further. /Michael On Fri, 4 Dec 2009 02:12:03 -0700, Steven Manross ste...@manross.net wrote: Below... -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Michael Sent: Thursday, December 03, 2009 6:45 AM To: perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE WMI Out params When troubleshooting OLE issues, it is best to have the following code after each OLE command... If (Win32::OLE- LastError() != 0) { print error calling blah: . Win32::OLE- LastError() . \n; exit 0; } ...Or something similar, so you can see what OLE had issues with (if anything). It might lead you in a direction that fixes it. Steven Added to the script, but no issues reported. /Michael Well, then my next guess is the use of the Variant module (because no error is thrown from OLE). Some OLE calls require to be cast of a certain type before they work. use Win32::OLE::Variant; my $nodes = Variant(VT_ARRAY|VT_VARIANT, 0); #I might also try VT_VARIANT or VT_ARRAY|VT_BSTR instead of VT_ARRAY|VT_VARIANT #then my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, TRUE); Play around with this... I'm not the greatest Variant script writer here, to know exactly which combination will work (if this is it) based on the object type as I've only run into this a few times before, but you can get examples from your perl install here (depending on your perl build version) of similar options to try and all the VT_* types: C:\Perl\html\lib\Win32\OLE\Variant.html HTH P.S. I googled OV_NodeGroup and found someone else with your same problem on an HP board (or so it seems). :( Steven ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE WMI Out params
-Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Michael Ellery Sent: Friday, December 04, 2009 11:59 AM To: Michael Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: WIN32::OLE WMI Out params I haven't followed your thread closely, but it seems like the relevant bits from your first link are these: my $objSecDescriptor = Win32::OLE::Variant- new (VT_DISPATCH|VT_BYREF); my $retval = $objDirectorySecSetting-GetSecurityDescriptor($objSecDescriptor); ..which seems to be filling the $objSecDescriptor with an out param. If your out param is an array, you might need to add VT_ARRAY to the variant flags when you create it. Does something like that work for you ? -Mike Michael wrote: Hi Steven, Well I tried your suggestion and I think that the Win32::OLE::Variant module might be the solution, as I have found some other examples where WMI [out] and variants are used. http://www.infoqu.com/dev/perl-programming/using-perl-with-wmi-to-set- folder-level-permissions-16930-1/ http://www.perlmonks.org/?node_id=325823 However I'm in way over my head here, so unless someone could cut it out in pieces , I don't think that I'll get any further. /Michael On Fri, 4 Dec 2009 02:12:03 -0700, Steven Manross ste...@manross.net wrote: Below... -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Michael Sent: Thursday, December 03, 2009 6:45 AM To: perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE WMI Out params When troubleshooting OLE issues, it is best to have the following code after each OLE command... If (Win32::OLE- LastError() != 0) { print error calling blah: . Win32::OLE- LastError() . \n; exit 0; } ...Or something similar, so you can see what OLE had issues with (if anything). It might lead you in a direction that fixes it. Steven Added to the script, but no issues reported. /Michael Well, then my next guess is the use of the Variant module (because no error is thrown from OLE). Some OLE calls require to be cast of a certain type before they work. my $nodes = Variant(VT_ARRAY|VT_VARIANT, 0); My apologies here.. I think that I misstated the way to call it. Put this at the top somewhere... use Win32::OLE::Variant; Add the following before your GetChildNodes call. Thanks go to Michael Ellery for making me see that mistake as I did not test this code before sending it off. my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); By adding this before your GetChildNodes call, you should be all set (Variant-wise) However, before you give up after trying the above call (if it does not work as stated above), I would replace: VT_ARRAY|VT_VARIANT With VT_VARIANT And also try.. (if the previous does not work) VT_ARRAY|VT_BSTR And lastly try his example from the SecurityDescriptor call.. VT_DISPATCH|VT_BYREF ...in my code above. As well, you might try sticking the VT_BYREF as another ORed option to each of the above examples like in Michael Ellery's example.. i.e. VT_ARRAY_|VT_BSTR|VT_BYREF or VT_VARIANT|VT_BYREF or VT_ARRAY|VT_VARIANT|VT_BYREF HTH Steven #I might also try VT_VARIANT or VT_ARRAY|VT_BSTR instead of VT_ARRAY|VT_VARIANT #then my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, TRUE); Play around with this... I'm not the greatest Variant script writer here, to know exactly which combination will work (if this is it) based on the object type as I've only run into this a few times before, but you can get examples from your perl install here (depending on your perl build version) of similar options to try and all the VT_* types: C:\Perl\html\lib\Win32\OLE\Variant.html HTH P.S. I googled OV_NodeGroup and found someone else with your same problem on an HP board (or so it seems). :( Steven ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE WMI Out params
Okay - Just to sum up the whole thing. The original VBScript EOF; Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next EOF Returns the following: Child Group Count: 25 Name: {36716FD8-E600-46FB-90CA-1263E0C62509} Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25} Name: {3E575181-0225-4553-9722-46F841B9FA76} Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4} Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281} Name: OpenView_AIX Name: OpenView_External Name: OpenView_HPUX Name: OpenView_Linux Name: OpenView_NNM Name: OpenView_OpenVMS Name: OpenView_OpenVMS(itanium) Name: OpenView_SNMP Name: OpenView_Solaris Name: OpenView_Tru64 Name: OpenView_Unknown Name: OpenView_Windows2000 Name: OpenView_WindowsNT Name: OpenView_WindowsServer2003 Name: OpenView_WindowsServer2008 Name: OpenView_WindowsVista Name: OpenView_WindowsXP Name: Root_Special Name: Root_Unix Name: Root_Windows And the Perl-Script with the modification EOF; #!perl use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Variant; use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; if (Win32::OLE- LastError() != 0) { print Error calling GetObject: . Win32::OLE-LastError() . \n; exit 0; } my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); if (Win32::OLE- LastError() != 0) { print Error calling Get: . Win32::OLE-LastError() . \n; exit 0; } my $objGetRoot = $objOV_NodeGroup-GetRoot(); if (Win32::OLE- LastError() != 0) { print Error calling GetRoot: . Win32::OLE-LastError() . \n; exit 0; } my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True); if (Win32::OLE- LastError() != 0) { print Error calling GetChildNodeGroups: . Win32::OLE-LastError() . \n; exit 0; } print Child Group Count: . $objChildGroups . \n; print Dumper($nodes); foreach my $objItem (in $nodes) { print 'Name: ' . $objItem-{Name} . \n; } #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns ##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error 0x80010105: The server threw an exception ##in METHOD/PROPERTYGET GetChildNodeGroups #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. Does any of this, make any sense to you guys? /Michael ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: WIN32::OLE WMI Out params
Michael wrote: Okay - Just to sum up the whole thing. The original VBScript EOF; Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next EOF Returns the following: Child Group Count: 25 Name: {36716FD8-E600-46FB-90CA-1263E0C62509} Name: {38FF8E8E-2DDC-4895-A7EB-0DC7DF50EC25} Name: {3E575181-0225-4553-9722-46F841B9FA76} Name: {8A412133-F571-42BC-8A66-4B242EB3BAC4} Name: {E14D965C-1FBB-40EC-A784-5F9F39F82281} Name: OpenView_AIX Name: OpenView_External Name: OpenView_HPUX Name: OpenView_Linux Name: OpenView_NNM Name: OpenView_OpenVMS Name: OpenView_OpenVMS(itanium) Name: OpenView_SNMP Name: OpenView_Solaris Name: OpenView_Tru64 Name: OpenView_Unknown Name: OpenView_Windows2000 Name: OpenView_WindowsNT Name: OpenView_WindowsServer2003 Name: OpenView_WindowsServer2008 Name: OpenView_WindowsVista Name: OpenView_WindowsXP Name: Root_Special Name: Root_Unix Name: Root_Windows And the Perl-Script with the modification EOF; #!perl use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Variant; use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; if (Win32::OLE- LastError() != 0) { print Error calling GetObject: . Win32::OLE-LastError() . \n; exit 0; } my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); if (Win32::OLE- LastError() != 0) { print Error calling Get: . Win32::OLE-LastError() . \n; exit 0; } my $objGetRoot = $objOV_NodeGroup-GetRoot(); if (Win32::OLE- LastError() != 0) { print Error calling GetRoot: . Win32::OLE-LastError() . \n; exit 0; } my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); my $objChildGroups = $objGetRoot-GetChildNodeGroups($nodes, True); if (Win32::OLE- LastError() != 0) { print Error calling GetChildNodeGroups: . Win32::OLE-LastError() . \n; exit 0; } print Child Group Count: . $objChildGroups . \n; print Dumper($nodes); foreach my $objItem (in $nodes) { print 'Name: ' . $objItem-{Name} . \n; } #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197068)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197828)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27198308)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_DISPATCH|VT_BYREF); Returns ##Error calling GetChildNodeGroups: Win32::OLE(0.1709) error 0x80010105: The server threw an exception ##in METHOD/PROPERTYGET GetChildNodeGroups #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199076)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_BSTR|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27197684)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_VARIANT|VT_BYREF); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199620)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. #my $nodes = Win32::OLE::Variant-new(VT_ARRAY|VT_VARIANT|VT_BYREF, 0); Returns ##Child Group Count: 25 ##$VAR1 = bless( do{\(my $o = 27199524)}, 'Win32::OLE::Variant' ); ##Not a HASH reference at GetChildNodeGroups.pl line 46. Does any of this, make any sense to you guys? /Michael so, it looks like your Dumper statement is indicating a valid object in most cases. I think the problem on your loop is that you are using the 'in' adapter
WIN32::OLE WMI Out params
Hi, I'm a novice regarding Perl, and need some help converting a VBScript to a PerlScript. The following VBScript returns some data from HP OpenView. The GetChildNodeGroups method returns the number of ChildGroups, and the [out] parameter NodeGroups returns an array which contains a list of OV_NodeGroup. From the documentation: sint32 GetChildNodeGroups( [out] OV_NodeGroup NodeGroups[], [in, optional] boolean IncludeSubGroups) Description Returns a list of node groups (instances of OV_NodeGroup) that are children of this node group. Return Value Number of node groups (children) in the out parameter NodeGroups. ' VBScript Begin Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next ' VBScript End The problem is that I can't find out how to get the array (@arrNodes) in Perl. # PerlScript Begin use strict; use warnings; use Win32::OLE qw(in with); use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); my $objGetRoot = $objOV_NodeGroup-GetRoot(); my @arrNodes; my $objChildGroups = $objGetRoot-GetChildNodeGroups(@arrNodes, True); print Child Group Count: . $objChildGroups . \n; print @arrNodes . \n; # PerlScript End Any help would be appreciated. /Michael ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE WMI Out params
Michael wrote: Hi, I'm a novice regarding Perl, and need some help converting a VBScript to a PerlScript. The following VBScript returns some data from HP OpenView. The GetChildNodeGroups method returns the number of ChildGroups, and the [out] parameter NodeGroups returns an array which contains a list of OV_NodeGroup. From the documentation: sint32 GetChildNodeGroups( [out] OV_NodeGroup NodeGroups[], [in, optional] boolean IncludeSubGroups) Description Returns a list of node groups (instances of OV_NodeGroup) that are children of this node group. Return Value Number of node groups (children) in the out parameter NodeGroups. ' VBScript Begin Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next ' VBScript End The problem is that I can't find out how to get the array (@arrNodes) in Perl. # PerlScript Begin use strict; use warnings; use Win32::OLE qw(in with); use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); my $objGetRoot = $objOV_NodeGroup-GetRoot(); my @arrNodes; my $objChildGroups = $objGetRoot-GetChildNodeGroups(@arrNodes, True); And you were doing so well up to this point. I really don't think that you want to pass an empty array, interpolated into a string, as an output parameter. In fact, I would expect that it might even produce a run-time error. Does it? I don't know the answer, but from my limited Perl/OLE experience, my first guess would be that the function would want to return an OLE container object in the output parameter, and so would expect it to be a reference to a scalar. For example: my $nodes; use constant TRUE = 1; my $objChildGroups = $objGetRoot-GetChildNodeGroups(\$nodes, TRUE); print Child Group Count: . $objChildGroups . \n; print @arrNodes . \n; If I am right, and I may well not be, this would probably need to be something like: for my $obj (in $nodes) { print Name: $obj-{Name}\n; } # PerlScript End Any help would be appreciated. HTH, in lieu of somebody coming up with a more certain answer. -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE WMI Out params
Michael wrote: Hi, I'm a novice regarding Perl, and need some help converting a VBScript to a PerlScript. The following VBScript returns some data from HP OpenView. The GetChildNodeGroups method returns the number of ChildGroups, and the [out] parameter NodeGroups returns an array which contains a list of OV_NodeGroup. From the documentation: sint32 GetChildNodeGroups( [out] OV_NodeGroup NodeGroups[], [in, optional] boolean IncludeSubGroups) Description Returns a list of node groups (instances of OV_NodeGroup) that are children of this node group. Return Value Number of node groups (children) in the out parameter NodeGroups. ' VBScript Begin Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next ' VBScript End The problem is that I can't find out how to get the array (@arrNodes) in Perl. # PerlScript Begin use strict; use warnings; use Win32::OLE qw(in with); use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); my $objGetRoot = $objOV_NodeGroup-GetRoot(); my @arrNodes; my $objChildGroups = $objGetRoot-GetChildNodeGroups(@arrNodes, True); And you were doing so well up to this point. I really don't think that you want to pass an empty array, interpolated into a string, as an output parameter. In fact, I would expect that it might even produce a run-time error. Does it? Nope it does not. The problem is still that @arrNodes is empty. The GetChildNodeGroups method does not populate the variable/array like it does in VBScript. Therefore I've been around @arrNodes, \...@arrnodes, $nodes etc... I don't know the answer, but from my limited Perl/OLE experience, my first guess would be that the function would want to return an OLE container object in the output parameter, and so would expect it to be a reference to a scalar. For example: my $nodes; use constant TRUE = 1; my $objChildGroups = $objGetRoot- GetChildNodeGroups(\$nodes, TRUE); print Child Group Count: . $objChildGroups . \n; print @arrNodes . \n; If I am right, and I may well not be, this would probably need to be something like: for my $obj (in $nodes) { print Name: $obj- {Name}\n; } Yep - but because $nodes/@arrNodes is empty this does not change much. # PerlScript End Any help would be appreciated. HTH, in lieu of somebody coming up with a more certain answer. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE WMI Out params
When troubleshooting OLE issues, it is best to have the following code after each OLE command... If (Win32::OLE-LastError() != 0) { print error calling blah: . Win32::OLE-LastError() . \n; exit 0; } ...Or something similar, so you can see what OLE had issues with (if anything). It might lead you in a direction that fixes it. Steven -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Michael Sent: Thursday, December 03, 2009 6:19 AM To: perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE WMI Out params Michael wrote: Hi, I'm a novice regarding Perl, and need some help converting a VBScript to a PerlScript. The following VBScript returns some data from HP OpenView. The GetChildNodeGroups method returns the number of ChildGroups, and the [out] parameter NodeGroups returns an array which contains a list of OV_NodeGroup. From the documentation: sint32 GetChildNodeGroups( [out] OV_NodeGroup NodeGroups[], [in, optional] boolean IncludeSubGroups) Description Returns a list of node groups (instances of OV_NodeGroup) that are children of this node group. Return Value Number of node groups (children) in the out parameter NodeGroups. ' VBScript Begin Option Explicit Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes, objItem Set objWMIService = GetObject(winmgmts:root\HewlettPackard\OpenView\data) Set objOV_NodeGroup = objWMIService.Get(OV_NodeGroup) Set objGetRoot = objOV_NodeGroup.GetRoot() objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True) WScript.Echo Child Group Count: objChildGroups vbCrLF For Each objItem In arrNodes WScript.Echo Name: objItem.Name Next ' VBScript End The problem is that I can't find out how to get the array (@arrNodes) in Perl. # PerlScript Begin use strict; use warnings; use Win32::OLE qw(in with); use Data::Dumper; my $objWMIService = Win32::OLE-GetObject(winmgmts:root/HewlettPackard/OpenView/data) or die WMI connection failed.\n; my $objOV_NodeGroup = $objWMIService-Get(OV_NodeGroup); my $objGetRoot = $objOV_NodeGroup-GetRoot(); my @arrNodes; my $objChildGroups = $objGetRoot-GetChildNodeGroups(@arrNodes, True); And you were doing so well up to this point. I really don't think that you want to pass an empty array, interpolated into a string, as an output parameter. In fact, I would expect that it might even produce a run-time error. Does it? Nope it does not. The problem is still that @arrNodes is empty. The GetChildNodeGroups method does not populate the variable/array like it does in VBScript. Therefore I've been around @arrNodes, \...@arrnodes, $nodes etc... I don't know the answer, but from my limited Perl/OLE experience, my first guess would be that the function would want to return an OLE container object in the output parameter, and so would expect it to be a reference to a scalar. For example: my $nodes; use constant TRUE = 1; my $objChildGroups = $objGetRoot- GetChildNodeGroups(\$nodes, TRUE); print Child Group Count: . $objChildGroups . \n; print @arrNodes . \n; If I am right, and I may well not be, this would probably need to be something like: for my $obj (in $nodes) { print Name: $obj- {Name}\n; } Yep - but because $nodes/@arrNodes is empty this does not change much. # PerlScript End Any help would be appreciated. HTH, in lieu of somebody coming up with a more certain answer. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE WMI Out params
When troubleshooting OLE issues, it is best to have the following code after each OLE command... If (Win32::OLE- LastError() != 0) { print error calling blah: . Win32::OLE- LastError() . \n; exit 0; } ...Or something similar, so you can see what OLE had issues with (if anything). It might lead you in a direction that fixes it. Steven Added to the script, but no issues reported. /Michael ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Save As option in Win32::OLE
Hi List, I am opening word document through Win32::OLE and saving as Plain Text with Encoding option MS-DOS and Insert-Line-Break option. I achieved the above output through perl, but output not matching with the output which is done the same manual operation in MS-word. Complete code: use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; my $folderpath=$ARGV[0]; my $Word = Win32::OLE-new('Word.Application'); $Word-{'Visible'} = 0; $Word-{DisplayAlerts} = 0; my $doc = $Word-Documents-Open($folderpath\\Chapter 1.doc); $Word-ActiveDocument-SaveAs({FileName=$folderpath\\Chapter 1.txt, FileFormat=wdFormatTextLineBreaks}); $Word-{ActiveDocument}-Close; $doc-Close; $Word-Close; By manual (In word application) output coming with breaks in each line like: Writing, of whatever type, can be a draining and dreaded task. But it can also be a passion, an adventure, and even a compulsion that occasionally brings great satisfaction as a payoff to the pain. One group of people write simply because it is demanded of them by employers (or teachers). A second group set down words because they like to write. And a special third group may internally be compelled to pen things due to changes in the brain that Alice Flaherty and colleague neurologists label hypergraphia, ?an overpowering desire to write.? [1] [[Line breaks for each line in aparagraph - Required output]] By perl code output coming with breaks each line like: Writing, of whatever type, can be a draining and dreaded task. But it can also be a passion, an adventure, and even a compulsion that occasionally brings great satisfaction as a payoff to the pain. One group of people write simply because it is demanded of them by employers (or teachers). A second group set down words because they like to write. And a special third group may internally be compelled to pen things due to changes in the brain that Alice Flaherty and colleague neurologists label hypergraphia, an overpowering desire to write. [1] [[Single line without line break]] I am using perl5.8.8. basic console perl programming. Please suggest. Please correct me if I did any mistake on the above code. Regards, Ramkumar, ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Save As option in Win32::OLE
Hi. Ramkumar wrote: I am opening word document through Win32::OLE and saving as Plain Text with Encoding option MS-DOS and Insert-Line-Break option. I achieved the above output through perl, but output not matching with the output which is done the same manual operation in MS-word. Complete code: use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; my $folderpath=$ARGV[0]; my $Word = Win32::OLE-new('Word.Application'); $Word-{'Visible'} = 0; $Word-{DisplayAlerts} = 0; my $doc = $Word-Documents-Open($folderpath\\Chapter 1.doc); $Word-ActiveDocument-SaveAs({FileName=$folderpath\\Chapter 1.txt, FileFormat=wdFormatTextLineBreaks}); $Word-{ActiveDocument}-Close; $doc-Close; $Word-Close; When dealing with driving MS Office products through OLE, you're almost always better off running the package (Word in this case), Going to Tools/Macro/Start Macro, doing what you want through the GUI, Stopping, then editing the macro. This is what I see for Word 2003: ActiveDocument.SaveAs FileName:= _ This is a test of the linefeeds test output.txt, FileFormat:= _ wdFormatText, LockComments:=False, Password:=, AddToRecentFiles:=True, _ WritePassword:=, ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _ SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _ False, Encoding:=437, InsertLineBreaks:=True, AllowSubstitutions:=False, _ LineEnding:=wdCRLF Perhaps options FileFormat = wdFormatText, InsertLineBreaks = True, LineEnding = wdCRLF will do what you want? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Save As option in Win32::OLE
Hi Todd Beverly, Thanks for your excellent answer. I got expected output. Once again I like to say many thanks. Regards, Ramkumar, ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE: problem setting hyperlinks in Excel spreadsheet
Mark Wood-Patrick wrote: I have some code which needs to set hyperlinks in an Excel document and I want the text displayed to be different from the actual link address. The following code works just fine for me: $worksheet-Hyperlinks-Add({ Anchor= $worksheet-Cells($row, $col), Address = http://bugs/$bugID http://nvbugs/$bugID, }); $worksheet-Cells($row, $col)-{Value} = $bugID; But if I do: $worksheet-Hyperlinks-Add({ Anchor= $worksheet-Cells($row, $col), Address = http://nvbugs/$bugID;, TextToDisplay = $bugID, }); I get: OLE Error Win32::OLE(0.1709) error 0x80070057: The parameter is incorrect in METHOD/PROPERTYGET Add but it did do what I wanted (the link was added correctly) anyone know why I get the error message, or how to debug this Mark ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE and script components with perl 5.10
I've recently upgraded to activeperl 5.10 (looks like it's build 1004) and I've just noticed that I can no longer instantiate my script components (which are written in PerlScript). Specifically, the perl interpreter process crashes. So, wanting to eliminate my WSCs, I went back to basics and took the canonical example in the docs (http://docs.activestate.com/activeperl/5.10/Windows/WindowsScriptComponents.html): ?xml version=1.0? component registration description=Easy progid=Easy.WSC version=1.00 classid={74bb1ba9-2e69-4ad6-b02c-c52f3cbe153b} /registration public method name=SayHello /method /public script language=PerlScript ![CDATA[ sub SayHello { my($param) = shift @_; return reverse($param); } ]] /script /component (NOTE - there is a error in the docs and the for the registration open tag has to be moved to AFTER the properties). Once I do this, register the component and then try to run the following script: use strict; use warnings; use Win32::OLE; Win32::OLE-Option(Warn = 3); my $r = new Win32::OLE('Easy.WSC'); print hello, world\n; ...I still get a crash. Has anyone else had luck instantiating WSCs with Win32::OLE in perl 5.10? Thanks, Mike Ellery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
WG: SOLVED: RE: perl starts very slow using WIN32::OLE
Hi , indeed it was a Problem with Libraries on an odd network. A novel Server had been exchanged a few weeks ago (and no one told me so) and I had a .dll written years ago and stored it on the network-drive (... so this seems not to be a good place for Libraries !! ). This dll has nothing to do with my actual skript but my REGISTRY still had the entries refering to that no more existing drive under the pathes HKEY_CLASSES_ROOT\TypeLib\... HKEY_LOCAL_MACHINE\TypeLib\ So when using Win32::OLE::Const in my skript, perl tried to find the drive which did not exist anymore. I detected the problem whith a simple NETSTAT.EXE in a dos-shell while perl was running slow and netstat told me SYN_GESENDET instead of HERGESTELLT for that specific drive, after asking our EDV-Team, they remembered suddenly having being removing that server(hm...) May be someone else can avoid the same anger when reading this. Cheers Armin Armin Nolte Database-Marketing Deutsche Behindertenhilfe - Aktion Mensch e.V. Heinemannstr. 36 53175 Bonn Tel.: 0228-2092-233 Fax: 0228-2092-222 www.aktion-mensch.de Jan Dubois [EMAIL PROTECTED] Gesendet von: [EMAIL PROTECTED] 06.09.2008 01:23 An [EMAIL PROTECTED], perl-win32-users@listserv.ActiveState.com Kopie Thema RE: perl starts very slow using WIN32::OLE I suspect that some of your type libraries are stored on a network share and not local. This may make reading the library rather slow. You may want to use a tool like Process Monitor (from Sysinternals, now Microsoft) to see which files are being accessed by the Perl process during this call. Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: September 5, 2008 2:56 AM To: perl-win32-users@listserv.ActiveState.com Subject: perl starts very slow using WIN32::OLE Hi, I have a real big perl program - it runs already for a couple of years and I am always adding some features. So since a few days it needs over 2 Minutes to start!!! I did a profiling and the problem seems to be the Win32::OLE::Const:::_Typelib So here is the actual output of the profiler: # %TimeSec. #calls sec/call F name 68.28 137.9805 777 0.177581 Win32::OLE::Const::_Typelib -- so perl needs 137 seconds for 777 calls!!! -- the first line (Win32::OLE operating in debugging mode: _Unique = 1) when starting the programm comes at once and after that I have to wait for a while = seems that the first call to Win32::OLE::Const::_Typelib need so long ???. Is perl searching the lib? And this is the output of the same program months ago: # %TimeSec. #calls sec/call F name 1.120.0794 686 0.000116 Win32::OLE::Const::_Typelib I'll be thankfull for any idea! Cheers Armin Armin Nolte Database-Marketing Deutsche Behindertenhilfe - Aktion Mensch e.V. Heinemannstr. 36 53175 Bonn Tel.: 0228-2092-233 Fax: 0228-2092-222 www.aktion-mensch.de___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
perl starts very slow using WIN32::OLE
Hi, I have a real big perl program - it runs already for a couple of years and I am always adding some features. So since a few days it needs over 2 Minutes to start!!! I did a profiling and the problem seems to be the Win32::OLE::Const:::_Typelib So here is the actual output of the profiler: # %TimeSec. #calls sec/call F name 68.28 137.9805 777 0.177581 Win32::OLE::Const::_Typelib -- so perl needs 137 seconds for 777 calls!!! -- the first line (Win32::OLE operating in debugging mode: _Unique = 1) when starting the programm comes at once and after that I have to wait for a while = seems that the first call to Win32::OLE::Const::_Typelib need so long ???. Is perl searching the lib? And this is the output of the same program months ago: # %TimeSec. #calls sec/call F name 1.120.0794 686 0.000116 Win32::OLE::Const::_Typelib I'll be thankfull for any idea! Cheers Armin Armin Nolte Database-Marketing Deutsche Behindertenhilfe - Aktion Mensch e.V. Heinemannstr. 36 53175 Bonn Tel.: 0228-2092-233 Fax: 0228-2092-222 www.aktion-mensch.de___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: perl starts very slow using WIN32::OLE
I suspect that some of your type libraries are stored on a network share and not local. This may make reading the library rather slow. You may want to use a tool like Process Monitor (from Sysinternals, now Microsoft) to see which files are being accessed by the Perl process during this call. Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: September 5, 2008 2:56 AM To: perl-win32-users@listserv.ActiveState.com Subject: perl starts very slow using WIN32::OLE Hi, I have a real big perl program - it runs already for a couple of years and I am always adding some features. So since a few days it needs over 2 Minutes to start!!! I did a profiling and the problem seems to be the Win32::OLE::Const:::_Typelib So here is the actual output of the profiler: # %TimeSec. #calls sec/call F name 68.28 137.9805 777 0.177581 Win32::OLE::Const::_Typelib -- so perl needs 137 seconds for 777 calls!!! -- the first line (Win32::OLE operating in debugging mode: _Unique = 1) when starting the programm comes at once and after that I have to wait for a while = seems that the first call to Win32::OLE::Const::_Typelib need so long ???. Is perl searching the lib? And this is the output of the same program months ago: # %TimeSec. #calls sec/call F name 1.120.0794 686 0.000116 Win32::OLE::Const::_Typelib I'll be thankfull for any idea! Cheers Armin Armin Nolte Database-Marketing Deutsche Behindertenhilfe - Aktion Mensch e.V. Heinemannstr. 36 53175 Bonn Tel.: 0228-2092-233 Fax: 0228-2092-222 www.aktion-mensch.de ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE help
Hello Steve, It does work and my machine shows the same values for minimise and maximise .. But what does these value depend on ? I checked in another machine and the maximise value is -4137 ... Where do i find the constants declared for these ? Thanks and Regards Maxmelbin Neson From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Howard (PFE) Sent: Friday, 15. August 2008 1:34 AM To: Neson Maxmelbin (RBEI/EMT4); perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE help I'll type this directly in so I might make a typo. You should be able to set the state in the application object: $Excel-{WindowState} = -4140; To set back to normal mode: $Excel-{WindowState} = -4143; The way to find this is to record a macro in Excel, and do what you want to see. Then view the macros and see what was done. In this case, the macro uses constants xlMinimized, and xlNormal. You can use the object browser to see the values of those constants. They're probably in the constants you have imported as well, so it would probably be better to use them there rather than the literal values. See if this helps. Steve From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neson Maxmelbin (RBEI/EMT4) Sent: Thursday, August 14, 2008 4:30 AM To: perl-win32-users@listserv.ActiveState.com Subject: WIN32::OLE help Hello , I am using WIn32::OLE to Read contents of an Excel sheet. There is no issues on reading, but the problem is that Excel file opens on the screen, during the time the script processes the file. I don't need this. One solution was to make it not visible ($Excel-{'Visible'} = 0;). But this had some other problems. In some cases, when this Excel sheet was open for viewing, its contents were hidden ! , when we move the mouse over the cells, then we see it .. might be a Excel Bug. Due this we cannot make the Excel sheet invisible during the runnign of the script. What I need now is to minimise the sheet once it is opened. How do we do it ? My code extract - use Win32::OLE::Const 'Microsoft Excel'; $Excel = Win32::OLE-GetActiveObject('Excel.Application')|| Win32::OLE-new('Excel.Application', 'Quit'); $Excel-{'Visible'} = 1; $xlFile = 'C:\HWEConfig.xls'; eval { $Book = $Excel-Workbooks-Open($xlFile); }; ... then the reading Thanks and Regards Maxmelbin Neson ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE help
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neson Maxmelbin (RBEI/EMT4) Sent: 18 August 2008 09:40 To: Steve Howard (PFE); perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE help Hello Steve, It does work and my machine shows the same values for minimise and maximise .. But what does these value depend on ? I checked in another machine and the maximise value is -4137 ... Where do i find the constants declared for these ? They are declared by the module that you have already included, i.e. Win32::OLE::Const. See the documentation for that module (you should probably have done that before using it in your code). However, as I am feeling generous, try either: use Win32::OLE::Const 'Microsoft Excel'; print xlMaximized: , xlMaximized, \n; print xlMinimized: , xlMinimized, \n; print xlNormal: , xlNormal, \n; ... or if you don't want to polute your main namespace so much try this: use Win32::OLE::Const; my $consts = Win32::OLE::Const-Load('Microsoft Excel'); print xlMaximized: $consts-{xlMaximized}\n; print xlMinimized: $consts-{xlMinimized}\n; print xlNormal: $consts-{xlNormal}\n; To find the constant names, or anything to do with using OLE on such applications, it is useful to read the relevant parts of the Visual Basic Reference for that application, under the help menu. Another damned useful tool is the OLE browser kindly provided with the Activestate documentation. I found the constant names mentioned above in both. HTH -- Brian Raven Visit our website at http://www.nyse.com Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Group, Inc. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
SOLVED: WIN32::OLE help
Thanks everyone .. I used $Excel-{WindowState} = xlMinimized; and it works .. so I need not worry about changes for these constants (if any) Thanks and Regards Maxmelbin Neson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Raven Sent: Monday, 18. August 2008 2:40 PM To: perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE help From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neson Maxmelbin (RBEI/EMT4) Sent: 18 August 2008 09:40 To: Steve Howard (PFE); perl-win32-users@listserv.ActiveState.com Subject: RE: WIN32::OLE help Hello Steve, It does work and my machine shows the same values for minimise and maximise .. But what does these value depend on ? I checked in another machine and the maximise value is -4137 ... Where do i find the constants declared for these ? They are declared by the module that you have already included, i.e. Win32::OLE::Const. See the documentation for that module (you should probably have done that before using it in your code). However, as I am feeling generous, try either: use Win32::OLE::Const 'Microsoft Excel'; print xlMaximized: , xlMaximized, \n; print xlMinimized: , xlMinimized, \n; print xlNormal: , xlNormal, \n; ... or if you don't want to polute your main namespace so much try this: use Win32::OLE::Const; my $consts = Win32::OLE::Const-Load('Microsoft Excel'); print xlMaximized: $consts-{xlMaximized}\n; print xlMinimized: $consts-{xlMinimized}\n; print xlNormal: $consts-{xlNormal}\n; To find the constant names, or anything to do with using OLE on such applications, it is useful to read the relevant parts of the Visual Basic Reference for that application, under the help menu. Another damned useful tool is the OLE browser kindly provided with the Activestate documentation. I found the constant names mentioned above in both. HTH -- Brian Raven Visit our website at http://www.nyse.com Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Group, Inc. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: WIN32::OLE help
Hello, if you just want to read data from an Excel file, you might consider the Spreadsheet::ParseExcel module. I would think that using the OLE module always starts an Excel instance (visible or not) whereas the Spreadsheet module operates directly on the XLS file. Ekkehard _ CONFIDENTIALITY NOTICE The information contained in this e-mail message is intended only for the exclusive use of the individual or entity named above and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivery of the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the material from any computer. Thank you. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: WIN32::OLE help
I'll type this directly in so I might make a typo. You should be able to set the state in the application object: $Excel-{WindowState} = -4140; To set back to normal mode: $Excel-{WindowState} = -4143; The way to find this is to record a macro in Excel, and do what you want to see. Then view the macros and see what was done. In this case, the macro uses constants xlMinimized, and xlNormal. You can use the object browser to see the values of those constants. They're probably in the constants you have imported as well, so it would probably be better to use them there rather than the literal values. See if this helps. Steve From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neson Maxmelbin (RBEI/EMT4) Sent: Thursday, August 14, 2008 4:30 AM To: perl-win32-users@listserv.ActiveState.com Subject: WIN32::OLE help Hello , I am using WIn32::OLE to Read contents of an Excel sheet. There is no issues on reading, but the problem is that Excel file opens on the screen, during the time the script processes the file. I don't need this. One solution was to make it not visible ($Excel-{'Visible'} = 0;). But this had some other problems. In some cases, when this Excel sheet was open for viewing, its contents were hidden ! , when we move the mouse over the cells, then we see it .. might be a Excel Bug. Due this we cannot make the Excel sheet invisible during the runnign of the script. What I need now is to minimise the sheet once it is opened. How do we do it ? My code extract - use Win32::OLE::Const 'Microsoft Excel'; $Excel = Win32::OLE-GetActiveObject('Excel.Application')|| Win32::OLE-new('Excel.Application', 'Quit'); $Excel-{'Visible'} = 1; $xlFile = 'C:\HWEConfig.xls'; eval { $Book = $Excel-Workbooks-Open($xlFile); }; ... then the reading Thanks and Regards Maxmelbin Neson ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Errors attempting to enumerate registry keys using Win32::OLE WMI
G'Day, I think I've uncovered a bug as I'm getting the following error message when attempting to call the EnumValues method of the StdRegProv WMI class: Faulting application perl.exe, version 5.10.0.1002, faulting module perl510.dll, version 5.10.0.1002, fault address 0x00074d42. I'm also getting the error running the script on another server running Perl v5.8.8 build 822: Faulting application perl.exe, version 5.8.8.822, faulting module perl58.dll, version 5.8.8.822, fault address 0x00064c84. The attached script attempts to identify persistent routes in the target computer's routing table. It does so by enumerating the values under the HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes registry key. The script works when there are values under the key, but craps out with the error message when the registry key is empty (i.e. no persistent routes). Thanks, Larry EnumValues.pl Description: EnumValues.pl ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE -- assignment to property of type IUnknown..how?
I have a COM component with a property defined like this (IDL): [propput, id(30), helpstring(property TestSuite)] HRESULT TestSuite([in] IUnknown *pVal); [propget, id(30), helpstring(property TestSuite)] HRESULT TestSuite([out, retval] IUnknown **ppVal); ..basically it gets/sets a dual interface object that is implemented in a different COM component. Using Win32::OLE, it doesn't let me do a normal property assignment -- i.e. this fails: $myObj-{TestSuite} = $someOtherObj; ..however, it DOES let me do by ref assigment: $myObj-LetProperty('TestSuite', $someOtherObj); Can someone explain why? I would prefer (for consistency with other properties) to use the SetProperty style of assignment instead of LetProperty - is there something I need to change in my IDL to make the SetProperty style work? Thanks, Mike Ellery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE -- assignment to property of type IUnknown..how?
On Wed, 28 May 2008, Michael Ellery wrote: I have a COM component with a property defined like this (IDL): [propput, id(30), helpstring(property TestSuite)] HRESULT TestSuite([in] IUnknown *pVal); Try adding a second line here: [propputref, id(30), helpstring(property TestSuite)] HRESULT TestSuite([in] IUnknown *pVal); (identical to the previous line, except propput = propputref). Not sure if this is enough, but maybe it is sufficient to get the required IDispatch glue generated for you. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE problem
Using Win32::OLE to create an ADO object and then query Active Directory using an LDAP query the last field returned contains the additional text of ;Subtree; in the fields name. My query string: LDAP://OU=Business_Functions,OU=Global Groups,DC=xxx,DC=com;(objectCategory=group);distinguishedName, cn, sAMAccountName; subtree;; Once the data is returned, the enumeration of the field names using the code below shows: distinguishedName cn sAMAccountName; subtree; my @Fields = $resObj-Fields; foreach my $field (in @Fields){ print $field-{Name} .\n; } Howard A. Bullock Tyco Electronics Computer Security 717-810-3584 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE problem
Removing the trailing semi-colon did the trick. From: Howard Tanner [mailto:[EMAIL PROTECTED] It's been a while, so I looked it up. From MS: LDAP://DC=Fabrikam,DC=com;(objectClass=*);AdsPath, cn;subTree So remove the space before subTree and the semi-colon following it. If that still doesn't work, your query might be case sensitive, so fix the capitalization for subTree. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE different connections methods produce different results
Hi, It seems what when using perl Win32::OLE for WMI queries it produces different results depending on method used to connect to server, examples bellow, can somebody explain this issue? Examples Using ConnectServer() I get ActiveSessions: 0 TotalSessions: 0 Script #!/usr/bin/perl use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately = 0x10; use constant wbemFlagForwardOnly = 0x20; my $computer = server; my $user = 'DOMAIN\USER'; my $pwd = password; my $wmipath = 'root\\cimv2'; print \n; print ==\n; print Computer: $computer\n; print ==\n; my $wmiwebloc = Win32::OLE-new('WbemScripting.SWbemLocator'); my $wmi = $wmiwebloc-ConnectServer($computer,$wmipath,$user, $pwd); $wmi-{Security_}-{ImpersonationLevel} = 3; if (Win32::OLE::LastError()) { print 'Authentication failed: ' . ('' . Win32::OLE::LastError()), \n; } my $colItems = $wmi-ExecQuery(SELECT * FROM Win32_PerfRawData_TermService_TerminalServices, WQL, wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print ActiveSessions: $objItem-{ActiveSessions}\n; print Caption: $objItem-{Caption}\n; print Description: $objItem-{Description}\n; print Frequency_Object: $objItem-{Frequency_Object}\n; print Frequency_PerfTime: $objItem-{Frequency_PerfTime}\n; print Frequency_Sys100NS: $objItem-{Frequency_Sys100NS}\n; print InactiveSessions: $objItem-{InactiveSessions}\n; print Name: $objItem-{Name}\n; print Timestamp_Object: $objItem-{Timestamp_Object}\n; print Timestamp_PerfTime: $objItem-{Timestamp_PerfTime}\n; print Timestamp_Sys100NS: $objItem-{Timestamp_Sys100NS}\n; print TotalSessions: $objItem-{TotalSessions}\n; print \n; } Output == Computer: server == ActiveSessions: 0 Caption: Description: Frequency_Object: 1000 Frequency_PerfTime: 260595 Frequency_Sys100NS: 1000 InactiveSessions: 0 Name: Timestamp_Object: 128511849607031250 Timestamp_PerfTime: 5097696116216139 Timestamp_Sys100NS: 18446742399360059616 TotalSessions: 0 While Using Win32::OLE-GetObject I get ActiveSessions: 1 TotalSessions: 2 Script #!/usr/bin/perl use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately = 0x10; use constant wbemFlagForwardOnly = 0x20; my $computer = server; my $user = 'Domain\User'; my $pwd = password; my $wmipath = 'root\\cimv2'; print \n; print ==\n; print Computer: $computer\n; print ==\n; my $wmi = Win32::OLE-GetObject(winmgmts:$computer\\root\ \CIMV2) or die WMI connection failed.\n; my $colItems = $wmi-ExecQuery(SELECT * FROM Win32_PerfRawData_TermService_TerminalServices, WQL, wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print ActiveSessions: $objItem-{ActiveSessions}\n; print Caption: $objItem-{Caption}\n; print Description: $objItem-{Description}\n; print Frequency_Object: $objItem-{Frequency_Object}\n; print Frequency_PerfTime: $objItem-{Frequency_PerfTime}\n; print Frequency_Sys100NS: $objItem-{Frequency_Sys100NS}\n; print InactiveSessions: $objItem-{InactiveSessions}\n; print Name: $objItem-{Name}\n; print Timestamp_Object: $objItem-{Timestamp_Object}\n; print Timestamp_PerfTime: $objItem-{Timestamp_PerfTime}\n; print Timestamp_Sys100NS: $objItem-{Timestamp_Sys100NS}\n; print TotalSessions: $objItem-{TotalSessions}\n; print \n; } Output == Computer: server == ActiveSessions: 1 Caption: Description: Frequency_Object: 1000 Frequency_PerfTime: 260595 Frequency_Sys100NS: 1000 InactiveSessions: 1 Name: Timestamp_Object: 128511890915625000 Timestamp_PerfTime: 5108460132511734 Timestamp_Sys100NS: 18446742440665596616 TotalSessions: 2 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE and hidden methods
Can Win32::OLE access methods/props marked as hidden in the IDL? There happens to be one property we have marked as such and I tried the naive thing: my $secret = $object-HiddenProperty ...and it was rejected. Is there some way to ask Win32::OLE to ignore the hidden attribute? TIA, Mike Ellery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: [Fwd: storable and Win32::OLE::Variant]
h for some reason, i thought that use Win32::OLE::Variant did stringify Win32::OLE::Variant objects. my understanding now is that it just makes these display correctly if they are dates. i am a newbie to Win32::OLE::Variant. could you point me towards some example code that shows how to: 1. test whether or not a variable is indeed a Win32::OLE::Variant date object 2. stringify a Win32::OLE::Variant date object thanks, kevin Jan Dubois wrote: On Fri, 01 Feb 2008, Kevin Beverly wrote: i have an active state perl program that parses ms excel files for loading into postgresql. i use use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; to get the dates as text from a spreadsheet. i store the data as an array of hashes and write it to disk with storable. everything works fine until i try to retrieve the storable file. as soon as it hits that date field, perl crashes. it works fine, tho if i format the date fields as text. obviously, this could be an issue with storable. i sent this issue to those folks as well. You cannot freeze() Win32::OLE::Variant objects because they are implemented in C and have additional information hanging on to them that Storable knows nothing about. This could be made to work for most Variant types by adding special Storable freeze/thaw hooks to Win32::OLE::Variant (e.g. it would obviously not work for VT_DISPATCH and VT_OBJECT). I'll file this as an enhancement request for Win32::OLE. For the time being it would probably be easiest to stringify Win32::OLE::Variant objects before freezing them. Cheers, -Jan -- *** Kevin Beverly Systems Analyst/Programmer SCHARP / HIVNET Statistical Center 1100 Fairview Ave. North, LE-400 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: [EMAIL PROTECTED] Phone: 206-667-6991 Fax: 206-667-4812 *** CONFIDENTIALITY NOTICE: This e-mail message and any attachments may be confidential and privileged. If you are not intended to receive this message, please notify the sender and destroy the message. Thank you. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: [Fwd: storable and Win32::OLE::Variant]
On Thu, 07 Feb 2008, Kevin Beverly wrote: h for some reason, i thought that use Win32::OLE::Variant did stringify Win32::OLE::Variant objects. my understanding now is that it just makes these display correctly if they are dates. i am a newbie to Win32::OLE::Variant. could you point me towards some example code that shows how to: 1. test whether or not a variable is indeed a Win32::OLE::Variant date object if (ref($var) UNIVERSAL::isa($var,'Win32::OLE::Variant')) { # $var is a Win32::OLE::Variant object } 2. stringify a Win32::OLE::Variant date object my $str = $var; # $str now contains the stringified representation of $var Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
properties, VT types, and Win32::OLE
Given some object and a property: my $obj = new Win32::OLE(SOME.class); my $val = $obj-{SomeProperty}; ...is there some way to determine the VT type of $val (or of SomeProperty, equivalently). I often run into strange problems where I expect a 32 bit negative value from some property, but when I simply print it, perl shows it as a large positive value. It is bit equivalent to the expected negative value, but somehow not being interpreted with the corrected sign-ed-ness. The first thing I would like to check is the VT type that Win32::OLE thought it got -- then I'll see if I agree with how Win32::OLE is converting to perl scalars based on the VT type. Advice appreciated. -Mike Ellery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: properties, VT types, and Win32::OLE
Jan Dubois wrote: On Mon, 04 Feb 2008, Michael Ellery wrote: Given some object and a property: my $obj = new Win32::OLE(SOME.class); my $val = $obj-{SomeProperty}; ...is there some way to determine the VT type of $val (or of SomeProperty, equivalently). I often run into strange problems where I expect a 32 bit negative value from some property, but when I simply print it, perl shows it as a large positive value. It is bit equivalent to the expected negative value, but somehow not being interpreted with the corrected sign-ed-ness. The first thing I would like to check is the VT type that Win32::OLE thought it got -- then I'll see if I agree with how Win32::OLE is converting to perl scalars based on the VT type. I haven't tested this, but you should be able to do something like this: my $prop = Win32::OLE::Variant-new(); $obj-Dispatch('SomeProperty', $prop); print V_VT(prop)=%d\n, $prop-Type); With two minor syntax fixes to the print line, this works great. Thanks! -Mike ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: properties, VT types, and Win32::OLE
On Mon, 04 Feb 2008, Michael Ellery wrote: Given some object and a property: my $obj = new Win32::OLE(SOME.class); my $val = $obj-{SomeProperty}; ...is there some way to determine the VT type of $val (or of SomeProperty, equivalently). I often run into strange problems where I expect a 32 bit negative value from some property, but when I simply print it, perl shows it as a large positive value. It is bit equivalent to the expected negative value, but somehow not being interpreted with the corrected sign-ed-ness. The first thing I would like to check is the VT type that Win32::OLE thought it got -- then I'll see if I agree with how Win32::OLE is converting to perl scalars based on the VT type. I haven't tested this, but you should be able to do something like this: my $prop = Win32::OLE::Variant-new(); $obj-Dispatch('SomeProperty', $prop); print V_VT(prop)=%d\n, $prop-Type); Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[Fwd: storable and Win32::OLE::Variant]
hi, i have an active state perl program that parses ms excel files for loading into postgresql. i use use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; to get the dates as text from a spreadsheet. i store the data as an array of hashes and write it to disk with storable. everything works fine until i try to retrieve the storable file. as soon as it hits that date field, perl crashes. it works fine, tho if i format the date fields as text. obviously, this could be an issue with storable. i sent this issue to those folks as well. let me know if you would like more details. thanks, kevin ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: [Fwd: storable and Win32::OLE::Variant]
On Fri, 01 Feb 2008, Kevin Beverly wrote: i have an active state perl program that parses ms excel files for loading into postgresql. i use use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; to get the dates as text from a spreadsheet. i store the data as an array of hashes and write it to disk with storable. everything works fine until i try to retrieve the storable file. as soon as it hits that date field, perl crashes. it works fine, tho if i format the date fields as text. obviously, this could be an issue with storable. i sent this issue to those folks as well. You cannot freeze() Win32::OLE::Variant objects because they are implemented in C and have additional information hanging on to them that Storable knows nothing about. This could be made to work for most Variant types by adding special Storable freeze/thaw hooks to Win32::OLE::Variant (e.g. it would obviously not work for VT_DISPATCH and VT_OBJECT). I'll file this as an enhancement request for Win32::OLE. For the time being it would probably be easiest to stringify Win32::OLE::Variant objects before freezing them. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[OLE] Problems instantiating a Win32::OLE object near the end of script
Hello, Problem Description I am experiencing erratic problems with a Perl script as of late. When attempting to instantiate a Win32::OLE object (CDO.Message) near the end of the script (5,000 lines), the script simply ends without any error. The %ERRORLEVEL% at that point has the value -1073741819. Less frequently, the script will either hang or end (once again without error) elsewhere in the script. Testing Performed When I attempt to instantiate any other type of non-Win32::OLE object at that point in the script, the instantiation succeeds. Enumerating all of the OLE objects just prior to instantiating the new variable produces the following: Object=Win32::OLE=HASH(0x32db1a8) Class=ADODB _Recordset Object=Win32::OLE=HASH(0x33017f8) Class=WbemScripting ISWbemObjectSet Object=Win32::OLE=HASH(0x32ddce4) Class=WbemScripting ISWbemObjectEx Object=Win32::OLE=HASH(0x32ddcb4) Class=WbemScripting ISWbemServicesEx Object=Win32::OLE=HASH(0x2ca3324) Class=WbemScripting ISWbemServicesEx Object=Win32::OLE=HASH(0x32dd60c) Class=WbemScripting ISWbemLocator Object=Win32::OLE=HASH(0x32db184) Class=ADODB _Recordset Object=Win32::OLE=HASH(0x32dd2b8) Class=ADODB _Recordset Object=Win32::OLE=HASH(0x32da8f0) Class=ADODB _Connection If, at the beginning of the script, I call the subroutine that instantiates this particular object, it works flawlessly! My gut leads me to believe that it is a resource allocation issue. Environment * Windows Server 2003 Standard Edition SP2 * ActivePerl v5.8.8.822 What could I use/do to help isolate the problem? Would I be able to use a debugging tool such as Komodo in order to determine if it is indeed a resource allocation issue? Thanks, Larry http://www.cgi.com/ Larry LeBlanc Senior Consultant / Conseiller Principal B.COMM.(M.I.S.), MCSE/2000, MCSA/2000, MCDBA/2000, CNE-3 Services Web / Web Services 1350, boulevard René-Lévesque ouest Bureau 17.710 Montréal (Québec) H3G 1T4 Tel: (514) 415-3000 x5024 Fax: (514) 415-3987 AVIS DE CONFIDENTIALITÉ / CONFIDENTIALITY NOTICE: Ce message peut contenir des renseignements confidentiels appartenant exclusivement au Groupe CGI Inc. ou à ses filiales. Si vous n'êtes pas le destinataire indiqué dans ce message (ou responsable de livrer ce message à la personne indiquée ou prévue) ou si vous pensez que ce message vous a été adressé par erreur, vous ne pouvez pas utiliser ou reproduire ce message, ni le livrer à quelqu'un d'autre. Dans ce cas, vous devez le détruire et vous êtes prié d'avertir l'expéditeur en répondant au courriel. Proprietary Confidential Information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply email. image001.gif___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE and VT_INT
just running some quick COM code in perl and I notice this: if I call a property or method that returns VT_I4, Win32::OLE maps that to a perl integer in scalar context. When I call a property or method that returns VT_INT, however, it gets mapped to a perl string. Is this deliberate? Is it correct behavior? I can work around my current issue by just doing int() around my values, but it seemed strange to me that these two cases produced slightly different scalars. Thanks, Mike Ellery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE and VT_INT
On Wed, 09 Jan 2008, Michael Ellery wrote: just running some quick COM code in perl and I notice this: if I call a property or method that returns VT_I4, Win32::OLE maps that to a perl integer in scalar context. When I call a property or method that returns VT_INT, however, it gets mapped to a perl string. Is this deliberate? Is it correct behavior? I can work around my current issue by just doing int() around my values, but it seemed strange to me that these two cases produced slightly different scalars. It is a bug in Win32::OLE: it doesn't handle VT_INT (nor VT_UINT) explicitly and therefore tries to coerce it into VT_BSTR (using VariantChangeTypeEx) before turning it into a Perl scalar. At the Perl level this shouldn't really matter though, as strings are converted back to integers/numbers automatically whenever needed. I don't know why it was never handled explicitly; I just checked, and even the wtypes.h from VC98 lists VT_INT as a valid type for a VARIANT. I'll fix it in a future Win32::OLE release. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE and VT_INT
Jan Dubois wrote: On Wed, 09 Jan 2008, Michael Ellery wrote: just running some quick COM code in perl and I notice this: if I call a property or method that returns VT_I4, Win32::OLE maps that to a perl integer in scalar context. When I call a property or method that returns VT_INT, however, it gets mapped to a perl string. Is this deliberate? Is it correct behavior? I can work around my current issue by just doing int() around my values, but it seemed strange to me that these two cases produced slightly different scalars. It is a bug in Win32::OLE: it doesn't handle VT_INT (nor VT_UINT) explicitly and therefore tries to coerce it into VT_BSTR (using VariantChangeTypeEx) before turning it into a Perl scalar. At the Perl level this shouldn't really matter though, as strings are converted back to integers/numbers automatically whenever needed. I don't know why it was never handled explicitly; I just checked, and even the wtypes.h from VC98 lists VT_INT as a valid type for a VARIANT. I'll fix it in a future Win32::OLE release. Cheers, -Jan Jan, Thanks for the quick response. In my case, I only noticed the behavior because I am passing the output to another property - and that property put wasn't expecting a string. It went something like this: my $foo = $oleObject-Some_VT_INT_Property; $oleObject-{Some_VARIANT_Property} = $foo; The VT_TYPE coming into my put_Some_VARIANT_Property was actually VT_BSTR in this case, which I was not expecting. Simply wrapping int() around the get call works fine, but a fix to Win32::OLE would be great. I think I'll also update my VARIANT processing on the put. Thanks, Mike ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE and VT_INT
On Wed, 09 Jan 2008, Michael Ellery wrote: The VT_TYPE coming into my put_Some_VARIANT_Property was actually VT_BSTR in this case, which I was not expecting. Simply wrapping int() around the get call works fine, but a fix to Win32::OLE would be great. I think I'll also update my VARIANT processing on the put. I think you should do that. I don't know if there is some normative text about this, but I've seen several references that say that the IDispatch::Invoke implementation is responsible for the coercion of all parameters to the expected type (if possible). E.g. the remarks section of the VariantChangeTypeEx() documentation says: | Typically, the implementer of IDispatch::Invoke determines which | member is being accessed and then calls VariantChangeType to get the | value of one or more arguments. | | For example, if the IDispatch call specifies a SetTitle member that | takes one string argument, the implementor would call | VariantChangeTypeEx to attempt to coerce the argument to VT_BSTR. [from http://msdn2.microsoft.com/en-us/library/aa909107.aspx] Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
win32::ole (excel) question
Hi all, Weird situation with creating new worksheets and keeping the title in the tab. I f I create just one everything is fine - when I add a second worksheet to the workbook the title goes away from the original worksheet. Code excerpt: This is where the object is instanciated and the first worksheet is created and named: #--create and open the first worksheet my $excel = Win32::OLE-new(Excel.Application); $excel-{Visible} = 1; my $book = $excel-Workbooks-Add; my $sheet = $book-Worksheets(1); $sheet-{Name} = Daily Message Volume By Queue Manager; **cells are filled in and formatted - everything looks great to this point Here'e where the next worksheet is added: #--create and open the second worksheet $sheet = $book-Worksheets-Add; $sheet-{Name} = Daily Message Volume By Queue; $sheet-Columns-{ColumnWidth} = 24; **When this worksheet is created the first worksheet goes back to being named Sheet1 Any thoughts greatly appreciated. Thanks in advance. Dave Kazatsky Senior Middleware Engineer NSE - Solutions Engineering W. (732) 893-4351 C. (973) 865-8106 The information contained in this message may be CONFIDENTIAL and is for the intended addressee only. Any unauthorized use, dissemination of the information, or copying of this message is prohibited. If you are not the intended addressee, please notify the sender immediately and delete this message. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: win32::ole (excel) question
Hi Jan, You're abolutely right - I forgot I had changed the name I was using to set Sheet1. I changed to a shorter length and it's running perfect. Thanks much. Dave Kazatsky Senior Middleware Engineer NSE - Solutions Engineering W. (732) 893-4351 C. (973) 865-8106 Jan Dubois [EMAIL PROTECTED] .com To [EMAIL PROTECTED], 08/10/2007 02:22 [EMAIL PROTECTED] PMte.com cc Subject RE: win32::ole (excel) question The first sheet name is never changed from “Sheet1” to begin with because you are trying to set it to a name with 37 characters. The maximum sheet name length in Excel is 31 characters. It would be nice if Excel returned an error if you try to assign an invalid name, but it doesn’t appear to do so. Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: August 10, 2007 10:30 AM To: perl-win32-users@listserv.ActiveState.com Subject: win32::ole (excel) question Hi all, Weird situation with creating new worksheets and keeping the title in the tab. I f I create just one everything is fine - when I add a second worksheet to the workbook the title goes away from the original worksheet. Code excerpt: This is where the object is instanciated and the first worksheet is created and named: #--create and open the first worksheet my $excel = Win32::OLE-new(Excel.Application); $excel-{Visible} = 1; my $book = $excel-Workbooks-Add; my $sheet = $book-Worksheets(1); $sheet-{Name} = Daily Message Volume By Queue Manager; **cells are filled in and formatted - everything looks great to this point Here'e where the next worksheet is added: #--create and open the second worksheet $sheet = $book-Worksheets-Add; $sheet-{Name} = Daily Message Volume By Queue; $sheet-Columns-{ColumnWidth} = 24; **When this worksheet is created the first worksheet goes back to being named Sheet1 Any thoughts greatly appreciated. Thanks in advance. Dave Kazatsky Senior Middleware Engineer NSE - Solutions Engineering W. (732) 893-4351 C. (973) 865-8106 The information contained in this message may be CONFIDENTIAL and is for the intended addressee only. Any unauthorized use, dissemination of the information, or copying of this message is prohibited. If you are not the intended addressee, please notify the sender immediately and delete this message. The information contained in this message may be CONFIDENTIAL and is for the intended addressee only. Any unauthorized use, dissemination of the information, or copying of this message is prohibited. If you are not the intended addressee, please notify the sender immediately and delete this message. inline: graycol.gifinline: pic26421.gifinline: ecblank.gif___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: win32::ole (excel) question
The first sheet name is never changed from Sheet1 to begin with because you are trying to set it to a name with 37 characters. The maximum sheet name length in Excel is 31 characters. It would be nice if Excel returned an error if you try to assign an invalid name, but it doesn't appear to do so. Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: August 10, 2007 10:30 AM To: perl-win32-users@listserv.ActiveState.com Subject: win32::ole (excel) question Hi all, Weird situation with creating new worksheets and keeping the title in the tab. I f I create just one everything is fine - when I add a second worksheet to the workbook the title goes away from the original worksheet. Code excerpt: This is where the object is instanciated and the first worksheet is created and named: #--create and open the first worksheet my $excel = Win32::OLE-new(Excel.Application); $excel-{Visible} = 1; my $book = $excel-Workbooks-Add; my $sheet = $book-Worksheets(1); $sheet-{Name} = Daily Message Volume By Queue Manager; **cells are filled in and formatted - everything looks great to this point Here'e where the next worksheet is added: #--create and open the second worksheet $sheet = $book-Worksheets-Add; $sheet-{Name} = Daily Message Volume By Queue; $sheet-Columns-{ColumnWidth} = 24; **When this worksheet is created the first worksheet goes back to being named Sheet1 Any thoughts greatly appreciated. Thanks in advance. Dave Kazatsky Senior Middleware Engineer NSE - Solutions Engineering W. (732) 893-4351 C. (973) 865-8106 The information contained in this message may be CONFIDENTIAL and is for the intended addressee only. Any unauthorized use, dissemination of the information, or copying of this message is prohibited. If you are not the intended addressee, please notify the sender immediately and delete this message. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE Bug? Excel PivotCache.CommandText
Hi Folks, Hoping someone has encountered this so that I don't have to start hacking around in the source code. I have an application that uses changes the WorkBook.PivotCache.CommandText property in an Excel 2003 workbook. I do it as advertised: $pc-{CommandText} = $sql; It works as advertised. When the CommandText property changes, the query is executed and data is refreshed. The problem is that it works too well. The aggresive bugger executed the query 3 times. Through various debugging efforts, I have tracked it down to this statement. And the error is consistent. I don't believe that this is a MS problem. When I write the similar VB code: Dim pc as PivotCache ... pc.CommandText = sql The query executes once and only once. Same results at 1/3 the effort. I have tried variations on setting the property with LetProperty with no difference. So long as I try and set the CommandText property from Perl it executes the query 3 times. For all I know, the problem might be ubiquitous and by design and that whenever the module set a property it does so three times, but is only noticeable when the setting of the property take a noticeable amount of time as in my case. In the end it works, but it is kinda a drag if your query takes 5 minutes. My questions are: 1) Am I doing something wrong? 1) Is this a known behaviour? 2) Is it avoidable? 3) Failing the above, where in the source code should I begin to debug? I am using: Windows XP, Perl 5.8.8 Build 5.17, and the most recent version of libwin/Win32::OLE downloaded using ppm3 from ActiveState. Thanks in Advance, Chris ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using Win32::OLE to Query Exchange Remotely
The following code has the benefit of using NT credentials of the currently logged in user. But, the currently logged in user needs to have access in Exchange. :) No passwords in clear text to glean from your scripts That's usually a good thing. :) $OLECon = Win32::OLE-GetObject(winmgmts:$host\\root\\MicrosoftExchangeV2) || die Cannot access WMI on remote machine: , Win32::OLE-LastError; EXCELLENT! Thanks, Dax ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Using Win32::OLE to Query Exchange Remotely
I use this to query Exchange Mailbox and Public Folder sizes locally on the server: use Win32::OLE qw(in); # Get item counts and sizes for each mailbox on the target server # my $OLECon= Win32::OLE-GetObject('winmgmts:localhost\\root\\MicrosoftExchangeV2') or die WMI Connection Failed\n; my $MailBoxes = $OLECon-ExecQuery(Select * From Exchange_Mailbox) or die WMI Query Failed!\n; print ---\n; print - Mailbox Size Report -\n; print ---\n; foreach my $mailbox (in $MailBoxes) { print MailboxDisplayName: . . $mailbox-MailboxDisplayName . \n . \tSize: .. . $mailbox-Size . \n . \tTotalItems: . . $mailbox-TotalItems . \n . \tStoreName: . . $mailbox-StoreName . \n; } print ---\n\n; my $MailBoxes = $OLECon-ExecQuery(Select * From Exchange_PublicFolder) or die WMI Query Failed!\n; print ---\n; print - Public Folders Size Report -\n; print ---\n; foreach my $mailbox (in $MailBoxes) { print AddressBookName: . . $mailbox-AddressBookName . \n . \tSize: .. . $mailbox-TotalMessageSize . \n . \tTotalItems: . . $mailbox-MessageCount . \n . \tStoreName: . . $mailbox-Path . \n; } How could I do the same thing remotely from a client workstation? Thanks, Dax ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Using Win32::OLE to Query Exchange Remotely
Figured it out: $host = 192.168.42.3; $user = vdom\\Administrator; $pass = password; $WMI = Win32::OLE-new('WbemScripting.SWbemLocator') || die Cannot access WMI on local machine: , Win32::OLE-LastError; $OLECon = $WMI-ConnectServer($host, root\\MicrosoftExchangeV2, $user, $pass) || die Cannot access WMI on remote machine: , Win32::OLE-LastError; Dax I use this to query Exchange Mailbox and Public Folder sizes locally on the server: use Win32::OLE qw(in); # Get item counts and sizes for each mailbox on the target server # my $OLECon= Win32::OLE-GetObject('winmgmts:localhost\\root\\MicrosoftExchangeV2') or die WMI Connection Failed\n; my $MailBoxes = $OLECon-ExecQuery(Select * From Exchange_Mailbox) or die WMI Query Failed!\n; print ---\n; print - Mailbox Size Report -\n; print ---\n; foreach my $mailbox (in $MailBoxes) { print MailboxDisplayName: . . $mailbox-MailboxDisplayName . \n . \tSize: .. . $mailbox-Size . \n . \tTotalItems: . . $mailbox-TotalItems . \n . \tStoreName: . . $mailbox-StoreName . \n; } print ---\n\n; my $MailBoxes = $OLECon-ExecQuery(Select * From Exchange_PublicFolder) or die WMI Query Failed!\n; print ---\n; print - Public Folders Size Report -\n; print ---\n; foreach my $mailbox (in $MailBoxes) { print AddressBookName: . . $mailbox-AddressBookName . \n . \tSize: .. . $mailbox-TotalMessageSize . \n . \tTotalItems: . . $mailbox-MessageCount . \n . \tStoreName: . . $mailbox-Path . \n; } How could I do the same thing remotely from a client workstation? Thanks, Dax ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using Win32::OLE to Query Exchange Remotely
The following code has the benefit of using NT credentials of the currently logged in user. But, the currently logged in user needs to have access in Exchange. :) No passwords in clear text to glean from your scripts That's usually a good thing. :) $OLECon = Win32::OLE-GetObject(winmgmts:$host\\root\\MicrosoftExchangeV2) || die Cannot access WMI on remote machine: , Win32::OLE-LastError; P.S. check out Win32::Exchange (in CPAN or elsewhere) for a lot of Exchange related CDO and AD manipulations. As well, suggest areas for improvement, etc. because I haven't done much to it in a while. For Exchange 5.5, 2000, 2003 and maybe even 2007.. Haven't tested it yet. :) Steven -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 5:52 PM To: perl-win32-users@listserv.activestate.com Subject: Re: Using Win32::OLE to Query Exchange Remotely Figured it out: $host = 192.168.42.3; $user = vdom\\Administrator; $pass = password; $WMI = Win32::OLE-new('WbemScripting.SWbemLocator') || die Cannot access WMI on local machine: , Win32::OLE-LastError; $OLECon = $WMI-ConnectServer($host, root\\MicrosoftExchangeV2, $user, $pass) || die Cannot access WMI on remote machine: , Win32::OLE-LastError; Dax I use this to query Exchange Mailbox and Public Folder sizes locally on the server: use Win32::OLE qw(in); # Get item counts and sizes for each mailbox on the target server # my $OLECon= Win32::OLE-GetObject('winmgmts:localhost\\root\\MicrosoftExchange V2') or die WMI Connection Failed\n; my $MailBoxes = $OLECon-ExecQuery(Select * From Exchange_Mailbox) or die WMI Query Failed!\n; print --- \n; print - Mailbox Size Report -\n; print - --\n; foreach my $mailbox (in $MailBoxes) { print MailboxDisplayName: . . $mailbox-MailboxDisplayName . \n . \tSize: .. . $mailbox-Size . \n . \tTotalItems: . . $mailbox-TotalItems . \n . \tStoreName: . . $mailbox-StoreName . \n; } print - --\n\n; my $MailBoxes = $OLECon-ExecQuery(Select * From Exchange_PublicFolder) or die WMI Query Failed!\n; print --- \n; print - Public Folders Size Report -\n; print - --\n; foreach my $mailbox (in $MailBoxes) { print AddressBookName: . . $mailbox-AddressBookName . \n . \tSize: .. . $mailbox-TotalMessageSize . \n . \tTotalItems: . . $mailbox-MessageCount . \n . \tStoreName: . . $mailbox-Path . \n; } How could I do the same thing remotely from a client workstation? Thanks, Dax ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Using Win32::OLE to Query Exchange Remotely
Thanks for sharing your work on Exhange (Win32::Exchange) with the community Steven. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE - filtering out ms word formatting characters
Hi, I am attempting to transfer data from a word table to Excel using Win32::OLE. I am able to do it with the following piece of code, but I am getting two little boxes after the text in each of the Excel cells. I presume these are Word formatting characters. How can I filter these out? I am using a test Word table of 5 rows and 5 columns. I have come across suggestions that one should save the Word file as an html file first. I did that and ran the program again after changing the input file name to tesfile.mht, but I am getting the same results. Perhaps I have to use some other module like HTML::PARSER. Isn't there some way I can do the filtering through Win32::OLE itself? use warnings; use strict; # INVOKE WIN32::OLE AND OPEN WORD AND EXCEL FILES # my($Word,$wordfile,$doc,$tbl,$wordcell); my($Excel,$excelfile,$book,$sheet,$excelcell); my($row,$col); use Win32::OLE qw(in with); use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Const 'Microsoft Word'; use Win32::OLE::Const 'Microsoft Office'; $Win32::OLE::Warn = 3; # Die on Errors. $wordfile = 'E:/jag/word_perl/testfile.doc'; $Word = Win32::OLE-GetActiveObject('Word.Application') || Win32::OLE-new('Word.Application', 'Quit'); $doc = $Word-Documents-Open($wordfile); $tbl = $doc-Tables(1); $excelfile = 'E:/jag/word_perl/testfile.xls'; $Excel = Win32::OLE-GetActiveObject('Excel.Application') || Win32::OLE-new('Excel.Application', 'Quit'); $book = $Excel-Workbooks-Open($excelfile); $sheet = $book-Worksheets(Sheet1); # TRANSFER DATA #== foreach $row(1..5) { foreach $col(1..5) { $wordcell = $tbl-Cell($row,$col)-Range-{Text}; $sheet-Cells($row,$col)-{Value} = $wordcell; } } $doc-Save; $doc-Close; $book-Save; $book-Close; ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE - filtering out ms word formatting characters
I guess these will just be CR/NL characters. You should be able to strip them in Perl, e.g. with $wordcell = $tbl-Cell($row,$col)-Range-{Text}; $wordcell =~ s/[\x00-\x1f]//g; $sheet-Cells($row,$col)-{Value} = $wordcell; Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jagdish eashwar Sent: May 11, 2007 6:13 PM To: perl-win32-users@listserv.activestate.com Subject: Win32::OLE - filtering out ms word formatting characters Hi, I am attempting to transfer data from a word table to Excel using Win32::OLE. I am able to do it with the following piece of code, but I am getting two little boxes after the text in each of the Excel cells. I presume these are Word formatting characters. How can I filter these out? I am using a test Word table of 5 rows and 5 columns. I have come across suggestions that one should save the Word file as an html file first. I did that and ran the program again after changing the input file name to tesfile.mht, but I am getting the same results. Perhaps I have to use some other module like HTML::PARSER. Isn't there some way I can do the filtering through Win32::OLE itself? use warnings; use strict; # INVOKE WIN32::OLE AND OPEN WORD AND EXCEL FILES # my($Word,$wordfile,$doc,$tbl,$wordcell); my($Excel,$excelfile,$book,$sheet,$excelcell); my($row,$col); use Win32::OLE qw(in with); use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Const 'Microsoft Word'; use Win32::OLE::Const 'Microsoft Office'; $Win32::OLE::Warn = 3; # Die on Errors. $wordfile = 'E:/jag/word_perl/testfile.doc'; $Word = Win32::OLE-GetActiveObject('Word.Application') || Win32::OLE-new('Word.Application', 'Quit'); $doc = $Word-Documents-Open($wordfile); $tbl = $doc-Tables(1); $excelfile = 'E:/jag/word_perl/testfile.xls'; $Excel = Win32::OLE-GetActiveObject('Excel.Application') || Win32::OLE-new('Excel.Application ', 'Quit'); $book = $Excel-Workbooks-Open($excelfile); $sheet = $book-Worksheets(Sheet1); # TRANSFER DATA #== foreach $row(1..5) { foreach $col(1..5) { $wordcell = $tbl-Cell($row,$col)-Range-{Text}; $sheet-Cells($row,$col)-{Value} = $wordcell; } } $doc-Save; $doc-Close; $book-Save; $book-Close; ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE - ? encoding of returned strings
When Win32::OLE uses CP_UTF8, then it will convert the UCS2 as returned from COM (the BSTR datatype) into UTF-8. There should be no loss of information in this step, as everything in UCS2 can also be represented in UTF8. The conversion is done by a Windows API and not by Perl internals. Win32::OLE then asks Perl to downgrade to a non-UTF-8 string if possible, because a lot of modules don't handle UTF-8 strings correctly. This step is error-prone, as Perl always assumes that byte strings are Latin-1 encoded and does not take the Windows code page into account. If *all* characters in the returned string are in Latin-1 and your Windows codepage is *not* 1252, then you may get distorted results. I guess I should put some support into Win32::OLE to force it to leave the string in UTF8. But I think this should be done in the wider context of teaching Perl to deal with Windows code pages better. Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Trotman Sent: April 29, 2007 2:36 PM To: perl-win32-users@listserv.ActiveState.com Subject: Re: Win32::OLE - ? encoding of returned strings Thanks - that's very useful. And I had missed the Unicode mode in the Win32::OLE documentation. To clarify: Part of my problem is that the MSXML XSLT transformations do NOT output the character encoding in the XML declaration. So - $xmldoc-transformNode($xsltsheet) may output Windows-1252 encoded data - but does not contain encoding='Windows-1252' in the !? xml version='1.0'? and so other parts of the process expect it to contain UTF-8. If I turn on the Win32::OLE UTF8 code page for a Win32::OLE call to MSXML that returns a UTF-16 string (or Windows-1252) - is the automatic conversion to UTF8 likely to be correct - or incorrect? IE - does the automatic conversion correctly detect the CP of the OLE output? Thanks Jan Dubois wrote: On Fri, 27 Apr 2007, Mike Trotman wrote: I am writing a CGI application that uses WIN32::OLE to interface to Microsoft ADO, MS Access, SQL Server and MSXML for XML documents and XSLT transformations. I suspect that something in the way I am passing data around (or in the ADO implementation of 'savetoxml') is not dealing correctly with XML document encoding declarations. The data is originally in an MS Access database - but has been entered using copy and paste from MS Word documents from around the world - so contains many weird and wonderful bytes. To help in my debugging process can anyone tell me how WIN32::OLE deals with 'strings' returned from method calls? i.e. - are they pure byte data as output by the method (and maybe in UTF-16)? - or are they converted to Perl's internal format (using any current Perl encoding settings)? - or does something else happen? The problems I am having are primarily when outputting XML documents (or HTML) to send to the browser. e.g.my $OUTPUT=; $OUTPUT=$xmldoc-transformNode($xsltsheet); print $OUTPUT; All string data is converted to the current system codepage by Win32::OLE before being passed back to Perl _unless_ you switch Win32::OLE to Unicode mode first: Win32::OLE-Option(CP = Win32::OLE::CP_UTF8()); After this call all strings are converted to UTF8 and marked as such in the Perl internal flags. Cheers, -Jan Message Scanned by ClamAV on datalucid.com -- Datalucid Limited 8 Eileen Road South Norwood London SE25 5EJ tel :+44-0208-239-6810 email: [EMAIL PROTECTED] web: http://www.datalucid.com Message Scanned by ClamAV on datalucid.com ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE - ? encoding of returned strings
Thanks Jan - that's very clear and exactly what I needed to know. I've got most of my conversions working - but there are a few exceptions and I think your explanation has given me enough information to track then down and handle them. (I'm not using the Win32::OLE UTF8 forcing - and am getting some spurious character conversions.) Mike Jan Dubois wrote: When Win32::OLE uses CP_UTF8, then it will convert the UCS2 as returned from COM (the BSTR datatype) into UTF-8. There should be no loss of information in this step, as everything in UCS2 can also be represented in UTF8. The conversion is done by a Windows API and not by Perl internals. Win32::OLE then asks Perl to downgrade to a non-UTF-8 string if possible, because a lot of modules dont handle UTF-8 strings correctly. This step is error-prone, as Perl always assumes that byte strings are Latin-1 encoded and does not take the Windows code page into account. If *all* characters in the returned string are in Latin-1 and your Windows codepage is *not* 1252, then you may get distorted results. I guess I should put some support into Win32::OLE to force it to leave the string in UTF8. But I think this should be done in the wider context of teaching Perl to deal with Windows code pages better. Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Mike Trotman Sent: April 29, 2007 2:36 PM To: perl-win32-users@listserv.ActiveState.com Subject: Re: Win32::OLE - ? encoding of returned strings Thanks - that's very useful. And I had missed the Unicode mode in the Win32::OLE documentation. To clarify: Part of my problem is that the MSXML XSLT transformations do NOT output the character encoding in the XML declaration. So - $xmldoc-transformNode($xsltsheet) may output Windows-1252 encoded data - but does not contain encoding='Windows-1252' in the !? xml version='1.0'? and so other parts of the process expect it to contain UTF-8. If I turn on the Win32::OLE UTF8 code page for a Win32::OLE call to MSXML that returns a UTF-16 string (or Windows-1252) - is the automatic conversion to UTF8 likely to be correct - or incorrect? IE - does the automatic conversion correctly detect the CP of the OLE output? Thanks Jan Dubois wrote: On Fri, 27 Apr 2007, Mike Trotman wrote: I am writing a CGI application that uses WIN32::OLE to interface to Microsoft ADO, MS Access, SQL Server and MSXML for XML documents and XSLT transformations. I suspect that something in the way I am passing data around (or in the ADO implementation of 'savetoxml') is not dealing correctly with XML document encoding declarations. The data is originally in an MS Access database - but has been entered using copy and paste from MS Word documents from around the world - so contains many weird and wonderful bytes. To help in my debugging process can anyone tell me how WIN32::OLE deals with 'strings' returned from method calls? i.e. - are they pure byte data as output by the method (and maybe in UTF-16)? - or are they converted to Perl's internal format (using any current Perl encoding settings)? - or does something else happen? The problems I am having are primarily when outputting XML documents (or HTML) to send to the browser. e.g.my $OUTPUT=""; $OUTPUT=$xmldoc-transformNode($xsltsheet); print $OUTPUT; All string data is converted to the current system codepage by Win32::OLE before being passed back to Perl _unless_ you switch Win32::OLE to Unicode mode first: Win32::OLE-Option(CP = Win32::OLE::CP_UTF8()); After this call all strings are converted to UTF8 and marked as such in the Perl internal flags. Cheers, -Jan Message Scanned by ClamAV on datalucid.com -- Datalucid Limited 8 Eileen Road South Norwood London SE25 5EJ tel :+44-0208-239-6810 email: [EMAIL PROTECTED] web: http://www.datalucid.com Message Scanned by ClamAV on datalucid.com -- Datalucid Limited 8 Eileen Road South Norwood London SE25 5EJ tel :+44-0208-239-6810 email: [EMAIL PROTECTED] web: http://www.datalucid.com Message Scanned by ClamAV on datalucid.com ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs