cdo Object or String
Hi all, I found in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_o lemsg_fields_property_infostore_object_.asp : --- snip - CDO 1.2.1 Fields Property (InfoStore Object) The Fields property returns a single Field object or a Fields collection object. Read-only. Syntax objInfoStore.Fields objInfoStore.Fields(index) objInfoStore.Fields(proptag) objInfoStore.Fields(name) --- end snip - and --- snip - If your application is running as a Microsoft Windows NT® service, you cannot access the Microsoft Exchange Public Folders through the normal hierarchy because of a notification conflict. You must use the InfoStores Fields property to obtain the Microsoft Exchange property PR_IPM_PUBLIC_FOLDERS_ENTRYID, property tag H66310102. This represents the top-level public folder and allows you to access all other public folders through its Folders property. Example This code fragment accesses the root of the Public Folders subtree of a message store: Dim objSess As Session ' assume logged on to valid session Dim objInfoStore As InfoStore ' assume opened and valid Dim strPFRootID As String ' binary entry ID returned as hex string Dim objPFRoot As Folder ' root folder of Public Folders tagPFRootID = H66310102 ' PR_IPM_PUBLIC_FOLDERS_ENTRYID strPFRootID = objInfoStore.Fields(tagPFRootID) ' entry ID ??? MsgBox Public Folders root folder ID = strPFRootID Set objPFRoot = objSession.GetFolder(strPFRootID) --- end snip - if I write: --- snip - $cdo=Win32::OLE-new(MAPI.Session); $cdo-logon(); foreach (in $cdo-{Infostores}){ if (my $RootID=$_-Fields(1714487554)){# 1714487554 = H66310102 --- end snip - $RootID is object and not string This object is a field-object from infostore and has not an identifier for a folder (I need for $folder=$cdo-GetFolder($RootID);) !! Is that my error ? or is 2 errors in the µsoft's web-page (1. String is not object; 2. Fields-object not contains folder-ID) ? Best regards/Mit freundlichen Grüssen Joachim Görner Informationsverarbeitung Systemtechnik Basisdienste (ISB) ADAC e.V., Am Westpark 8, 81373 München Tel.: (089) 76 76 27 83 Fax: (089) 76 76 28 82 mailto:[EMAIL PROTECTED] www.adac.de ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Reading unix realtime logfile from windows
Hi folks, I am generating one log file in AIX say (Memory. log) real-time. I want to connect from windows 2000 to that AIX run a perl script for analysis. I am wondering if anyone is familiar with this kind of task. If yes, I would greatly appreciate your help :) Thanks Ramjee ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Reading unix realtime logfile from windows
CHIDIPI, RAMJEE (SBCSI) wrote: Hi folks, I am generating one log file in AIX say (Memory. log) real-time. I want to connect from windows 2000 to that AIX run a perl script for analysis. I am wondering if anyone is familiar with this kind of task. If yes, I would greatly appreciate your help :) Easiest thing would be to connect to a webserver on the AIX machine and use CGI to parse the log file. If you can't use a webserver, you'll need to either have a daemon running and connect with sockets or use rsh to run a command on AIX. -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Reading unix realtime logfile from windows
Or, and this is likely the most non-trivial approach, use something like SAMBA (http://at.samba.org/samba/what_is_samba.html) so that you can read the file system of the AIX machine from Windows. --Larry S. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of $Bill Luebkert Sent: Wednesday, November 24, 2004 8:19 AM To: CHIDIPI, RAMJEE (SBCSI) Cc: [EMAIL PROTECTED] Subject: Re: Reading unix realtime logfile from windows CHIDIPI, RAMJEE (SBCSI) wrote: Hi folks, I am generating one log file in AIX say (Memory. log) real-time. I want to connect from windows 2000 to that AIX run a perl script for analysis. I am wondering if anyone is familiar with this kind of task. If yes, I would greatly appreciate your help :) Easiest thing would be to connect to a webserver on the AIX machine and use CGI to parse the log file. If you can't use a webserver, you'll need to either have a daemon running and connect with sockets or use rsh to run a command on AIX. -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Looking for suggestions - how to sort merge comma separated quoted string files
Hi, I have three files of data which consists of records of double-quoted strings that are comma separated. The first data field for each record contains a unique sequence number. All the records in the files contain the same number of fields. Step 1: I need to merge two of these files of records together, sorted on the the sequence number. (into a separate output file) Step 2: I need to compare this merged output file (call it A) with the third input file. This time, I need to look for missing sequence numbers - (they increment by 1) - and insert dummy records for these missing sequence numbers into the merged output file (A). I wouldn't think this is too difficult, but... The problem is that some of the double-quoted strings contain newlines. OK, there are a lot of newlines in these quoted strings - and they have to remain in the data. So, when I try to open a filehandle to attempt to separate the file contents on the commas as I'm trying to put the file contents into an array - I only get the first line of file data. Here's my code (try not to laugh too hard!) select STDOUT; $|=1; select STDERR; $|=1; $InFile1 = (qq/$ENV{'TEMP'}\\InFile1.txt/); open INFILE1, $InFile1; @InArray1 = split(,, INFILE1); print did it\n; close INFILE1; foreach $InArray1(@InArray1) { print $InArray1; } My resulting output is: C:\Tempperl -w migration3.pl did it 1100newyes The contents of my test file (InFile1.txt) are: 1100,,new,yes 1101,today is the best day of my life,old,no This is just a tiny test file that I tossed together. The real data consists of ~20 fields per record. Of these, there are maybe 8-12 fields that could contain embedded newlines. There could be multiple newlines in any of these fields. Also, the actual data files are not huge. Each is under 7Mb. I did look around to see if there were any modules available that would help me out. I looked at File::Sort, Sort::Merge, and File:MergeSort. I'm not sure how to get past this first hurdle. These modules are either looking at the file contents line by line or the input mechanism is completely open, and I would need to supply my own. Any assistance is appreciated! :) Best Regards, -Bill ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Looking for suggestions - how to sort merge comma separatedquoted string files
Kalarness, Bill wrote: : I have three files of data which consists of records of : double-quoted strings that are comma separated. The : first data field for each record contains a unique : sequence number. All the records in the files contain : the same number of fields. Are the number of fields the only way to tell a new record has started? Is there some other consistent marker? [snip] : The problem is that some of the double-quoted strings : contain newlines. OK, there are a lot of newlines in : these quoted strings - and they have to remain in the : data. That's not a big problem. Perl splits files into lines by default using the record separator. We can change its value to any separator we need. (If there is an easy way to mark the end of each record.) Can fields also contain commas? Can other fields also contain only the unique record numbers? Can you provide some actual data which represents most cases we'll find? : So, when I try to open a filehandle to attempt to : separate the file contents on the commas as I'm trying : to put the file contents into an array - I only get the : first line of file data. : : Here's my code (try not to laugh too hard!) Since this is a beginners list, we tend to teach more than just solve problems. You are missing some fundamental programming habits needed to become a good perl programmer. Good programmers have found that a script should begin with two modules. All scripts, even play scripts, should start with these. Think of them as training wheels which never come off. #!/usr/bin/perl use strict; use warnings; If you are using an older version of perl you may need this. It is similar, but less robust than the above. #!/usr/bin/perl -w use strict; : select STDOUT; : $|=1; : select STDERR; : $|=1; Warnings and strictures constrain written perl code. One constraint is the use of variables. The first time we use a variable we will need to declare it. There are a few methods to do this, but the most common uses 'my'. : $InFile1 = (qq/$ENV{'TEMP'}\\InFile1.txt/); my $InFile1 = qq($ENV{TEMP}/InFile1.txt); I assume from the above that you are using a windows system. While windows uses the backslash for a directory separator, perl uses the slash. You can use the backslash, but I have found the slash to be far easier. Don't worry, perl will do the right thing. I really despise the parenthesis. While you are not required to do so, I will silently remove excess parentheses in my reply. I will also silently change double quotes to single quotes when the former is not required. NOTE: I use in.txt for my file name when testing code in my reply. You'll need to substitute the above to get it running on your machine.) : open INFILE1, $InFile1; It is a good habit to verify file opening, and many other I/O operations before proceeding. I have a macro in my favorite editor to handle file opening code. $! is the error code from perl. Do not place \n behind $!. It suppresses line number info. open INFILE1, $infile or die qq(Cannot open $infile: $!); : @InArray1 = split(,, INFILE1); As you have already learned, split() only operates on one line, not the entire file. To slurp the entire file in, we need to change the record separator ($/) to an undefined value. $/ = undef; my @InArray1 = split ',', INFILE1; There is a problem here. We probably don't want to change the value of $/ for the entire script. It would be safer to limit it for just these lines. We can do that with the 'local' function from perl. { local $/ = undef; my @InArray1 = split ',', INFILE1; } $/ will only remain undefined while inside this code block. Unfortunately, 'my' will not allow us to see the value of @InArray1 outside this code block either. So, we need to change the scope of @InArray1. my @InArray1; { local $/ = undef; @InArray1 = split ',', INFILE1; } Now, @InArray1 is visible and the world is safe from a changed $/. : print did it\n; print did it\n if @InArray1; : close INFILE1; : : foreach $InArray1(@InArray1) foreach my $InArray1 ( @InArray1 ) : { : print $InArray1; : } This can also be written as: print @InArray1; Though we might be happier with this. print $_\n foreach @InArray1; I ended up with this. It doesn't solve the problem. #!/usr/bin/perl use strict; use warnings; my $input_file = 'in.txt'; open IN, $input_file or die qq(Cannot open $input_file: $!); my @InArray1; { local $/ = undef; @InArray1 = split ',', INFILE1; } close INFILE1; print did it\n if @InArray1; print $_\n foreach @InArray1; __END__ Another good programming habit is the use of meaningful variable names. This version is much easier to read and maintain. #!/usr/bin/perl use strict; use warnings; my $input_file = qq($ENV{TEMP}/InFile1.txt); open IN,