RE: RE help
Daniel, I was able to utilize the suggestions from the others. I will also take a look at XML::Simple. Thanks, David From: Daniel McBrearty [mailto:[EMAIL PROTECTED] Sent: Thursday, May 04, 2006 4:33 PM To: Hsu, David Cc: perl-win32-users@listserv.activestate.com Subject: Re: RE help looks to me like you are reinventing the wheel here ... this is XML, right? there are numerous XML parsers on CPAN. Try XML::Simple something like this should do it: ue XML::Simple; my $x = XMLin($string); now all your info should be a complex data structure under the ref $x. Try it, maybe use Data::Dumper to see what the data structure looks like, then get your data out by navigating the structure. ( of course, you have to install XML::Simple first ... I assume it's on ActiveState ...) -- Daniel McBrearty email : danielmcbrearty at gmail.com www.engoi.com : the multi - language vocab trainer BTW : 0873928131 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE help
Hi, I am trying to parse this string and not able to get the results that I need. Can someone please help. Thanks in advance. -David I am trying this: $string = 'NameFNJohn/FN LNSmith/LN/Name, NameFNSusan/FNLNMiers/LN/Name JobTitlePresident/JobTitle' $string =~ m/.*(Name.+?\/Name).*(JobTitle.+?\/JobTitle)/; I only want the name in last Name tag and the Jobtitle (i.e. Susan Miers President) Also, the FN and LN tag may or may not be there at times. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: remote ODBC problem
I do have the file shared and every included Everyone in the permissions, but still did not connect to the DB. David -Original Message- From: Luke Bakken [mailto:[EMAIL PROTECTED] Sent: Monday, January 09, 2006 1:57 PM To: Hsu, David Cc: perl-win32-users@listserv.activestate.com Subject: Re: remote ODBC problem Your program must have access to the Access DB files themselves for the ODBC connection to work, that is why your process works if the DB is on the server itself. You'll have to make the files available via some sort of file-sharing - NFS or Windows file sharing. On 1/9/06, Hsu, David [EMAIL PROTECTED] wrote: Yes. It's no problem if the Access DB is on the server itself and I create an ODBC connection to it. David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: remote ODBC problem
Driver letter. Also here is the error message I am getting: couldn't open ODBC connection because-1032[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data. at c:\inetpub\wwwroot\test\iqafdbtest.pl line 62. -Original Message- From: Luke Bakken [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 10, 2006 2:23 PM To: Hsu, David Subject: Re: remote ODBC problem Hrm. About the only other suggestion I have is about the way you are mapping the network drive. Are you using the '\\' syntax to access the drive or are you mapping a drive letter? Luke On 1/10/06, Hsu, David [EMAIL PROTECTED] wrote: Yes, I am able to open the DB remotely with Access. -Original Message- From: Luke Bakken [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 10, 2006 11:58 AM To: Hsu, David Subject: Re: remote ODBC problem Check the permissions on the file itself. Can you open the file via the share with Access? On 1/10/06, Hsu, David [EMAIL PROTECTED] wrote: I do have the file shared and every included Everyone in the permissions, but still did not connect to the DB. David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: remote ODBC problem
Yes. It's no problem if the Access DB is on the server itself and I create an ODBC connection to it. David -Original Message- From: Ken Barker [mailto:[EMAIL PROTECTED] Sent: Friday, January 06, 2006 6:06 PM To: Hsu, David; perl-win32-users@listserv.ActiveState.com Subject: Re: remote ODBC problem Have you defined myDB in windows ODBC? It is under settings/control panel/administrative tools/data sources ODBC. At 02:40 PM 1/6/2006, Hsu, David wrote: Hi all, Has anyone else run into this problem and have found a solution? I am making an ODBC connection to a remote MS Access DB from my web server. When my Perl script runs, it cannot open the data source. I tested the connection using MS Query, and it is fine. Why can't Perl access the DB? Here is how I'm connecting to the DB. Thanks, David ... my $DSN = 'myDB'; my $db=new Win32::ODBC($DSN); #create new instance if (! $db){ perror(Error opening data source $DSN); exit(0); } ___ 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
remote ODBC problem
Hi all, Has anyone else run into this problem and have found a solution? I am making an ODBC connection to a remote MS Access DB from my web server. When my Perl script runs, it cannot open the data source. I tested the connection using MS Query, and it is fine. Why can't Perl access the DB? Here is how I'm connecting to the DB. Thanks, David ... my $DSN = 'myDB'; my $db=new Win32::ODBC($DSN); #create new instance if (! $db){ perror(Error opening data source $DSN); exit(0); } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: escaping characters
$Bill, The attempt is to get a to this string: $SQL = SELECT ParameterValues.ParameterValue FROM Targets INNER JOIN (PrintSamples INNER JOIN ((DigitalImages INNER JOIN PrintSampleAnalyses ON DigitalImages.ImageID = PrintSampleAnalyses.ImageID) INNER JOIN (Measurements INNER JOIN ParameterValues ON Measurements.MeasurementID = ParameterValues.MeasurementID) ON PrintSampleAnalyses.psaID = Measurements.psaID) ON PrintSamples.PrintSampleID = DigitalImages.PrintSampleID) ON Targets.TargetID = Measurements.TargetID WHERE (((PrintSampleAnalyses.psaTicket)='CGL') AND ((PrintSamples.PrintCopyID)='05115501_18') AND ((Measurements.msmTag)='tag') AND ((Targets.TargetID)=187) AND ((ParameterValues.ParameterID)=31)); Below were the attempts that I have tried and the results. Strangely, by using the \t the 'tag' string showed, but I'm still at a loss on the syntax to just show 'tag'. Thanks -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 11, 2005 9:32 PM To: Hsu, David Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: escaping characters Hsu, David wrote: Hi all, I'm having trouble formatting a SQL statement. Here's what I have: $SQL = ... ((Measurements.msmTag)=\'tag\') AND(Targets.TargetID)=187) ...; \' is the same as '. When I do a screen print I get: ... ((Measurements.msmTag)='') ... If I escape the $SQL = ... ((Measurements.msmTag)=\'\tag\\') AND(Targets.TargetID)=187) ...; Same with . When I do a screen print I still get: ... ((Measurements.msmTag)='') ... I tried this: $SQL = ... ((Measurements.msmTag)=\'\\ttag\\') AND(Targets.TargetID)=187) ...; When I do a screen print I get: ... ((Measurements.msmTag)='tag') ... You added a tab in there. Any insights would be appreciated. You stated a few observations, but what are you trying to do ? If you want a \ in there, just double it up \\. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: escaping characters
I used the html syntax: 'lt;' for , But used just '' and it produced the results that I was looking for: 'tag' Using 'gt;' for '' also works. $SQL = SELECT ParameterValues.ParameterValue FROM Targets INNER JOIN (PrintSamples INNER JOIN ((DigitalImages INNER JOIN PrintSampleAnalyses ON DigitalImages.ImageID = PrintSampleAnalyses.ImageID) INNER JOIN (Measurements INNER JOIN ParameterValues ON Measurements.MeasurementID = ParameterValues.MeasurementID) ON PrintSampleAnalyses.psaID = Measurements.psaID) ON PrintSamples.PrintSampleID = DigitalImages.PrintSampleID) ON Targets.TargetID = Measurements.TargetID WHERE (((PrintSampleAnalyses.psaTicket)='$sessionID') AND ((PrintSamples.PrintCopyID)='$sampleID') AND ((Measurements.msmTag)='lt;tag') AND ((Targets.TargetID)=187) AND ((ParameterValues.ParameterID)=31)); -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 11, 2005 9:32 PM To: Hsu, David Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: escaping characters Hsu, David wrote: Hi all, I'm having trouble formatting a SQL statement. Here's what I have: $SQL = ... ((Measurements.msmTag)=\'tag\') AND(Targets.TargetID)=187) ...; \' is the same as '. When I do a screen print I get: ... ((Measurements.msmTag)='') ... If I escape the $SQL = ... ((Measurements.msmTag)=\'\tag\\') AND(Targets.TargetID)=187) ...; Same with . When I do a screen print I still get: ... ((Measurements.msmTag)='') ... I tried this: $SQL = ... ((Measurements.msmTag)=\'\\ttag\\') AND(Targets.TargetID)=187) ...; When I do a screen print I get: ... ((Measurements.msmTag)='tag') ... You added a tab in there. Any insights would be appreciated. You stated a few observations, but what are you trying to do ? If you want a \ in there, just double it up \\. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
escaping characters
Hi all, I'm having trouble formatting a SQL statement. Here's what I have: $SQL = ... ((Measurements.msmTag)=\'tag\') AND(Targets.TargetID)=187) ...; When I do a screen print I get: ... ((Measurements.msmTag)='') ... If I escape the $SQL = ... ((Measurements.msmTag)=\'\tag\\') AND(Targets.TargetID)=187) ...; When I do a screen print I still get: ... ((Measurements.msmTag)='') ... I tried this: $SQL = ... ((Measurements.msmTag)=\'\\ttag\\') AND(Targets.TargetID)=187) ...; When I do a screen print I get: ... ((Measurements.msmTag)='tag') ... Any insights would be appreciated. Thanks in advance, David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32:OLE Excel
Removing the () seems to work, but only if I am adding one worksheet. I am using a For Loop to add multiple sheets, but all the other sheets are default named Sheet2, Sheet3, etc... So, some more investigation. Thanks, David -Original Message- From: Dave Kazatsky [mailto:[EMAIL PROTECTED] Sent: Thursday, August 04, 2005 1:47 PM To: Hsu, David Cc: Perl-Win32-Users@listserv.ActiveState.com; [EMAIL PROTECTED] Subject: RE: Win32:OLE Excel David, I have a script with almost the exact same code and it works correctly. Try removing the parens from your add statement and see if that makes a difference. Original Code: $Worksheet = $Workbook-Worksheets()-Add(); $Worksheet-{Name} = test $i; Becomes: $Worksheet = $Workbook-Worksheets-Add; $Worksheet-{Name} = test $i; HTH. Dave Kazatsky Senior Middleware Engineer W. (908) 575-6947 C. (973) 865-8106 |-+- | | Hsu, David [EMAIL PROTECTED]| | | Sent by: | | | [EMAIL PROTECTED]| | | veState.com | | | | | | | | | 08/04/2005 01:17 PM | | | | |-+- --- ---| | | | To: Ken Barker [EMAIL PROTECTED], | |Perl-Win32-Users@listserv.ActiveState.com | | cc: | | Subject: RE: Win32:OLE Excel | --- ---| Ken, I am using Win32::OLE. Add_worksheet uses the Spreadsheet:WriteExcel module. Thanks, David -Original Message- From: Ken Barker [mailto:[EMAIL PROTECTED] Sent: Thursday, August 04, 2005 12:07 PM To: Hsu, David; Perl-Win32-Users@listserv.ActiveState.com Subject: RE: Win32:OLE Excel Try $ws1 = $workbook-add_worksheet('worksheetname'); Ken Barker IT Lead Americall Group, Inc 314-213-7927 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Hsu, David Sent: Thursday, August 04, 2005 10:23 AM To: Perl-Win32-Users@listserv.ActiveState.com Subject: Win32:OLE Excel Hi, Does someone know of another method of naming the Excel sheets? Currently I am using: ... $Worksheet = $Workbook-Worksheets()-Add(); $Worksheet-{Name} = test $i; ... The sheet names are still Sheet1, Sheet2, etc... Thanks, David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs __ This e-mail has been scanned by MCI Managed Email Content Service, using Skeptic(tm) technology powered by MessageLabs. For more information on MCI's Managed Email Content Service, visit http://www.mci.com. __ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 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 Excel
Hi, Does someone know of another method of naming the Excel sheets? Currently I am using: ... $Worksheet = $Workbook-Worksheets()-Add(); $Worksheet-{Name} = test $i; ... The sheet names are still Sheet1, Sheet2, etc... Thanks, David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32:OLE Excel
Ken, I am using Win32::OLE. Add_worksheet uses the Spreadsheet:WriteExcel module. Thanks, David -Original Message- From: Ken Barker [mailto:[EMAIL PROTECTED] Sent: Thursday, August 04, 2005 12:07 PM To: Hsu, David; Perl-Win32-Users@listserv.ActiveState.com Subject: RE: Win32:OLE Excel Try $ws1 = $workbook-add_worksheet('worksheetname'); Ken Barker IT Lead Americall Group, Inc 314-213-7927 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Hsu, David Sent: Thursday, August 04, 2005 10:23 AM To: Perl-Win32-Users@listserv.ActiveState.com Subject: Win32:OLE Excel Hi, Does someone know of another method of naming the Excel sheets? Currently I am using: ... $Worksheet = $Workbook-Worksheets()-Add(); $Worksheet-{Name} = test $i; ... The sheet names are still Sheet1, Sheet2, etc... Thanks, David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs __ This e-mail has been scanned by MCI Managed Email Content Service, using Skeptic(tm) technology powered by MessageLabs. For more information on MCI's Managed Email Content Service, visit http://www.mci.com. __ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
String formatting
Hi all, I am working with GD::Graph and I am retrieving some data from a DB and formatting the data into a string that I can use for graphing. my @data = ($data1); My $myGraph = GD::Graph::lines-new(400,300); ... The problem is that my formatted string of data is not in the correct format and returns an error. I check the string printed to the screen and it looks like this: [-0.84,-0.83,-0.4,-0.39,- 0.39,1.16,2.38,4.49,7.08,10.07,13.14], [1.09,0.47,-14.95,-47.63,- 5.75,30.19,21.07,37.63,57.18,84.63,118.59], [0,0.06,-21.27,-59.79,- 11.11,22.26,12.67,15.25,10.79,6.58,4.52,4.05] Invalid data set: 0 at c:\inetpub\wwwroot\trialmap\cgi-bin\eData.pl line 2106. From my testing, the array needs the data to be either one line, or 3 lines separated by the brackets. I am assuming they are return carriages, (but I am not sure why it is there) so I try this RE to remove it, with no luck. $data1 =~/(\r)//g; Any insights? Thanks David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Reg. expression help
Hi, Can someone help me with the syntax of deleting the last word of text string. i.e. $string = 'my abc 123' Like to have only 'my abc' Thanks, David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Recall: Reg. expression help
Hsu, David would like to recall the message, Reg. expression help. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: GD::Graph module install problem
Randy, I double checked all my repository links, could not find anything wrong. So I deleted all and added again. Now it's working. Thanks, David -Original Message- From: Randy Kobes [mailto:[EMAIL PROTECTED] Sent: Friday, January 28, 2005 12:38 PM To: Hsu, David Cc: Perl-Win32-Users@listserv.ActiveState.com Subject: Re: GD::Graph module install problem On Fri, 28 Jan 2005, Hsu, David wrote: Hi, Can someone let me know if GD::Graph module works with Perl 5.8 on Windows format? I tried to install it from several sites: Activestate http://theoryx5.uwinnipeg.ca/ But I always get a Failed to download... error. I need to line plot some data. Is there another module option that I can use in 5.8 to get line plots. Thanks, David After adding http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58 to your repository list within the ppm shell, what is the the error that you get from C:\ ppm ppm install GDGraph If it's a problem with connections, take a look at the ActivePerl faq on ppm, especially the discussion on proxy settings. -- best regards, randy kobes ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
GD::Graph module install problem
Hi, Can someone let me know if GD::Graph module works with Perl 5.8 on Windows format? I tried to install it from several sites: Activestate http://theoryx5.uwinnipeg.ca/ But I always get a Failed to download... error. I need to line plot some data. Is there another module option that I can use in 5.8 to get line plots. Thanks, David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Re[2]: Deleting a worksheet in Excel
Sergey, Thanks for the advice. I'm not too familiar with using variant arrays. A little research showed that Perl does have variant arrays - Win32::OLE::Variant. I did not find any good examples on the usage. Do you have any insights on how to use variant arrays in populating an Excel workbook? Thanks, David -Original Message- From: [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 25, 2005 3:15 AM To: Hsu, David Cc: Perl-Win32-Users@listserv.ActiveState.com Subject: Re[2]: Deleting a worksheet in Excel David, Monday, January 24, 2005, 8:33:56 PM, : HD Fred, HD Thanks, that works as well. I used one-liner. HD On another topic concerning Excel. Do you ever get: HD HTTP/1.1 502 Gateway Error Server: Microsoft-IIS/5.0 Date: Wed, 19 Jan 2005 19:03:35 GMT Content-Length: 186 Content-Type: text/html HD CGI Timeout HD The specified CGI application exceeded the allowed time for processing. The server has deleted the process. HD error when trying to retrieve large amounts of data and writing it to an Excel Workbook? I query a DB and store the results in Excel. I will have 7 worksheets, each containing several thousand HD rows. It's not the web server because I have allow it more that sufficient time to allow processing. HD I usually use this to populate Excel: HD For ($i=1;$i$counter;$i++) HD { HD $cell = $worksheet-Cells($row,$col); HD $cell-{Value} = $data; HD $col++; HD . HD . HD } HD $row++; HD . HD . HD . HD It's a problem I'm working on, but thought that you might have encountered it. David, The method You used to obtain data require great amount of time because of using IDispatch interface in OLE. Even on local computer cell-by-cell populating of excel worksheet is long and resource expensive As pointed in error message, timeout is exceeded. The better way is get all the data needed from server on local computer and then process it as You like. Try to use variant arrays (though I don't know is it possible in Perl) ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- Regards, Sergeymailto:[EMAIL PROTECTED] ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Deleting a worksheet in Excel
Title: Message Hi, Can someonelet me know the syntax of deleting a worksheet in an Excel workbook. I am using Win32::OLE. I've tried: $Workbook-Worksheets{9}.Delete; Thanks, David ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Deleting a worksheet in Excel
That was it. Thanks. -Original Message- From: [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 11:25 AM To: Hsu, David Cc: Perl-Win32-Users@listserv.ActiveState.com Subject: Re: Deleting a worksheet in Excel David, Monday, January 24, 2005, 5:39:01 PM, : HD Hi, HD Can someone let me know the syntax of deleting a worksheet in an Excel HD workbook. I am using Win32::OLE. HD I've tried: $Workbook-Worksheets{9}.Delete; HD Thanks, HD David try $Workbook-Worksheets(9)-Delete; -- , mailto:[EMAIL PROTECTED] ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Deleting a worksheet in Excel
Fred, Thanks, that works as well. I used one-liner. On another topic concerning Excel. Do you ever get: HTTP/1.1 502 Gateway Error Server: Microsoft-IIS/5.0 Date: Wed, 19 Jan 2005 19:03:35 GMT Content-Length: 186 Content-Type: text/html CGI Timeout The specified CGI application exceeded the allowed time for processing. The server has deleted the process. error when trying to retrieve large amounts of data and writing it to an Excel Workbook? I query a DB and store the results in Excel. I will have 7 worksheets, each containing several thousand rows. It's not the web server because I have allow it more that sufficient time to allow processing. I usually use this to populate Excel: For ($i=1;$i$counter;$i++) { $cell = $worksheet-Cells($row,$col); $cell-{Value} = $data; $col++; . . } $row++; . . . It's a problem I'm working on, but thought that you might have encountered it. David -Original Message- From: Fred Govier [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 12:37 PM To: Hsu, David Cc: Perl-Win32-Users@listserv.ActiveState.com Subject: Re: Deleting a worksheet in Excel This works for me: my $Sheet = $Workbook-Worksheets(9); # select worksheet number 9 $Sheet-Delete; Hsu, David wrote: Can someone let me know the syntax of deleting a worksheet in an Excel workbook. I am using Win32::OLE. I've tried: $Workbook-Worksheets{9}.Delete; ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: LWP::Simple could not retrieve issue
Randy, I added the proxy setting in the script, but still the same problem. I saved the xml link as a local file and ran the script through IE. Parsed just fine. Still can't figure out why it won't get the xml from any site. David -Original Message- From: Randy Kobes [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 4:22 PM To: Hsu, David Cc: $Bill Luebkert; perl-win32-users@listserv.ActiveState.com Subject: RE: LWP::Simple could not retrieve issue On Mon, 17 Jan 2005, Hsu, David wrote: Bill, I tried your code, but get same problem. I'm behind a corporate firewall, does LWP::Simple require any proxy settings? I've already set the proxy server on the systems variables. Perhaps you need to include some proxy settings in the script itself, as in: use strict; use LWP::Simple qw(get $ua); my $arg = http://www.infoworld.com/rss/news.xml;; if ($ENV{HTTP_proxy_user} and $ENV{HTTP_proxy_pass} and $ENV{HTTP_proxy} =~ /^http:\/\/([EMAIL PROTECTED])$/) { my $proxy =http://$ENV{HTTP_proxy_user}:$ENV{HTTP_proxy_pass}\@; . $1; print setting user/pass into proxy_env...\n; $ua-proxy(['http'], $proxy); } if ($arg=~ /http:/i) { my $content = get($arg); die Could not retrieve $arg unless $content; ### line 38 print $content; } -- best regards, randy ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: LWP::Simple could not retrieve issue
Bill, I tried your code, but get same problem. I'm behind a corporate firewall, does LWP::Simple require any proxy settings? I've already set the proxy server on the systems variables. Thanks, David -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED] Sent: Friday, January 14, 2005 8:51 PM To: Hsu, David Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: LWP::Simple could not retrieve issue Hsu, David wrote: Hi, I am having is the following error when I try to execute the script via a web browser. It seem to parse fine from the command line. Could not retrieve http://www.infoworld.com/rss/news.xml at c:\inetpub\wwwroot\rss\rss2html.pl line 38 I tried with several different rss feed sites, all with the same problem. Following is the partial code. This is from rss2html.pl that was included with XML-RSS module. Any ideas? Thanks, David # INCLUDES use strict; #use CGI qw(:standard); use XML::RSS; use LWP::Simple; # Declare variables my $content; my $file; # MAIN # check for command-line argument #die Usage: rss2html.pl (RSS file | URL)\n unless @ARGV == 1; # get the command-line argument my $arg = http://www.infoworld.com/rss/news.xml;; # create new instance of XML::RSS my $rss = new XML::RSS; #argument is a URL if ($arg=~ /http:/i) { $content = get($arg); die Could not retrieve $arg unless $content;### line 38 # parse the RSS content $rss-parse($content); # argument is a file } else { $file = $arg; die File \$file\ does't exist.\n unless -e $file; # parse the RSS file $rss-parsefile($file); } # print the HTML channel print_html($rss); Seems ok to me except last line (not sure what the print_html is going to do) - here's my version that works as far as retrieving : use strict; use XML::RSS; use LWP::Simple; # die Usage: rss2html.pl (RSS file | URL)\n unless @ARGV == 1; my $arg = $ARGV[0] || http://www.infoworld.com/rss/news.xml;; my $rss = new XML::RSS; # create new XML::RSS object if ($arg=~ /^http:/i) { # argument is URL my $content = get ($arg) or die get $arg: $! ($^E); $rss-parse($content); # parse the RSS content } else {# argument is a file my $file = $arg; die File \$file\ does't exist.\n unless -e $file; $rss-parsefile($file); # parse the RSS file } # print the HTML channel # print_html ($rss); print $rss-as_string; # I just printed the data out to verify __END__ -- ,-/- __ _ _ $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 Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
LWP::Simple could not retrieve issue
Hi, I am having is the following error when I try to execute the script via a web browser. It seem to parse fine from the command line. Could not retrieve http://www.infoworld.com/rss/news.xml at c:\inetpub\wwwroot\rss\rss2html.pl line 38 I tried with several different rss feed sites, all with the same problem. Following is the partial code. This is from rss2html.pl that was included with XML-RSS module. Any ideas? Thanks, David # INCLUDES use strict; #use CGI qw(:standard); use XML::RSS; use LWP::Simple; # Declare variables my $content; my $file; # MAIN # check for command-line argument #die Usage: rss2html.pl (RSS file | URL)\n unless @ARGV == 1; # get the command-line argument my $arg = http://www.infoworld.com/rss/news.xml;; # create new instance of XML::RSS my $rss = new XML::RSS; #argument is a URL if ($arg=~ /http:/i) { $content = get($arg); die Could not retrieve $arg unless $content; ### line 38 # parse the RSS content $rss-parse($content); # argument is a file } else { $file = $arg; die File \$file\ does't exist.\n unless -e $file; # parse the RSS file $rss-parsefile($file); } # print the HTML channel print_html($rss); . . . ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Can't use an undefined value as a HASH reference when using Win32 ::OLE
Title: Message Hi, I'm getting this error message when I run my application. "Can't use an undefined value as a HASH reference at c:\inetpub\wwwroot\trialmap\cgi-bin\standardQ.pl line 738". The strange part is that it gives me this message the first time when I run it. Then if I run it again, it executes fine. But run it again, it gives the same error. So, it's executing successfully on every other execution. Here is the code, it is choking when I rename my Excel sheet name. I can't figure it out. Thanks, David use Win32::OLE; unlink($path) if (-e $path);my $Class = "Excel.Application";# Create a new workbook and add a worksheetmy $Excel = Win32::OLE-GetActiveObject($Class);if ( ! $Excel ){ $Excel = new Win32::OLE( $Class) || die "Could not create an OLE '$Class' object";}my $Workbook = $Excel-Workbooks-Add();$Excel-{SheetsInNewWorkbook} = 7;$Excel-{DisplayAlerts}=0;my @sheetName = ("QvData", "QvSummary", "PidcData", "PidcSummary", "ScnrDscp", "SampleSummary", "FileSummary");my $numSheets = 7;$scnr = getScannerName($scannerDes); for ($i=0; $i$numSheets; $i++){my $sheet = $sheetName[($numSheets - $i - 1)];my $Worksheet = $Workbook-Worksheets($numSheets - $i); # name worksheets $Workbook-Worksheets($numSheets - $i)-{Name} = "$sheet"; error here #write header row to excel for ($j=1; $j$numCol; $j++) { my $Cell = $Worksheet-Cells($row, $col); $Cell-{Value} = $cols[$j]; $col++;}...
RE: Can't use an undefined value as a HASH reference when using W in32 ::OLE
Title: Message Bill,Thanks for your feedbacks. I was able to get pass that error message, but this message I am still stuck on:"Can't call method "Cells" on an undefined value at c:\inetpub\wwwroot\trialmap\cgi-bin\standardQ.pl line 728."Any ideas here,Thanks,Daviduse Win32::OLE;my $path = 'fubar.xls';unlink $path if (-e $path);my $Class = "Excel.Application";my $Excel = Win32::OLE-GetActiveObject($Class);if (!$Excel) { $Excel = new Win32::OLE( $Class) || die "Could not create an OLE '$Class' object";}my $Workbook = $Excel-Workbooks-Add();$Excel-{SheetsInNewWorkbook} = 7;$Excel-{DisplayAlerts} = 0;$Excel-{Visible} = 1;my @sheetName = qw(QvData QvSummary PidcData PidcSummary ScnrDscp SampleSummary FileSummary);my @cols = qw(A B C D E F G);my $numCol = scalar @cols;my $numSheets = 7;for (my $i = 0; $i $numSheets; $i++) { my $sheet = $sheetName[($numSheets - $i - 1)]; my $Worksheet = $Workbook-Worksheets($numSheets - $i); # name sheets $Workbook-Worksheets($numSheets - $i)-{Name} = $sheet; # write header row to excel my $row = 1; my $col = 'A'; for (my $j = 1; $j $numCol; $j++) { my $Cell = $Worksheet-Cells($row, $col); ### Line 728 Error here $Cell-{Value} = $cols[$j]; $col++; }}-Original Message-From: $Bill Luebkert [mailto:[EMAIL PROTECTED]]Sent: Monday, January 26, 2004 2:17 PMTo: Hsu, DavidSubject: Re: Can't use an undefined value as a HASH reference when using W in32 ::OLEHsu, David wrote: Bill Why the '- 1' above ? Why not '$numsheets - $i' ? My sheet name is in an array and my $i starts at 0. I am getting my last element first. Are you trying to re-order the sheets ? Why not just: my $sheet = $sheetName[$i]; and the same below ? I am populating the last sheet first with the data. Why not '- 1' on the lines below if you use it above ? $Workbook-Worksheets($numSheets - $i)-{Name} = "$sheet"; I am referencing the 7 sheets in the excel workbook.I managed to get that error once, but can't reproduce.I was playing with this loop : for (my $j = 1; $j $numCol; $j++) {which should start at 0 shouldn't it or change to = ?This code works for me:use Win32::OLE;my $path = 'fubar.xls';unlink $path if (-e $path);my $Class = "Excel.Application";my $Excel = Win32::OLE-GetActiveObject($Class);if (!$Excel) { $Excel = new Win32::OLE( $Class) || die "Could not create an OLE '$Class' object";}my $Workbook = $Excel-Workbooks-Add();$Excel-{SheetsInNewWorkbook} = 7;$Excel-{DisplayAlerts} = 0;$Excel-{Visible} = 1;my @sheetName = qw(QvData QvSummary PidcData PidcSummary ScnrDscp SampleSummary FileSummary);my @cols = qw(A B C D E F G);my $numCol = scalar @cols;my $numSheets = 7;for (my $i = 0; $i $numSheets; $i++) { my $sheet = $sheetName[($numSheets - $i - 1)]; my $Worksheet = $Workbook-Worksheets($numSheets - $i); # name sheets $Workbook-Worksheets($numSheets - $i)-{Name} = $sheet; # write header row to excel my $row = 1; my $col = 'A'; for (my $j = 1; $j $numCol; $j++) { my $Cell = $Worksheet-Cells($row, $col); $Cell-{Value} = $cols[$j]; $col++; }}__END__-- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED](_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/-/-' /___/__/_/_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
Win32 unblessed reference error
Title: Message Hi, I can't seem to figure out why it is giving me this error Can't call method "Cells" on unblessed reference at c:\inetpub\wwwroot\trialmap\cgi-bin\hmtEvalUP.pl line 1334. $Worksheet1-Cells is not causing any problems. Any help would be appreciated. Thanks, David my $Class = "Excel.Application";$Excel = Win32::OLE-GetActiveObject($Class);if ( ! $Excel ){$Excel = new Win32::OLE( $Class )|| die "Could not create an OLE '$Class' object";}$Excel-{DisplayAlerts}=0;my $Workbook = $Excel-Workbooks-Add();my $Worksheet1 = $Workbook-Worksheets(1);$Worksheet1-{Name} = "info.";# get the column headers from each table in the db.my ($colInfo, $colData, $colResults) = getColNames();$row = 1;$col = 1;# add column headers for sheet 1my @colI = @{$colInfo};my $num = @colI;for ($i=0; $i$num - 1; $i++){$Worksheet1-Cells($row,$col)-{Value} = $colI[$i]; $col++; } my $numCols = $col; # Add some formatting for ($i=1; $i$numCols; $i++) { $Worksheet1-Cells($row,$i)-Font-{Bold} = "True";$Worksheet1-Cells($row,$i)-Font-{Size} = 12;}# add column headers for sheet 2my $Worksheet2 = $Workbook-Worksheets(2);$Worksheet2-{Name} = "Data Results";$col = 1;foreach $c (@{$colData}){$Worksheet2-Cells($row,$col)-{Value} = $c;# 1334 ##$col++;}
RE: Displaying a status bar
Mark, I set buffering to off ($| = 0) just before saving Excel Workook, it seems to do what I want it to do. Even though I'm not setting the status bar to 100, it seems to disappear smoothly when the processing is done. BTW, here is how I am looping to increment the status bar. $n=0; While ($i) # $i = 7 { ... $n = $n + 4 # I had to play with this number to make it work, finally 4 seems to increment well. print scriptincrement($n)/script; } ... $| = 0; 501 $Workbook-SaveAs($path); 502 $Workbook-Close(); 503 $Excel-Quit(); 504 sleep(1); 505 print h2(Query Completed); 506 print $r-end_html; Mark, thanks for your help and the status bar script. Lee, thanks for you suggestion, I did use sleep just to delay a sec. for the bar to disappear, before printing. Regards, David -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Monday, July 07, 2003 3:01 PM To: 'Hsu, David'; Thomas, Mark - BLS CTR; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Displaying a status bar Hsu, David [mailto:[EMAIL PROTECTED] wrote: Thanks Mark for the status bar. It seems to work well and definitely what I want, but the status bar is disappearing too soon, even though I am controlling when to disappear. [...] The thing is that once the status bar disappears, I am still waiting (~ 45sec) before line 505 is printed. I think it is still processing the Excel workbook because the saved file has not appeared. Any ideas? How are you incrementing the progress bar? Perhaps it's getting to 100% before your setPercent(100) call, and automatically disappearing. Try removing the setPercent(100) and see if the bar still disappears. If that test shows that the bar remains on the page to the end, try putting the setPercent(100) in the body onload event, i.e. body onload=setPercent(100) - Mark. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 2:23 PM To: 'Hsu, David'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Displaying a status bar Hello, Can someone let me know of a method of displaying a status bar on screen(html) in Perl script while it is processing a task. I have tried to print html, but it won't display the image until it has finished processing, and then it displays with the rest of the information. Your problem may be output buffering. Put $|++; in your program before sending any output and you can then print html to the screen. That being said, I've created a javascript library that puts a graphical status bar on the screen, and the percentage, overlay text, and color can be set by a perl program as it running, and at the end, it disappears so as not to interfere with the output. It's useful for long-running programs. Contact me off-list if you want it. - Mark. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ 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
RE: Displaying a status bar
Should've known there's always a correct way. I was just adding the increments without realizing the percentage bar numbers. Took your advice and used setPercent() and removed the sleep(), and left buffering on. Works great. Thanks again, David -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 12:13 PM To: 'Hsu, David'; Thomas, Mark - BLS CTR; [EMAIL PROTECTED] Cc: 'Lee Goddard' Subject: RE: Displaying a status bar Mark, I set buffering to off ($| = 0) just before saving Excel Workook, it seems to do what I want it to do. Even Though I'm not setting the status bar to 100, it seems to disappear smoothly when the processing is done. Coincidence. It happens to go over 100 near the end of your loop, and thus automatically disappears. BTW, here is how I am looping to increment the status bar. $n=0; While ($i) # $i = 7 { ... $n = $n + 4 # I had to play with this number to make it work, finally 4 seems to increment well. print scriptincrement($n)/script; } Iteration 1: increment(4), bar at 4% Iteration 2: increment(8), bar at 12% Iteration 3: increment(12), bar at 24% Iteration 4: increment(16), bar at 40% Iteration 5: increment(20), bar at 60% Iteration 6: increment(24), bar at 84% Iteration 7: increment(28), bar at 112% (disappears) This is what you're doing. Is it really what you want? You'd probably be better off using setPercent($p) where $p = 100/$maxsteps * $iteration ... $| = 0; 501 $Workbook-SaveAs($path); 502 $Workbook-Close(); 503 $Excel-Quit(); 504 sleep(1); 505 print h2(Query Completed); 506 print $r-end_html; Mark, thanks for your help and the status bar script. Lee, thanks for you suggestion, I did use sleep just to delay a sec. for the bar to disappear, before printing. This is unnecessary. If the half-second delay after passing 100% is too long, you can send scripthidebar()/script to hide it immediately. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Displaying a status bar
Thanks Mark for the status bar. It seems to work well and definitely what I want, but the status bar is disappearing too soon, even though I am controlling when to disappear. I am not sure why it is skipping the other code and processing the code where I tell the status bar to disappear. Here is the last part of my code after all processing. I am querying all the data into Excel and saving it. $| = 1; ... ... 501 $Workbook-SaveAs($path); 502 $Workbook-Close(); 503 $Excel-Quit(); 504 print scriptsetPercent(100)/script; 505 print h2(Query Completed); 506 print $r-end_html; I can put line 504 at the end (line 507) and it would still process it first. The thing is that once the status bar disappears, I am still waiting (~ 45sec) before line 505 is printed. I think it is still processing the Excel workbook because the saved file has not appeared. Any ideas? David -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 2:23 PM To: 'Hsu, David'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Displaying a status bar Hello, Can someone let me know of a method of displaying a status bar on screen(html) in Perl script while it is processing a task. I have tried to print html, but it won't display the image until it has finished processing, and then it displays with the rest of the information. Your problem may be output buffering. Put $|++; in your program before sending any output and you can then print html to the screen. That being said, I've created a javascript library that puts a graphical status bar on the screen, and the percentage, overlay text, and color can be set by a perl program as it running, and at the end, it disappears so as not to interfere with the output. It's useful for long-running programs. Contact me off-list if you want it. - Mark. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Displaying a status bar
Hello, Can someone let me know of a method of displaying a status bar on screen(html) in Perl script while it is processing a task. I have tried to print html, but it won't display the image until it has finished processing, and then it displays with the rest of the information. JavaScript is an option, but if the status screen is selected into the background, it will never close. Thanks, David ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Displaying a status bar
Mark, Thanks for your suggestion. I set the output buffer to Off, and it is displaying my html status bar and it seems to be processing in the background. But, I want to display my results page after processing. It seems that the status page does not go away even after processing is done. I have added the print out of data after the processing steps in my code. My data sets are sometimes large and small. During the smaller data sets, the processed data would be displayed on the same page as the status bar. The larger data sets, it seems it would always stay on the status bar screen, without displaying any processed data. Any thoughts on this. Thanks, David -Original Message- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 2:23 PM To: 'Hsu, David'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Displaying a status bar Hello, Can someone let me know of a method of displaying a status bar on screen(html) in Perl script while it is processing a task. I have tried to print html, but it won't display the image until it has finished processing, and then it displays with the rest of the information. Your problem may be output buffering. Put $|++; in your program before sending any output and you can then print html to the screen. That being said, I've created a javascript library that puts a graphical status bar on the screen, and the percentage, overlay text, and color can be set by a perl program as it running, and at the end, it disappears so as not to interfere with the output. It's useful for long-running programs. Contact me off-list if you want it. - Mark. -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs