RE: WIN32::OLE help

2008-08-18 Thread Neson Maxmelbin (RBEI/EMT4)
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

2008-08-18 Thread Brian Raven
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

2008-08-18 Thread Neson Maxmelbin (RBEI/EMT4)

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


Help with DBI and SQL Server

2008-08-18 Thread anthony . okusanya
Hello all 
I am trying to use a perl script to pull information from a SQL 
2000 database
The problem I am having is with authentication using an Active directory 
account. The script works
just fine if I use an account defined in SQL.
below is my sample script


use DBI;
my $user='Domain\\userid';
my $pw ='password';
my $DSN = driver={SQL Server};Server=DEVSERVERDB09
;database=hwdbInfo;uid=$user;pwd=$pw;;
my $dbh  = DBI-connect(dbi:ODBC:$DSN) or die $DBI::errstr\n;


This is the Error I get from the above line of code (using domain login):

DBI connect('driver={SQL Server};server=DEVSERVERDB09;database=hwdbInfo
;uid=Domain\userid;pwd=password;','',...) failed: [Microsoft][ODBC SQL 
Server Driver][SQL Server]Login failed for user 'Domain\userid'. 
(SQL-28000) at H:\\Dev\T.pl line 8
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 
'Domain\userid'. (SQL-28000)

I usually just rely on the users local credentials to access the database 
but this tool is going to be web based and we need each user to login 
using their domain credentials

any help would be appreciated.

Tony B. Okusanya
Live Life By Design And Not From Crisis to Crisis
U.S. BANCORP made the following annotations
-
Electronic Privacy Notice. This e-mail, and any attachments, contains 
information that is, or may be, covered by electronic communications privacy 
laws, and is also confidential and proprietary in nature. If you are not the 
intended recipient, please be advised that you are legally prohibited from 
retaining, using, copying, distributing, or otherwise disclosing this 
information in any manner. Instead, please reply to the sender that you have 
received this communication in error, and then immediately delete it. Thank you 
in advance for your cooperation.



-

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with DBI and SQL Server

2008-08-18 Thread Jenda Krynicky
From: [EMAIL PROTECTED]
 Hello all 
 I am trying to use a perl script to pull information from a SQL 
 2000 database
 The problem I am having is with authentication using an Active directory 
 account. The script works
 just fine if I use an account defined in SQL.
 below is my sample script
 
 
 use DBI;
 my $user='Domain\\userid';
 my $pw ='password';
 my $DSN = driver={SQL Server};Server=DEVSERVERDB09
 ;database=hwdbInfo;uid=$user;pwd=$pw;;
 my $dbh  = DBI-connect(dbi:ODBC:$DSN) or die $DBI::errstr\n;

This tries to find a login named 'Domain\userid' in the list of SQL 
Server's own logins.

 I usually just rely on the users local credentials to access the database 
 but this tool is going to be web based and we need each user to login 
 using their domain credentials

Rely on them again. If you leave the credentials checking to IIS it 
should run the scripts under the users' accounts so it should just 
work.

Jenda
= [EMAIL PROTECTED] === 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


Getting the current code page, open with UTF-8

2008-08-18 Thread Ben Bullock
I am using Win32::OLE to automate Microsoft Word/Excel, and I use utf8
to communicate with the applications themselves. But when I send a
UTF-8 string to a routine like

my $filename = somethinginutf8;

$word-Documents-Open ($filename);

this produces an error. A lot of the files and directories that I need
to open have Japanese names so it isn't possible for me to avoid the
problem by just using ASCII. I've found that sending the unencoded
version of the file name works. However, because I want to write a
general module which I can release on CPAN, I would prefer to write a
general solution where the file name was automatically decoded by
Encode into the correct code page for the user.

So my question is, how can my Perl program find out what the current
code page of the user is?

Or, is there a better way to approach the problem, such as a UTF-8
aware version of Open?

Thanks for any ideas.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs