RE: send output to a parallel port?

2005-07-20 Thread Thad Schultz
- Original Message - 
From: robert [EMAIL PROTECTED]
To: perl-win32-users@listserv.ActiveState.com
Sent: Wednesday, July 20, 2005 1:27 PM
Subject: send output to a parallel port?


 Hey all

 we have some devices at work that are controlled by sending signals via
the
 computer's parallel port.  (because all the serial ports are being used
 elsewhere)

 the parallel port (LPT) has the address 0x378.  to do this in C, its quite
 simple:

 void parallel_device (int state)
 {
 outp (0x378,state);
 return;
}

I think this question came up once already.  Go to 
http://www.logix4u.net/inpout32.htm and download inpout32.dll (link is clear 
down at the bottom of the page).  Here's the perl code I use to play around.  I 
never got around to doing anything useful with it.  Hope this helps.

---code---
use strict;
use warnings;
use Win32::API; #load API module to interface DLL's

my $GetPortVal = Win32::API-new('inpout32', 'Inp32', ['I'], 'I') or die 
Couldn't create Win32::API object: $! $^E;

my $SetPortVal=  Win32::API-new('inpout32', 'Out32', ['I','I'], 'I') or die 
Couldn't create Win32::API object: $! $^E;

my $input= $GetPortVal-Call(0x378)  255; #get and display current value of 
address 378 hex print $input\n;
print Original Port Value=$input\n\n;

my $return=$SetPortVal-Call(0x378,0x23); #set pins 2,3,7 (pins, not bits)
print Call return value=$return\n\n;

$input= $GetPortVal-Call(0x378)  255; #get and display updated value  of 
address 378 hex
print New Port Value=$input\n;

---code---

Thad Schultz
EDA Librarian / Sys Admin
Woodward Industrial Controls 
[EMAIL PROTECTED]
ph (970)498-3570
fax (970)498-3077
www.woodward.com





***
The information in this e-mail is confidential and intended solely for the 
individual or entity to whom it is addressed.  If you have received this e-mail 
in error, please notify the sender by return e-mail, delete this e-mail, and 
refrain from any disclosure or action based on the information.
***

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


RE: disable cdrom and floppy

2004-03-17 Thread Thad Schultz
 -Original Message-
 From: Peter Guzis [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 16, 2004 10:33 AM
 To: Pesce, Nicholas (Novus Consulting Group);
 [EMAIL PROTECTED]
 Subject: RE: disable cdrom and floppy
 
 
 use strict;
 use Win32::API;
 
 my $drive_letter = 'Z:';
 
 my $DeleteVolumeMountPoint = new Win32::API ('kernel32', 
 'DeleteVolumeMountPoint', ['P'], 'I');
 
 if ($DeleteVolumeMountPoint-Call ($drive_letter\\)) {
 
   print Drive $drive_letter successfully deleted\n;
 
 } else {
 
   print Unable to delete drive $drive_letter\n;
 
 }

I'm curious Peter, can you show how to add the drive letter back to a
volume?  In my case I'm only concerned about one machine so I'm not worried
about devices and partitions moving around on me.  

Thanks.

Thad Schultz
EDA Librarian / Sys Admin
Woodward Industrial Controls 
[EMAIL PROTECTED]
ph (970)498-3570
fax (970)498-3077
www.woodward.com



The information in this e-mail is confidential and intended solely for the individual 
or entity to whom it is addressed.  If you have received this e-mail in error, please 
notify the sender by return e-mail, delete this e-mail, and refrain from any 
disclosure or action based on the information.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Searching a binary file for a specific sequence of hex values?

2002-11-15 Thread Thad Schultz
What are the best ways to search a binary file for a specific sequence of
hex values?  The sequence that I'm looking for is: FF D8 FF E0 00 10 4A 46
49 46 00.  The files that I'm searching are 14K bytes in size.  I suppose
the easiest way would be slurp the whole file in at once and then search for
my sequence in some string variable.  But what if my files were huge?  Do I
read in one character at a time until I find an FF and then I look for the
D8 and then the rest of the hex values resetting my search if I fail to find
the next value in the sequence?  Or do I read in 1K of data at a time and
search that for my sequence?  Could some of you who have been down this road
before point me in the right direction?  I'm not asking you to write my code
for me (unless you want to).  I'm just looking for pointers and suggestions.

Thanks!

Thad Schultz
EDA Librarian / Sys Admin
Woodward Industrial Controls 
[EMAIL PROTECTED]
ph (970)498-3570
fax (970)498-3077
www.woodward.com



***
The information in this e-mail is confidential and intended solely for the
individual or entity to whom it is addressed. If you have received this
e-mail in error please notify the sender by return e-mail, delete this
e-mail, and refrain from any disclosure or action based on the information.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Using PPM packages for 5xx and 6xx on the same machine

2002-10-31 Thread Thad Schultz
This question has been bugging me for a while now and I am hoping some of
you out there can tell me if my thinking is on-track or am I way off on this
one.

Say I've successfully written a daemon to monitor a directory for me using
Win32::Daemon and Win32::ChangeNotify.  Win32::ChangeNotify only exists in
the PPM package repository for AS Perl builds of 5xx.  Because of this I've
installed AS Perl build 522.  All is well with my little daemon.

Now suppose I want to write a Perl script that uses many of the Tk packages
that are only found in the 6xx build repository.  Now what do I do?  I know
that you can have multiple versions of AS Perl on your machine but I believe
you have to manipulate your PATH and ENV variables before switching
versions.  How do I create my Tk script using build 633 without messing up
my daemon which uses build 522?  Am I missing something?  Am I way off on my
thinking?  Am I making this harder than this really is?  I'd appreciate
anyone's thoughts on this.

TIA

Thad Schultz
EDA Librarian / Sys Admin
Woodward Industrial Controls 
[EMAIL PROTECTED]
www.woodward.com



***
The information in this e-mail is confidential and intended solely for the
individual or entity to whom it is addressed. If you have received this
e-mail in error please notify the sender by return e-mail, delete this
e-mail, and refrain from any disclosure or action based on the information.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Hiding/Showing outline levels in Excel

2001-05-10 Thread Thad Schultz

Does anyone know how to write the following Visual Basic line in Perl?  This
came from an Excel macro that I recorded to change the number of outline
levels shown to 1.

   ActiveSheet.Outline.ShowLevels RowLevels:=1

Thanks!

Thad Schultz
EDA Librarian / Sys Admin
Woodward Industrial Controls 
[EMAIL PROTECTED]
ph (970)498-3570
fax (970)498-3689
www.woodward.com


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users