Storing a 32-bit integer in 4 bytes
Hi, Can a 32 bit integer be written to a file in such a way that it is stored in only 4 bytes ? I thought that binmoding the filehandle might do this - but I'm finding that a number such as 31554399 is consuming 8 bytes (one byte for each digit), irrespective of whether the filehandle has been binmoded or not. my $num = 31554399; open (WRITE, test_file) or die Can't open WRITE: $!; binmode WRITE; # or not print WRITE $num; close (WRITE) or die Can't close WRITE: $!; Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Storing a 32-bit integer in 4 bytes
Sisyphus wrote: Hi, Can a 32 bit integer be written to a file in such a way that it is stored in only 4 bytes ? I thought that binmoding the filehandle might do this - but I'm finding that a number such as 31554399 is consuming 8 bytes (one byte for each digit), irrespective of whether the filehandle has been binmoded or not. my $num = 31554399; open (WRITE, test_file) or die Can't open WRITE: $!; binmode WRITE; # or not print WRITE $num; close (WRITE) or die Can't close WRITE: $!; You need to binmode the FH and pack the data. Check out pack/unpack in perlfunc man page. Your filesystem may be big-endian or little-endian which will also affect it and transporting to a different endian system may be problematic (if you're using an existing app.). -- ,-/- __ _ _ $Bill Luebkert ICQ=14439852 (_/ / )// // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /-- o // // http://dbecoll.tripod.com/ (Free site for Perl) -/-' /___/__/_/_ Castle of Medieval Myth Magic http://www.todbe.com/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
AW: Storing a 32-bit integer in 4 bytes
You're writing the string 31554399 to the file. Use something like print WRITE pack(I, $num); See perldoc -f pack Dietmar -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von Sisyphus Gesendet: Mittwoch, 20. Februar 2002 09:51 An: [EMAIL PROTECTED] Betreff: Storing a 32-bit integer in 4 bytes Hi, Can a 32 bit integer be written to a file in such a way that it is stored in only 4 bytes ? I thought that binmoding the filehandle might do this - but I'm finding that a number such as 31554399 is consuming 8 bytes (one byte for each digit), irrespective of whether the filehandle has been binmoded or not. my $num = 31554399; open (WRITE, test_file) or die Can't open WRITE: $!; binmode WRITE; # or not print WRITE $num; close (WRITE) or die Can't close WRITE: $!; Cheers, Rob ___ 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: Storing a 32-bit integer in 4 bytes
- Original Message - From: $Bill Luebkert [EMAIL PROTECTED] You need to binmode the FH and pack the data. Check out pack/unpack in perlfunc man page. Your filesystem may be big-endian or little-endian which will also affect it and transporting to a different endian system may be problematic (if you're using an existing app.). Thanks Bill, thanks Dietmar. Shoulder known that my aversion to pack/unpack would catch up with me one day :-) Guess it's time to come to grips with it. Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: path info
Peter Eisengrein [mailto:[EMAIL PROTECTED]] suggested: print `cd`; This is very bad advice for several reasons: - depends on cd being in $PATH (or builtin to the shell) - Perl code need not be started from current directory If one needs to find his script's home directory, then FindBin is definitely the way to go. MfG, -- Thomas Bätzler, Network Engineer, Network Operations EMEA Peregrine Systems GmbH web: www.peregrine.com Steinhäuserstraße 22 phone: +49-721-98143-166 D-76135 Karlsruhe / Germanyfax: +49-721-98143-196 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
pack
Hi, Ok - so I'm running the code below and it's working as I want - unless either of the 2 values being written to the file is 10. (ie unless $num = 8 or 10). If the value is 10, then I get a couple of warnings about 'use of uninitialised value'. '10' is the only value I've found that exhibits this disgraceful behaviour. U .. I'm a little hard pressed to make sense of that something to do with the newline characters or the chomping perhaps ? use warnings; my $file = try; my $num = 2; open (WRITEB, $file) or die Can't open WRITEB: $!; binmode WRITEB; print WRITEB pack(I,$num,), \n; print WRITEB pack(I,$num + 2), \n; close (WRITEB) or die Can't close WRITEB: $!; open (READ, $file) or die Can't open READ: $!; binmode READ; while (READ) { chomp; $ret = unpack(I, $_); print $ret, \n; } close (READ) or die Can't close READ: $!; Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: pack
Hah! I know what the problem is! ASCII character 10 happens to be either \n -- so when you print this number to the file, you get a newline character for one of the bytes, so your while(READ) loop finds three lines in the file instead of two. I think that in order to read this number back out of the file, you'll have to use sysread, instead of READ... HTH, Ricky -Original Message- From: Sisyphus [mailto:[EMAIL PROTECTED]] Sent: Wednesday 20 February 2002 9:11 AM To: [EMAIL PROTECTED] Subject: pack Hi, Ok - so I'm running the code below and it's working as I want - unless either of the 2 values being written to the file is 10. (ie unless $num = 8 or 10). If the value is 10, then I get a couple of warnings about 'use of uninitialised value'. '10' is the only value I've found that exhibits this disgraceful behaviour. U .. I'm a little hard pressed to make sense of that something to do with the newline characters or the chomping perhaps ? use warnings; my $file = try; my $num = 2; open (WRITEB, $file) or die Can't open WRITEB: $!; binmode WRITEB; print WRITEB pack(I,$num,), \n; print WRITEB pack(I,$num + 2), \n; close (WRITEB) or die Can't close WRITEB: $!; open (READ, $file) or die Can't open READ: $!; binmode READ; while (READ) { chomp; $ret = unpack(I, $_); print $ret, \n; } close (READ) or die Can't close READ: $!; Cheers, Rob ___ 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: Win32::OLE ...
Nearly everything IS possible in Perl. In Python for Win32, a tool called MakePy makes it possible to use early-bound automation. If you'd like to read about this, see chapter 12 of Mark Hammond's book _Python Programming on Win32_. Of course, Python is all open-source, so you can investigate this to your heart's content. Perhaps you or someone else can implement this same idea for Perl, if ActiveState hasn't done so already. I'd be surprised if they haven't already done this, since I believe that Mark Hammond now works for ActiveState. If a commercial package is an option, I suggest digging a little deeper into ActiveState's current offerings. -Jonathan At 05:33 PM 2/19/2002 , Amir Kashani wrote: That's because you're still trying to call a method on the TestClass2 object, which does not expose an IDispatch interface (what's known as late binding). You have to have a method on your COM object that will then delegate internally to the method on the TestClass2 object, hidden from the user. I don't understand why the object returned by calling the property would a TestClass2 object, when the property returns a TestClass1 object (which I believe would be an IDispatch object). From the research I've done on this, it seems to be a problem shared among scripting languages because of their lack of support for early bindings. I don't understand, however, why this workaround would work in VBScript, but not in Perl. Maybe it's just my stubborness in believing that everything is possible from Perl. Jonathan Epstein[EMAIL PROTECTED] Head, Unit on Biologic Computation (301)402-4563 Office of the Scientific Director Bldg 31, Room 2A47 Nat. Inst. of Child Health Human Development 31 Center Drive National Institutes of Health Bethesda, MD 20892 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::OLE-CreateObject('ADsSID) fails: Invalid class string
Your current problem may be that you do not have the adssecurity.dll on your system, or it is not registered. This DLL registers the ADsSID Object on your system, so OLE knows what it is, and how to handle this object. This dll is found as part of the ADSI SDK, on M$' site. Mail me offline if you can't find it. Then place the DLL somewhere like winnt\system32 (anywhere that your path statement will find it) and then run this from the command prompt. 'regsvr32 adssecurity.dll' Although, I too, have come to learn OLE as it applies to Exch 5.5 and a few other implementations, I need to give thanks to Andrew Bastien and this list (and archives), for their help. As well, Yes, I have deprecated CreateObject in favor of new in my implementation... CreateObject should still work. Though, I don't think that's your current problem. Steven -Original Message- From: Jonathan C. Detert [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 3:58 PM To: [EMAIL PROTECTED] Subject: Win32::OLE-CreateObject('ADsSID) fails: Invalid class string Hello, I'm new to Win32::OLE and am trying to use it to create/delete Ms. Exchange mailboxes. I'm using code I found in the archives ( http://aspn.activestate.com/ASPN/Mail/Message/215825 ) and modified for my environment. Thanks to Steven Manross, I got past my first hurdle (i did not know my exchange ou value). (actually, i think the code i found in the archive is by him as well) So, now the code creates a mailbox, but it bombs when trying to associate an NT account to the mailbox. The code snippet where it fails is this: - my $sid = Win32::OLE-CreateObject(ADsSID) or die CreateObject(ADsSID): , Win32::OLE-LastError.\n; $sid-SetAs($ADS_SID_WINNT_PATH, WinNT://$NT_DOMAIN/$username,user); my $sidHex = $sid-GetAs($ADS_SID_HEXSTRING); $mailBox-Put(Assoc-NT-Account, $sidHex ); $mailBox-SetInfo; - The error I get is from the CreateObject : 0x800401f3: Invalid class string Any ideas? My only clue is this: Reading the perldoc for Win32::OLE reveals that the CreateObject method is deprecated in favor of 'new' instead. Fine. However, the doc says you need to pass 'new' a program id or a class id. Maybe ADsSID isn't a valid 'class id' in this context? If not, then what should I use? Also, I'm running the Win32::OLE code on a box that is remote to the MsExchange server box. Do I need to specify the hostname of the MsExchange server box in my call to 'new' ? Thanks for whatever help you lend. -- Happy Landings, Jon Detert Unix System Administrator, Milwaukee School of Engineering 1025 N. Broadway, Milwaukee, Wisconsin 53202 ___ 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: Win32::OLE ...
Er... following up on my own suggestion ... MakePy works in large part by generating lots of Python code corresponding to the OLE object to be bound. Rather than recreating all of MakePy in Perl, it would be much faster to modify MakePy so that it can optionally generate Perl code which is the equivalent of the Python code that it's already generating. Then a developer who needed early bindings in Perl could install Python on their own system, run MakePy, and then write the rest of their Perl code. Note that only the person making these original modifications to MakePy would actually need to write some Python code. -Jonathan At 10:24 AM 2/20/2002 , Jonathan Epstein wrote: Nearly everything IS possible in Perl. In Python for Win32, a tool called MakePy makes it possible to use early-bound automation. If you'd like to read about this, see chapter 12 of Mark Hammond's book _Python Programming on Win32_. Of course, Python is all open-source, so you can investigate this to your heart's content. Perhaps you or someone else can implement this same idea for Perl, if ActiveState hasn't done so already. I'd be surprised if they haven't already done this, since I believe that Mark Hammond now works for ActiveState. If a commercial package is an option, I suggest digging a little deeper into ActiveState's current offerings. -Jonathan At 05:33 PM 2/19/2002 , Amir Kashani wrote: That's because you're still trying to call a method on the TestClass2 object, which does not expose an IDispatch interface (what's known as late binding). You have to have a method on your COM object that will then delegate internally to the method on the TestClass2 object, hidden from the user. I don't understand why the object returned by calling the property would a TestClass2 object, when the property returns a TestClass1 object (which I believe would be an IDispatch object). From the research I've done on this, it seems to be a problem shared among scripting languages because of their lack of support for early bindings. I don't understand, however, why this workaround would work in VBScript, but not in Perl. Maybe it's just my stubborness in believing that everything is possible from Perl. Jonathan Epstein[EMAIL PROTECTED] Head, Unit on Biologic Computation (301)402-4563 Office of the Scientific Director Bldg 31, Room 2A47 Nat. Inst. of Child Health Human Development 31 Center Drive National Institutes of Health Bethesda, MD 20892 ___ 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
Slightly off-topic: Ms.'s ADSI and Win32::OLE
Hello, I'm trying to manage Ms.Exchange accounts via Win32::OLE. What I've read says you need to install Ms.'s ADSI (Active Directory Services Interface) as well as adssecurity.dll (which you then register manually). I've installed ADSI v2.5, but can't find adssecurity.dll anywhere. One might imagine that adssecurity.dll no longer exists per se, and that ADSI v2.5 along is now sufficient. However, my code is failing at the point where it tries to mess with 'security' aspects of a mailbox. This makes me think that I do still need to find adssecurity.dll. Any clues? Where can I find adssecurity.dll ? As best as I can tell, ADSI 2.5 from M$'s site, doesn't contain adssecurity.dll. Searching M$'s website for adssecurity.dll turned up nothing. Google found http://support.microsoft.com/default.aspx?scid=kb;EN-US;q279682 , which says adssecurity.dll can be found in the latest M$ Platform SDK. However, there are truckloads of downloadables under the heading of Platform SDK, and the one titled Platform SDK, Active Directory Services Interface brings you right back to ADSI v2.5, which doesn't contain adssecurity.dll. Thanks for whatever help you lend. -- Happy Landings, Jon Detert Unix System Administrator, Milwaukee School of Engineering 1025 N. Broadway, Milwaukee, Wisconsin 53202 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: pack
-Original Message- Behalf Of Morse, Richard E. Hah! I know what the problem is! ASCII character 10 happens to be either \n -- so when you print this number to the file, you get a newline character for one of the bytes, so your while(READ) loop finds three lines in the file instead of two. I think that in order to read this number back out of the file, you'll have to use sysread, instead of READ... In addition to the above you might want to look at why you would want a '\n' in the file at all. That is useful in a human readable file, but the file you will end up with will not be readable. And if you are looking for an end of data marker I don't think a single character (or two for win32) is going to be sufficient. Either 0x or 0x are probably better choices (or the 4 byte versions of each.) -Original Message- From: Sisyphus [mailto:[EMAIL PROTECTED]] Hi, Ok - so I'm running the code below and it's working as I want - unless either of the 2 values being written to the file is 10. (ie unless $num = 8 or 10). If the value is 10, then I get a couple of warnings about 'use of uninitialised value'. '10' is the only value I've found that exhibits this disgraceful behaviour. U .. I'm a little hard pressed to make sense of that something to do with the newline characters or the chomping perhaps ? use warnings; my $file = try; my $num = 2; open (WRITEB, $file) or die Can't open WRITEB: $!; binmode WRITEB; print WRITEB pack(I,$num,), \n; print WRITEB pack(I,$num + 2), \n; close (WRITEB) or die Can't close WRITEB: $!; open (READ, $file) or die Can't open READ: $!; binmode READ; while (READ) { chomp; $ret = unpack(I, $_); print $ret, \n; } close (READ) or die Can't close READ: $!; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Opening default browser and passing it options!
All below is a subroutine I have for a TK app which launches the default browser and sends it to a given URL. I would also like to 'TAG' the browser with a 'name' so that I can send different URL's to different Browsers (this would be great). What I would like to do is pass options to the browser so that it opens to a given size and without any buttons. Is this possible from the command line? Incidentally anybody know why the first 'if' line throws up an error saying that SW_SHOWNORMAL isn't defined? Any help at all would be appreciated. Kind Regards Marty sub LaunchBrowser { my $self=shift; my $url=shift; my $target=shift; #if (Win32::Shell::Execute(open, $url, undef, undef, SW_SHOWNORMAL)) if (Win32::Shell::Execute(open, $url, undef, undef, 1)) { return 1; } else { return 0; } } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: pack
On Thu, 21 Feb 2002 01:11:01 +1100 Sisyphus [EMAIL PROTECTED] wrote: Hi, Ok - so I'm running the code below and it's working as I want - unless either of the 2 values being written to the file is 10. (ie unless $num = 8 or 10). If the value is 10, then I get a couple of warnings about 'use of uninitialised value'. '10' is the only value I've found that exhibits this disgraceful behaviour. U .. I'm a little hard pressed to make sense of that something to do with the newline characters or the chomping perhaps ? use warnings; my $file = try; my $num = 2; open (WRITEB, $file) or die Can't open WRITEB: $!; binmode WRITEB; print WRITEB pack(I,$num,), \n; if $num==10 you are really printing \n\0\0\0\n to the file on a little endian machine like a PC. pack( I, 10 ) gives \n\0\0\0. The least significant byte is 10 which is the ASCII newline character. print WRITEB pack(I,$num + 2), \n; close (WRITEB) or die Can't close WRITEB: $!; open (READ, $file) or die Can't open READ: $!; binmode READ; while (READ) { Here you want to read one line at a time. If $num was 10 you will get 2 lines. The first one will be \n the 2nd \0\0\0\n. chomp; chomp makes from \n. $ret = unpack(I, $_); unpack( I, ) yields undef. print $ret, \n; and here you get your warning } close (READ) or die Can't close READ: $!; In generally do not mix binary and line oriented IO. In your example you can print WRITEB pack(I,$num,); without the newline and then use read or sysread: read READ, $_, length( pack( I, 0 ) ); Cheers, Rob ___ 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: Strange if syntax
- Original Message - From: Jeffrey [EMAIL PROTECTED] To: Perl win32 [EMAIL PROTECTED] Sent: Wednesday, February 20, 2002 12:36 PM Subject: Strange if syntax I'm poking through someone else's code, and found this: $skip_path_checks = ; if ($skip_path_checks) {;}; Does this make sense to anyone else? I am assuming that the author meant: $skip_path_checks = if ($skip_path_checks); Essentially (with the ';' in place) it would mean: Set the value of $skip_path_checks to nothing If $skip_path_checks HAS a non-zero value do nothing. In this situation, there is no point in checking if it has a non-zero value, since it has just been set to no value, so the 'if' statement will always fail. Without the ';' in place, it says: If the value of $skip_path_checks is non zero, then clear it. The only case in which it would not clear is if the numeric value was '0' or the string value evaluated to '0'. Since you haven't provided information on what information the scalar is expected to hold, it's difficult to determine the author's intent. ego Edward G. Orton, GWN Consultants Inc. Phone: 613-764-3186, Fax: 613-764-1721 email: [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Problem trying to run IE through OLE
I'm using the following code in an attempt to control IE through OLE, the code is what seems right (to me) from the Win32::OLE Browser. use Win32::OLE; my $url = 'http://www.google.com/'; my $IE = Win32::OLE-new('InternetExplorer.Application', 'Quit') or warn Win32::OLE-LastError; $IE-Visible or warn Win32::OLE-LastError; $IE-Navigate($url) or warn Win32::OLE-LastError; $IE-GoHome or warn Win32::OLE-LastError; I've checked and $IE is defined by Win32::OLE-new. The only error I get is error: 0 at ie.pl for each line where I've called a method on $IE. -- Stephen Patterson http://www.lexx.uklinux.net/ [EMAIL PROTECTED] (remove spam to reply) ICBM address 54-22-0N 0-28-0W Linux Counter No: 142831 GPG Public key: 252B8B37 available on public keyservers. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Strange if syntax
--- Edward G. Orton [EMAIL PROTECTED] wrote: Essentially (with the ';' in place) it would mean: Set the value of $skip_path_checks to nothing If $skip_path_checks HAS a non-zero value do nothing. In this situation, there is no point in checking if it has a non-zero value, since it has just been set to no value, so the 'if' statement will always fail. That's what it looks like to me -- set $skip_path_checks to null, then test to see if it's null. And if it's not null, do nothing. The rest of the code is just as well designed. I tried running the script without the ; between the and the if -- I got a syntax error: syntax error at try.pl line 1, near {; Execution of try.pl aborted due to compilation errors. (try.pl contents: $skip_path_checks = if ($skip_path_checks) {;}; ) Since you haven't provided information on what information the scalar is expected to hold, it's difficult to determine the author's intent. The line is right at the beginning of the file, after some legal comments. So I have no idea what the author expected it to hold, either. sigh I really dislike Rational's Perl coders... Thanks for the responses, but don't bother with this much more, since I don't think that even the author knew what the script was trying to do. = Jeffrey Hottle nkuvu at yahoo dot com __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Perl, OLE, and Excel commands.
Hello, I've been playing around with spawning and populating Excel spreadsheets from PERL scripts. There are a number of modifications I would like to make to the sheets from PERL (i.e Format-Columns-Auto Width.) However, I have not found a good reference to potential Excel commands available via OLE and their syntax. Is there either a reference or a general way to call Excel Menu commands from OLE from within PERL? Thanks, Daniel ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Perl, OLE, and Excel commands.
- Original Message - From: Daniel Needles [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 20, 2002 4:54 PM Subject: Perl, OLE, and Excel commands. Hello, I've been playing around with spawning and populating Excel spreadsheets from PERL scripts. There are a number of modifications I would like to make to the sheets from PERL (i.e Format-Columns-Auto Width.) However, I have not found a good reference to potential Excel commands available via OLE and their syntax. Is there either a reference or a general way to call Excel Menu commands from OLE from within PERL? Try looking at the VB reference help file within Excel. The Objects and Methods for VB are defined there, and you can call them from a perl script by changing the VB '.' notation to Perl's '-' notation. It's a good place to start. ego Edward G. Orton, GWN Consultants Inc. Phone: 613-764-3186, Fax: 613-764-1721 email: [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl, OLE, and Excel commands.
-Original Message- From: Edward G. Orton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 2:03 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Perl, OLE, and Excel commands. - Original Message - From: Daniel Needles [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 20, 2002 4:54 PM Subject: Perl, OLE, and Excel commands. Hello, I've been playing around with spawning and populating Excel spreadsheets from PERL scripts. There are a number of modifications I would like to make to the sheets from PERL (i.e Format-Columns-Auto Width.) However, I have not found a good reference to potential Excel commands available via OLE and their syntax. Is there either a reference or a general way to call Excel Menu commands from OLE from within PERL? Try looking at the VB reference help file within Excel. The Objects and Methods for VB are defined there, and you can call them from a perl script by changing the VB '.' notation to Perl's '-' notation. It's a good place to start. Depending on the installation method, these may or may not be available on your system. If they are not, and you have access to the installation media, you can add them using the same setup program used to install MS Office. Alternatively, you can use the OLE Object Browser, accessible from within Excel. From Excel, select Tools | Macro | Visual Basic Editor, then within VBE, select View | Object Browser (or just click on the Object Browser button in the toolbar). The VBA Reference Manual is also accessible off Microsoft's MSDN site. HTH, Ian ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
exec stored procedure
Hi, I am using perl to execute store procedure using record set $rs-open(EXEC spProcedure,$conn); But could not get any record back (I got $rs-RecordCount = -1) But in I can run EXEC spProcedure in Sql Query Analyzer and have records returned. The perl program works fine if I run SQL statements instead of store procedure. Any body knows why? PC ** This email and any files transmitted with it from the ElPaso Corporation are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. ** ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Adding Users to Groups
I've been fighting this all day. I need to migrate about 30 local groups and about 500 domain users from an NT 4.0 box to a Win2000 box. I've been able to create the groups using Win32::Lanman, but haven't been able to add users to those groups with either Win32::Lanman or Win32::NetAdmin. I'm logged on as administrator with Perl 5.6 Build 631 on the box. Any suggestions??? WINMAIL.DAT Description: application/ms-tnef
RE: Adding Users to Groups
This works for me using Lanman 1.0.9.1 and 1.0.9.2. What code are you using? What errors are you getting? More info would help. if(!Win32::Lanman::NetGroupSetUsers($PDC, $GrpAllowed, \@members1)) { $^E = my $Error = Win32::Lanman::GetLastError(); LogText($AppPath\\$LogFile, Error setting $GrpAllowed membership on $PDC. Error: $Error $^E); if ($Error == 2234) { my $text = One or more user accounts have $GrpAllowed set as their \'Primary Group\'. . The account must be located and the Primary Group reset to \'Domain Users\'; LogText($AppPath\\$LogFile, $text); } } else { LogText($AppPath\\$LogFile, $PDC \'$GrpAllowed\' updated successfully with . scalar (@members1) . members); } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 4:00 PM To: [EMAIL PROTECTED] Subject: Adding Users to Groups I've been fighting this all day. I need to migrate about 30 local groups and about 500 domain users from an NT 4.0 box to a Win2000 box. I've been able to create the groups using Win32::Lanman, but haven't been able to add users to those groups with either Win32::Lanman or Win32::NetAdmin. I'm logged on as administrator with Perl 5.6 Build 631 on the box. Any suggestions??? ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Want to automatically switch between windows on a NOC PC
I have a PC in a NOC running several applications in windows. The PC has a very large display and is being used primarily for display-only. I would like to automatically switch between the windows every 10 seconds (i.e., take turns bringing each one to the front.) I've played around a little with Win32::OLE, but don't see anyway of doing it there. Is there a way to do this with Win32::OLE? Does anyone have a better approach? Thanks, Doug ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Want to automatically switch between windows on a NOC PC
Note that in general you can switch Windows tasks by using Alt+Tab. Here's a macro in an unrelated macro language (Dragon NaturallySpeaking, but that's irrelevant) ... it brings up the Nth task on the taskbar. SendSystemKeys {Ctrl+Esc} Wait 20 SendSystemKeys {Esc} os$ = DllCall$( jaeext2.dll, GetOSVersion, , 2048) IF os$ = 2000 THEN SendKeys {Tab}{Tab} ELSE SendKeys {Ctrl+CapsLock}{Tab} END IF SendKeys {Right + _arg1+} SendKeys {Space} You'll want to implement something (to send the keystrokes) similar in Perl using your choice of Win32::Setupsup OR Win32::GuiTest. To test this manually, try hitting the keystrokes {Ctrl+Esc}{Esc}{Tab}{Tab}{Right}{Right}{Space} to bring up the second task on your taskbar. The up-front design requirement is that you either know or can inform the switching program which of the available tasks on the taskbar you want to control in this manner (e.g., 4 through 8 OR 3,4,6,9). I guess you'll want to have an easy way to manually take control from the task switcher and then easily return control when you're done investigating something. HTH, -Jonathan At 04:08 PM 2/20/2002 , Kratky, Doug wrote: I have a PC in a NOC running several applications in windows. The PC has a very large display and is being used primarily for display-only. I would like to automatically switch between the windows every 10 seconds (i.e., take turns bringing each one to the front.) I've played around a little with Win32::OLE, but don't see anyway of doing it there. Is there a way to do this with Win32::OLE? Does anyone have a better approach? Thanks, Doug Jonathan Epstein[EMAIL PROTECTED] Head, Unit on Biologic Computation (301)402-4563 Office of the Scientific Director Bldg 31, Room 2A47 Nat. Inst. of Child Health Human Development 31 Center Drive National Institutes of Health Bethesda, MD 20892 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs