Re: [python-win32] argument passing problem on Windows 7 64-Bit

2015-08-03 Thread Tony Cappellini
Dennis,

 C:\Users\Wulfraed\Documents\Python Progsftype Python.File
 Python.File=C:\Python_x64\Python27\python.exe %1 %*

This appears to have fixed my problem.
I am now seeing output similar to yours, that is, the same output in both cases.


I am curious how this issue came to be. I don't just edit the
registry, because I don't
know what to add/remove/change.


Thank You!
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] argument passing problem on Windows 7 64-Bit

2015-07-31 Thread Tony Cappellini
Hello,

I've got Python 2.7.10 64-Bit installed, via the Anaconda installer

The path clearly shows C:\Anaconda in the path. Typing python by
itself brings up
the python REPL as expected.

Running this simplified program easily illustrates the problem I'm seeing
in another, larger Python program.

http://pastebin.com/0bjBLgDh

Running that script as:
python cmdline.py 1 2 3
shows the expected output - Cmd line args: ['cmdline.py', '1', '2', '3']

Running that script as - cmdline.py 1 2 3
shows this output -Cmd line args:
'C:\\Users\\tonycappellini\\Projects\\cmdline\\cmdline.py']

Searching for help yielded these,
http://superuser.com/questions/429604/passing-arguments-to-a-python-script-file-association-not-found-windows-7-on-i
https://technet.microsoft.com/en-us/library/bb490912.aspx


I found that assoc .py
showed this -File type 'Python.File' not found or no open command
associated with it

ftype Python.file
shows python.file=c:\Anaconda\python.exe %1 %*

So, I've added this association for .py files
assoc .py=Python.file

and rebooted

assoc .py
now shows .py=Python.file

However, arguments are still not being correctly passed to Python files.

I am stumped by this issue, as it has never been a problem for me in
the ~10 years that I've been using Python n Windows.
I am working at a new job where all development systems use Windows 7
64-Bit. The systems at my previous place of employment used Windows 7
32-Bit,
but I wouldn't expect this kind of problem from moving to a 64-But OS.

I would appreciate some help understanding and fixing this issue,

Thanks
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Help with starting new processes

2014-08-22 Thread Tony Cappellini
Hello,

I'm running Python 2.7.6 on 32-Bit Windows7 Pro. (Python 3 isn't an option
at the moment)

I have a parent python script which spawns two subprocesses- where each
subprocess is running
in a new console window. I want to watch each process running. This is why
I've explicitly used
creationflags=CREATE_NEW_CONSOLE in the subprocess.Popen() call.

(Oddly enough, CREATE_NEW_CONSOLE is a Windows-specific flag.)

The subprocesses are running a simple CLI program which are monitoring some
embedded devices being tested.
I don't want to use a GUI for them.

Here is the code for the parent script
http://pastebin.com/mNNCH1vY


Ideally, I'd like the parent script to pass some information via a queue,
to each subprocess.
The queues have nice functionality which would allow the receiving process
to work until the queue is empty,
and then wait until it is no longer empty.

I don't see a way to use pass a queue using the subprocess module,
nor do I see a way to create a new console using the multiprocessing module.
Multiprocessing makes it quite easy to pass a queue to the subprocesses.

I've spent a lot of time with the documentation for both modules, but they
are of no help for this particular issue.

Is there a happy medium between these two modules that will help me
get what I want?



Thanks


Tony
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] win32ui.CreateFileDialog() hangs on Windows 7

2014-06-20 Thread Tony Cappellini
I'm running Python 2.7.6, PythonWin build 218 on Windows 7 Pro, 32-Bit

The code below hangs after the browse() function returns to the caller.
I do see After displayed in the console window.

Is anyone else seeing this problem on Windows?
Thanks

import win32ui
import os


def browse(startingDirectory=None,defaultFilespec=*.*):

   if startingDirectory is not None:
  startingDirectory = os.getcwd()
   FILE_OPEN = 1
   dlg = win32ui.CreateFileDialog( FILE_OPEN, defaultFilespec )
   fn  = None
   try:
  if dlg:
 dlg.SetOFNInitialDir( startingDirectory )
 dlg.DoModal()
 fn = dlg.GetPathName()
   finally:
  del dlg

   return fn

print\nBefore
browse()
print\nAfter\n
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] optimizing code to read serial port

2014-02-16 Thread Tony Cappellini
Message: 1
Date: Sun, 16 Feb 2014 12:02:45 +1300
From: Greg Ewing greg.ew...@canterbury.ac.nz
To: python-win32 python-win32@python.org
Subject: Re: [python-win32] optimizing code to read serial port
Message-ID: 52fff215.9000...@canterbury.ac.nz
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Could the terminal program possibly be using some
protocol such as xon/xoff for flow control? If so,
that might account for the difference.

It does support that option, but we use the default settings which
is no control flow - for that terminal program. There is a ini file
which is distributed on every system we use for collecting the diagnostic
data.
The settings in that ini file are 8N1 9600, No control flow.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] optimizing code to read serial port

2014-02-15 Thread Tony Cappellini
Vernon

Your suggestion is interesting but not practical for our needs.
We are collecting data from many devices that have failed tests, and often
have 10 or more failed devices that we need to collect the data from. These
are scattered all over a large lab environment. I have a Raspberry Pi, and
may try your suggestion on 1 device just to see the result.

Do you have any ides why running a terminal program written in (presumably
C, mentioned in my original message) doesn't seem to suffer from the
problems that my python app does, even when transferring the data at much
higher baud rates?

You will soon need to be using another solution anyway.
We've been using USB-serial adapters for a long time.

Thanks


On Sat, Feb 15, 2014 at 2:32 AM, Vernon D. Cole vernondc...@gmail.comwrote:

 Tony:

   Don't do it!

 Do not attempt to make your data transfer faster while using this
  defective hardware design!  Trust me on this.  I have been doing serial
 port data transfer since 300 baud was fast.

 The problem with your data transfer speed is not your program
 optimization. It is contained in the sentence:  The serial port on the
 device we are dumping data from has a 2-wire interface (no handshaking).
 This means that the program servicing the serial port must be scheduled at
 time intervals less than the time needed to fill your FIFO buffer.  Using
 Windows, you cannot guarantee that with any degree of certainty --
 particularly not at higher data rates -- because you have no control over
 the hardware-level interface drivers.

 If you really want higher data rates, you must use a dedicated device to
 receive the data. May I humbly suggest that an hour of your programming
 time would purchase a single board computer with a Python engine? Look at
 http://www.raspberrypi.org/.  Let the SBC collect the data.  Transfer
 blocks from it to the Windows environment using a more reliable protocol.

 Consider that none of the new Windows boxes I saw on my last shopping trip
 had serial ports.  You will soon need to be using another solution anyway.







 On Sat, Feb 15, 2014 at 3:01 AM, Tony Cappellini cappy2...@gmail.comwrote:


 python-win32@python.org

 Regarding an in-house python program we use for dumping diagnostic data
 over a serial port on Windows 7 ...


 I'm trying to determine if it's possible optimize the python code so that
 dumping the data will occur faster. Currently, it takes ~25 minutes at 9600
 baud to dump 8-15 MB of data. Going to higher baud rates does reduce this
 time, but depending on which PC is running the program, going to higher
 baud rates often results in ill-formed data. The serial port on the device
 we are dumping data from has a 2-wire interface (no handshaking). Sometimes
 115200 baud works fine, other times the data gets all jumbled. We've
 decided to default to 9600 to avoid getting jumbled data.

 Compared to an openly available terminal program (Tera Term Pro) written
 in a compiled language, our Python version is much slower, but easier to
 program. Tera Term's scripting language isn't as easy to script with as
 Python.

 At the lowest level of the Python app, the last call in python is
 win32file.ReadFile( comport, bytes_, None ). I believe execution goes to
 a PyWin32 extension module at this point.

 By default, 1 is passed in for the number of bytes to read. I thought
 this was very inefficient,
 so I've experimented with values like 2,4,8,16. I didn't want to go
 higher than 16 because the serial port FIFO on many PCs isn't any larger
 than 16.

 While using cProfile, I could see that the number of function calls
 executed was cut in half,
 each time the # of bytes read doubled. Normally this would be a win, but
 the total time to dump the same amount of data over the serial port would
 almost double also.

 While this may not be strictly a Python-specific issue, the performance
 issue may be related to the Python-Win32 interface. For example, are there
 more efficient ways to read data from a serial port using Python, than
 calling win32file.ReadFile() ?

 I would also expect reading more 8-16 bytes at a time to be more
 efficient than reading 1 byte.
 I do expect that buffering weighs in heavily here, but I have no control
 over what the serial hardware does nor how windows interacts with it.

 Having read several of the Python optimization tips, I've already
 eliminated string concatenation, replaced globals variables with locals,
 and eliminated several dot references that are inside of loops.There
 doesn't seem to be any places I can use calls to map() or replace for loops
 with list/gen comps.

 There is too much code in the app to post here. I know it's difficult to
 comment on code that you can't see.

 The Python app is a single-threaded console app running on Python 2.7,
 but we've seen the same performance issues as far back as Python 2.3 on
 Windows XP.  I've finally decided to investigate this because users of the
 program are complaining about the time

Re: [python-win32] optimizing code to read serial port

2014-02-15 Thread Tony Cappellini
No, I haven't.

But I'd be happy to give it a try. Chances are the serial I/O with this
package are more efficient
than the way my program is doing it now.
Thanks for that tip.

I'm also considering compiling my app to a compiled exe using PyPy, once I
understand
the compiler requirements for Windows.





On Sat, Feb 15, 2014 at 9:40 AM, RayS r...@blue-cove.com wrote:

  At 08:14 AM 2/15/2014, you wrote:

 Vernon

 Your suggestion is interesting but not practical for our needs.


 Have you profiled pySerial? http://pyserial.sourceforge.net/examples.html
 I use it in my LX200 serial telescope package
  http://rjs.org/Python/LX200/LXSerial.py/LXSerial.html
  http://rjs.org/Python/LX200.zip

 - Ray


___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] optimizing code to read serial port

2014-02-15 Thread Tony Cappellini
 I second the suggestion to try pySerial.  I have used it for years to
control RS-232 equipment -- don't know why I did not think of that.
Like Terra-Term, pySerial will use device-level, rather than
file-level APIs to talk to the UART.

I was hoping to hear something exactly like this comment, since I'm not
very familiar with the details of the winapi, and suspected there may be
 several ways to talk to a serial port.

As far as the drivers, when I'm not using a USB-seral adapter, the serial
port
driver is coming straight from Redmond.

I will give this a try, then post some results.



On Sat, Feb 15, 2014 at 11:04 AM, Vernon D. Cole vernondc...@gmail.comwrote:

  I second the suggestion to try pySerial.  I have used it for years to
 control RS-232 equipment -- don't know why I did not think of that.
 Like Terra-Term, pySerial will use device-level, rather than
 file-level APIs to talk to the UART.

 Of course, your success will depend a great deal on the skill of the
 programmer who wrote the driver for your USB-serial device. The
 important part of the work is done in the driver when it processes
 interrupts in Kernel mode. The USB adapter I tried -- well, lets just
 say it's still sitting in a box of loose parts. That's why I have been
 contemplating a Raspberry Pi purchase myself.   Perhaps we should take
 this discussion off line and compare notes.

 
  On Sat, Feb 15, 2014 at 9:40 AM, RayS r...@blue-cove.com wrote:
 
  At 08:14 AM 2/15/2014, you wrote:
 
  Vernon
 
  Your suggestion is interesting but not practical for our needs.
 
 
  Have you profiled pySerial?
 http://pyserial.sourceforge.net/examples.html
  I use it in my LX200 serial telescope package
  http://rjs.org/Python/LX200/LXSerial.py/LXSerial.html
  http://rjs.org/Python/LX200.zip
 
  - Ray
 
 

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] optimizing code to read serial port

2014-02-14 Thread Tony Cappellini
python-win32@python.org

Regarding an in-house python program we use for dumping diagnostic data
over a serial port on Windows 7 ...


I'm trying to determine if it's possible optimize the python code so that
dumping the data will occur faster. Currently, it takes ~25 minutes at 9600
baud to dump 8-15 MB of data. Going to higher baud rates does reduce this
time, but depending on which PC is running the program, going to higher
baud rates often results in ill-formed data. The serial port on the device
we are dumping data from has a 2-wire interface (no handshaking). Sometimes
115200 baud works fine, other times the data gets all jumbled. We've
decided to default to 9600 to avoid getting jumbled data.

Compared to an openly available terminal program (Tera Term Pro) written in
a compiled language, our Python version is much slower, but easier to
program. Tera Term's scripting language isn't as easy to script with as
Python.

At the lowest level of the Python app, the last call in python is
win32file.ReadFile( comport, bytes_, None ). I believe execution goes to a
PyWin32 extension module at this point.

By default, 1 is passed in for the number of bytes to read. I thought this
was very inefficient,
so I've experimented with values like 2,4,8,16. I didn't want to go higher
than 16 because the serial port FIFO on many PCs isn't any larger than 16.

While using cProfile, I could see that the number of function calls
executed was cut in half,
each time the # of bytes read doubled. Normally this would be a win, but
the total time to dump the same amount of data over the serial port would
almost double also.

While this may not be strictly a Python-specific issue, the performance
issue may be related to the Python-Win32 interface. For example, are there
more efficient ways to read data from a serial port using Python, than
calling win32file.ReadFile() ?

I would also expect reading more 8-16 bytes at a time to be more efficient
than reading 1 byte.
I do expect that buffering weighs in heavily here, but I have no control
over what the serial hardware does nor how windows interacts with it.

Having read several of the Python optimization tips, I've already
eliminated string concatenation, replaced globals variables with locals,
and eliminated several dot references that are inside of loops.There
doesn't seem to be any places I can use calls to map() or replace for loops
with list/gen comps.

There is too much code in the app to post here. I know it's difficult to
comment on code that you can't see.

The Python app is a single-threaded console app running on Python 2.7, but
we've seen the same performance issues as far back as Python 2.3 on Windows
XP.  I've finally decided to investigate this because users of the program
are complaining about the time to dump the data.

I would appreciate your thoughts on this issue.

thanks
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Understanding Access Denied when calling win32process.TerminateProcess() from Run As Administrator prompt

2013-10-01 Thread Tony Cappellini
When running  from a *Run As Administrator* prompt on Windows 7
Professional 32-Bit,

my Top-level python script spawns a process (which is another python
script) using os.spawnv( )

When the top-level script ends, it attemps to call
win32process.TerminateProcess() with the handle
that was created during the os.spawnv() call.

win32process.TerminateProcess(self._handle, exitCode)
pywintypes.error: (5, 'TerminateProcess', 'Access is denied.')

is displayed.

This runs on Windows XP just fine. Obviusly, Windows 7 is more stringent
with security concerns.
We use Python 2.3, so subprocess and multiprocess are not available.


I don't understand why this is an issue when running from the Run As
Administrator prompt.

Are there any other workarounds- until we migrate to Python 2.7?

Thanks
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Passing an object to a process

2012-03-14 Thread Tony Cappellini
On Windows XP - I've got a program running which has spawned a process
using os.spawnv().

My program has a logger object instantiated that I want to pass to the
process that was spawned.
I need to log errors seen by the process, to the same logfile that the
program uses for logging.

I have the handle, thread ID, and process id of the process, but I see no
way to share the logger object using these values.

How can I pass a logger instance to the process, from the program which
spawned the process?

For legacy compatibility reasons, I'm stuck with an older version of Python
that doesn't have the subprocess module and other features that are
available with more modern releases of Python.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Passing an object to a process

2012-03-14 Thread Tony Cappellini
Thanks for all the advice.

The solution is simple, but neither elegant nor Pythonic. It's a kludge,
but will suffice.

The process simply opens  writes a 1 line log file, then closes it. The
process also increments a counter
each time the log file is written, and writes the counter value to the
process log file.

The program checks to see if the file exists, reads it, then writes the
process log file content to the program log file.
The program then deletes the process log file. (probably unnecessary, but
prevents the possibility of the same line in the process log file
from being written to the program log file more than once.)

Performance isn't a concern, and this code won't be going to production.
It's just for debugging.

On Wed, Mar 14, 2012 at 1:49 PM, Max Slimmer m...@slimmersoft.com wrote:

 If you are really just logging, use separate loggers/files, sync the
 clocks, and timestamp records, then merge when you are ready to
 process if you need timeline related results.


 On Wed, Mar 14, 2012 at 1:29 PM, Preston Landers pland...@gmail.com
 wrote:
  On Wed, Mar 14, 2012 at 2:55 PM, Tony Cappellini cappy2...@gmail.com
 wrote:
 
  in which objects can truly move from one process to another is
  recreating them in the other process.  Even fork() makes copies of
   everything.
 
  Recreating an object in another process means it's a different object,
 not a
  shared one.
 
  Yeah, I know.  I was trying to make that point.  There's no real way
  for the same object to exist in multiple processes other than SYSV
  shared mem.
 
  Truly shared memory (i.e, SYSV style) is tricky, not very portable,
  and usually the wrong answer in my experience. As fas as I know stock
  Python doesn't support that, and definitely never will on Windows.
 
  The point is that you need to figure out what problem you're really
  trying to solve (logging to one file from multiple processes, it
  sounds like) and then find the best / simplest approach, which I can
  tell you definitely doesn't involve SYSV shared memory.   It's
  probably just creating separate logging objects in each process,
  pointing to the same file, and protected by file locking if necessary.
 
 
  Have you tried pickle or other techniques of serialization? Not sure
  offhand if the logger module supports pickle but it might.
 
  Yes. I've just tried this, even though I expected it not to work.
 
  If process A pickles a logger object, and process B unpickles it,
  referencing of an object in a different process is meaningless.
 
  In my case, when the process attempted to write to the logger, no
 entries
  were seen in the logfile. Surprisingly, no exceptions occurred- but this
  could just be a coincidence.
 
  Probably because the logger object, when serialized, saves a reference
  to an open filehandle, which won't be automatically transfered to the
  other process.
 
  (There might ultimately be a way to make that work by inheriting
  filehandles, but again, if you can find something simpler...)
 
 
 
  That may work, and with less effort than my original idea.
 
  But if two processes write to the logfile at the same time (especially
 on a
  multicore machine),
  hard-to-read logfiles may result.
  it's worth a try.
 
  Yes, that type of thing can occur, but you can also get around that
  with simple file locking.  By the way, that same problem certainly
  exists even if you somehow shared the object between two processes -
  what if the two processes made a log call at the same time?
 
  File locking may introduce some performance issues if the logging is
  very frequent, but usually you can find ways to mitigate that.
 
  The main app I work on uses log files extensively, and the same file
  is appended to by unrelated processes without a locking mechanism.
  Occasionally you do see some interleaving of log entries but in my
  experience it's fairly rare and in my particular case we don't care
  much about that anyway.
 
  regards,
  Preston
  ___
  python-win32 mailing list
  python-win32@python.org
  http://mail.python.org/mailman/listinfo/python-win32

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Trying to make use of pyAudiere

2011-08-17 Thread Tony Cappellini
 From: Jacob Kruger bandi...@gmail.com
 To: python-win32@python.org
 Subject: [python-win32] Trying to make use of pyAudiere
 Message-ID: PC1760201108161557350376609ccfbb@JacobKruger-PC
 Content-Type: text/plain; charset=iso-8859-1

 http://www.pyaudiere.org/

 From within either the interpreter, or from within my own .py files, it 
 always seems to complain about importing (internally) numpy.core.multiarray 
 module, but on the second import call to audiere itsself, it's fine, and 
 works well enough.

Sadly to say, there doesn't seem to be much development for packages
which support audio processing for Python.
I hadn't heard of pyAudiere until your message was posted. PySonic was
the only other package I was aware of, but that hasn't been updated
since 2005 and only has installers for windows.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Getting address for Parallel port

2011-05-18 Thread Tony Cappellini

 The hacked up I/O port driver you're using is a huge security risk.

Our test machines are not connected to a network, and we don't ship systems
or software.
The test machines are strictly for use in an engineering testing
environment.

USB drivers have proven to be too flaky. Some work well, some don't. You
never know what you're going to end up with until weeks
into a testing period when a driver hangs the machine.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Getting address for Parallel port

2011-05-17 Thread Tony Cappellini
We are using PCI PCIe Parallel Port plugin cards to control some external
hardware because newer motherboards no longer have built-in parallel ports.
The address is NOT 0x378 as it would be if the parallel port was on the
motherboard.

The OS is Windows XP, SP3.

These plugin cards can get mapped into various address spaces when the
driver loads. In order to  minimize hard-coding these addresses on each
system, I would like to find out if there is a way to get this address via
Pythonwin or Ctypes.

To turn the port on  off, I use this call:

ctypes.windll.inpout32.Out32(parallelPortAddress, onOff) via ctypes,

and this DLL
http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html

Is there a way I can get the address of the parallel port- from Python?

Thanks
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Catching Send To in Office

2011-03-24 Thread Tony Cappellini
When you launch Word and Excel, you can manipulate them via COM and try to
intercept, which is a pain but at least you can
control them from Python. You may be able to intercept SendTo this way.

If you launch Word with your own template file (.dot) it may be possible to
embed a Word macro in the template that helps you to intercept sendTo.


On Thu, Mar 24, 2011 at 6:04 AM, Mike Driscoll
mdrisc...@co.marshall.ia.uswrote:

 Hi Tony,


 On 1:59 PM, Tony Cappellini wrote:



 On 1:59 PM, Tim Roberts wrote:
  Mike Driscoll wrote:
  Does anyone know of a way to catch the Send To Mail Recipient in
  Microsoft Word or Excel? I want to redirect that to our web mail
  somehow.
  Well, let's brainstorm for a moment.  That link fires up the default
  mail provider for your computer, which in found in the registry.
  Theoretically, you ought to be able to rewrite that key to a browser
  command that brings up your webmail page, or to an application that does
  the same thing.  Check HKCU\Software\Clients\Mail or
  HKLM\Software\Clients\Mail.
 

 Mike,

 If I've understood you correctly ...
 Why not just create a new sendto shortcut which points to your
 application,
 and copy it to the SendTo directory?

 I've created custom sendtos before, and it's quite convenient to make
 sendtos for other systems.
 You then just right click and send entire directories across the network
 like this.





 I think I know how to do the Send To right-click stuff now (thanks to the
 guys on this list and on wxPython IRC), the problem is catching the Send To
 inside MS Word, Excel, etc. They are not using the same process. Maybe I
 need to create my own VBA junk in them that does it for me. I'm going to try
 using procmon to try to see what Word is doing. If anyone has any ideas,
 that would be great. Thanks!

 - Mike


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Catching Send To in Office

2011-03-23 Thread Tony Cappellini
Message: 1
Date: Wed, 23 Mar 2011 08:59:52 -0500
From: Mike Driscoll mdrisc...@co.marshall.ia.us
Cc: Python-Win32 List python-win32@python.org
Subject: Re: [python-win32] Catching Send To in Office
Message-ID: 4d89fcd8.5090...@co.marshall.ia.us
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 1:59 PM, Tim Roberts wrote:
 Mike Driscoll wrote:
 Does anyone know of a way to catch the Send To Mail Recipient in
 Microsoft Word or Excel? I want to redirect that to our web mail
 somehow.
 Well, let's brainstorm for a moment.  That link fires up the default
 mail provider for your computer, which in found in the registry.
 Theoretically, you ought to be able to rewrite that key to a browser
 command that brings up your webmail page, or to an application that does
 the same thing.  Check HKCU\Software\Clients\Mail or
 HKLM\Software\Clients\Mail.


Mike,

If I've understood you correctly ...
Why not just create a new sendto shortcut which points to your application,
and copy it to the SendTo directory?

I've created custom sendtos before, and it's quite convenient to make
sendtos for other systems.
You then just right click and send entire directories across the network
like this.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using os.startfile() for automation

2011-02-03 Thread Tony Cappellini
Date: Fri, 4 Feb 2011 10:42:37 +1100
From: Andrew MacIntyre andrew.macint...@acma.gov.au
To: python-win32@python.org
Subject: Re: [python-win32] Using os.startfile() for automation
   [SEC=UNCLASSIFIED]
Message-ID:


Other than COM, application automation on Windows requires Windows API
programming to send the necessary messages to application windows - this
is what AutoIt does.


I believe that people have written Python code to
do this; googling python application automation might give you some
ideas.

Autoit3 exposes some of it's API's via COM, but I'd rather avoid COM.

http://code.google.com/p/robotframework-autoitlibrary/
Python + AutoIt via COM just seems like too many layers, just to invoke the
File  Save As menu.


This looks like its the most mature Python package and is the one I'm trying
to use, but with no success at the moment. At least there have been updates
recently.
http://code.google.com/p/pywinauto/
but the API is bad and the docs are confusing.


This is next inline, and 
http://www.tizmoi.net/watsup/intro.html

There was one other, but googling isn't finding it at the moment, however it
is the project which started the others.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Simple Windows progressbar dialog (like messagebox) via Win32 API?

2010-09-30 Thread Tony Cappellini
Message: 1
Date: Thu, 30 Sep 2010 12:09:16 -0400
From: pyt...@bdurham.com
To: zz Python Win32 Newsgroup python-win32@python.org
Subject: [python-win32] Simple Windows progressbar dialog (like
   messagebox) via Win32 API?
Message-ID: 1285862956.22785.1397713...@webmail.messagingengine.com
Content-Type: text/plain; charset=us-ascii

I know there is a simple interface to the Windows messagebox
interface.

Try Easy Dialogs
http://www.averdevelopment.com/python/EasyDialogs.html
It have a progress bar. Easy Dialogs just wraps the native OS calls,
and makes them sensible  cross platform.

Using a progress bar is only a few lines of code.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Detecting when a system has multiple monitors (desktops)

2010-08-24 Thread Tony Cappellini
Does anyone know how to detect if a system has multiple monitors
(desktops) through Python?

I've written a program which allows the user to open multiple
stand-alone windows.
When I run this program I usually drag these windows to my secondary monitor.

I was to save the screen coordinates of the window locations so they
can be restored.

First, the program must detect the multiple desktops and then
understand if the screen coordinates of those
windows are related to the primary or secondary desktop.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detecting when a system has multiple monitors (desktops)

2010-08-24 Thread Tony Cappellini
Thanks-

but I think Tim's solution is more native and has the added benefit of
not requiring any additional software..
I was thinking too much into the problem.

However, I will keep your reply for future reference. There may be a
time when I need the monitors package.

On Tue, Aug 24, 2010 at 5:21 PM, reckoner recko...@gmail.com wrote:
 Tony:

 All of this is handled in the dragonfly package:

 http://code.google.com/p/dragonfly/

 Note that you do not need speech recognition in order to use it. In
 particular, look at

   from dragonfly import Window, monitors


 and the

 window.py file in the distribution.

 Good luck!



 On 8/24/2010 4:33 PM, Tony Cappellini wrote:

 Does anyone know how to detect if a system has multiple monitors
 (desktops) through Python?

 I've written a program which allows the user to open multiple
 stand-alone windows.
 When I run this program I usually drag these windows to my secondary
 monitor.

 I was to save the screen coordinates of the window locations so they
 can be restored.

 First, the program must detect the multiple desktops and then
 understand if the screen coordinates of those
 windows are related to the primary or secondary desktop.
 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Enable/disable Remote Desktop via Python

2010-05-18 Thread Tony Cappellini
Message: 4
Date: Tue, 18 May 2010 10:19:28 +1000
From: Mark Hammond skippy.hamm...@gmail.com
Cc: Python-Win32 List python-win32@python.org
Subject: Re: [python-win32] Enable/disable Remote Desktop via Python
Message-ID: 4bf1dd10.2020...@gmail.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed



Or even if you do manage to do this without stopping the service and
immediately losing your connection, what happens when the network drops
out etc and you lose your existing connection without the opportunity of
re-enabling future remote connections?
Then I'll walk over to the machine and re-enable it myself.

I've been toggling the checkbox in Control Panel manually ever since I
knew RD existed, and it has never
terminated the connection I was using at the time.Perhaps certain
configurations might cuase that, but I don't know what those would be.

It's just not convenient to not be able to do this with a batchfile, or shortcut
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Enable/disable Remote Desktop via Python

2010-05-17 Thread Tony Cappellini
Message: 2
Date: Sun, 16 May 2010 14:45:30 -0400
From: Steven James steven.ja...@gmail.com
To: python-win32@python.org
Subject: Re: [python-win32] Enable/disable Remote Desktop via Python
Message-ID:
   aanlktilrr3r6touf5fbis9qvm3c2lr_vf2lsguiei...@mail.gmail.com
Content-Type: text/plain; charset=iso-8859-1

http://thebackroomtech.com/2007/05/18/how-to-enable-remote-desktop-on-a-windows-xp-machine-remotely/

That link explains how to do this remotely from a command line and by
modifying a registry entry. I've scripted this with python before but can't
find the code right now.


Thanks

But I need to enable/disable Remote Desktop login on the current
machine, not a remote machine.
I''ll play around with this set service remotedesktop enable
Steven James
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Enable/disable Remote Desktop via Python

2010-05-15 Thread Tony Cappellini
Message: 1
Date: Fri, 14 May 2010 10:07:57 -0700
From: Tim Roberts t...@probo.com
To: Python-Win32 List python-win32@python.org
Subject: Re: [python-win32] Enable/disable Remote Desktop via Python
Message-ID: 4bed836d.50...@probo.com
Content-Type: text/plain; charset=ISO-8859-1

Are you saying that when you are remotely logged into system X, you want
to disable Remote Desktop access to system X?
Yes

Isn't that going to prevent YOU from accessing system X as well?  It's a 
little like sawing
off the tree branch on which you are sitting, isn't it?
No

It doesn't terminate my connection, It just stops other users from
trying to connect remotely
while I'm, connected. Attempts to connect by other users would log me
off with no warning, an
possibly cause a loss of data.

Yes, but FWIW, this is an artificial licensing restriction, not a
technical restriction.
This IS a technical question. It is no different than someone posting
a question like
How do I ??? with Tim's WMI module ?

There is a checkbox in Control Panel to do this microsoft has provided
it for the user.
I want to enable/disable that checkbox via Python, and want to know
how it can be done.

When you run the Remote Desktop Client, there is an option to execute
a program on the
remote machine. This would be the perfect place to do call the program
from, so it would be done automatically.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Enable/disable Remote Desktop via Python

2010-05-13 Thread Tony Cappellini
On WinXP,

under Control Panel/System/Remote - there is a check box to
enable/disable Remote Desktop access.

I need to toggle this- so I don't get disconnected by other users,
when I'm connected to a system remotely.
The desktop version of Windows- still doesn't allow concurrent
multi-user logins in the year 2010.

I'd like to be to write a program to toggle this for me.

Would someone point me to a resource which describes how to do this?

Thanks
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Finding DLL's which are in use (loaded)

2010-04-08 Thread Tony Cappellini
Thanks- but is that attempting to delete a dll? Is there a
less-invasive way of detecting a dll in use?

Is there a way I can find out which application(s) are using the DLL,
so I put that information in a dialog box?

These dlls are general purpose and can be used by many applications
written by people where I work.



On Thu, Apr 8, 2010 at 1:05 AM, niki n...@vintech.bg wrote:
 Tony Cappellini wrote:

 I need to write a program which copies some dlls from one location to
 another. However, if any applications which use these dll's are
 running,
 Windows won't let the dll copy complete, until the apps which have the
 dlls loaded have terminated.
 I'm looking for a way to scan/probe to see if any apps are running
 which have these dll's loaded.
 How would I go about this with Python ?

 test = win32file.CreateFile(f, win32con.DELETE, 0, None,
 win32con.OPEN_EXISTING, 0, None)

 HTH

 Niki

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Win API call to display a BMP/PNG file as a splash screen for a console app?

2010-03-25 Thread Tony Cappellini
Date: Wed, 24 Mar 2010 08:41:16 +0100
 From: Sylvain Fauveau (apli-agipa) i...@apli-agipa.com
 Cc: Python-Win32 List python-win32@python.org
 Subject: Re: [python-win32] Win API call to display a BMP/PNG file as
a   splash screen for a console app?
 Message-ID: 4ba9c21c.8030...@apli-agipa.com
 Content-Type: text/plain; charset=windows-1252; Format=flowed

 Not tested, but :

 Google: splash screen tkinter

 =
 http://code.activestate.com/recipes/534124-elegant-tkinter-splash-screen/

 tkinter is included with python.

Tkinter is include with Python, but I don't believe Tix is included, unless
it was added to a later distribution than I have.
.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Win API call to display a BMP/PNG file as a splash screen for a console app?

2010-03-22 Thread Tony Cappellini
From: pyt...@bdurham.com
To: zz Python Win32 Newsgroup python-win32@python.org
Subject: [python-win32] Win API call to display a BMP/PNG file as a
   splash screen for a console app?
Message-ID: 1269295703.32357.1366163...@webmail.messagingengine.com
Content-Type: text/plain; charset=us-ascii

Is there a Windows API call I can use to display a BMP or a PNG
file in a window centered on a user's display? This function
would be called from a console app to display a splash screen.

I don't know, but I suspect not.
complexity of a full GUI framework like wxPython or pyQT and
To do this in wxPython is approximately 10 lines of code, maybe 20 at the
most.
Actually- the # of lines to do this in wxPython is less than your original
email.


class SketchApp(wx.App):

def OnInit(self):
bmp = wx.Image(splash.png).ConvertToBitmap()
wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
1000, None, -1)
wx.Yield()

frame = SketchFrame(None)
frame.Show(True)
self.SetTopWindow(frame)
return True

if __name__ == '__main__':
app = SketchApp(False)
app.MainLoop()


This is barebones, taken from wxPython In Action- ideally you should have
some minimal exception handling
to make your app more robust.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detect whether a workstation is a laptop or desktop/server?

2010-03-06 Thread Tony Cappellini
Message: 2
Date: Sat, 6 Mar 2010 10:17:43 -0500
From: Steven James steven.ja...@gmail.com
To: python-win32@python.org
Subject: Re: [python-win32] Detect whether a workstation is a laptop
   or  desktop/server?
Message-ID:
   e3c91421003060717o2769876ey82de33b5b7d41...@mail.gmail.com
Content-Type: text/plain; charset=iso-8859-1


A 5400RPM hard drive? These aren't assurances, but
they point to laptops.
Not at all.
Many laptop vendors are already shipping 7200 RPM drives, and many older
desktops can still use 5400 rpm drives.
There's no easy way to query a drive for this, without using the drive mfg's
internal commands. This information is not typically available to the
public.



Well I think that's every way possible of not answering your question. Sorry
=).
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 79, Issue 1

2009-10-01 Thread Tony Cappellini
Message: 3
Date: Wed, 30 Sep 2009 11:56:01 -0700
From: Tim Roberts t...@probo.com
To: Python-Win32 List python-win32@python.org
Subject: Re: [python-win32] Talking to the parallel port
Message-ID: 4ac3a9c1.4000...@probo.com
Content-Type: text/plain; charset=ISO-8859-1


Why would you expect any updates?  The technology behind the parallel
port has not changed since 1994.
It's not about the technology changing.
But people do add improvments to python packages over time, and release
newer/better packages.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Talking to the parallel port

2009-09-30 Thread Tony Cappellini
I'm looking for some way to wiggle the data lines on the parallel port- and
possibly even to use some of them as input lines.

Googling for python parallel port revealed an old project which hasn't been
updated since 2003.

http://pyserial.sourceforge.net/pyparallel.html

Is there anything that is more current?

Thanks


Tony
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python parser for Windows Event Logs

2009-07-17 Thread Tony Cappellini
Message: 3
Date: Thu, 16 Jul 2009 16:08:51 -0700
From: Tim Roberts t...@probo.com
To: python-win32@python.org
Subject: Re: [python-win32] Python parser for Windows Event Logs
Message-ID: 4a5fb303.7010...@probo.com
Content-Type: text/plain; charset=ISO-8859-1

Tony Cappellini wrote:
 I've added the While loop Mark suggested but still see the same issue.
 GetNumberOfEventLogRecords() still returns 6 events,
 However the object returned from ReadEvenLog() still only contains 3 objects
 The next call to ReadeventLog() returns None


OK, in my test, repeated calls to ReadEventLog eventually fetch all of
the events.  Each call to ReadEventLog will return however many events
will fit in 1024 bytes, which is the buffer in the pywin32 code.  If I
change your code to this:

while 1:
   events=win32evtlog.ReadEventLog(hand,flags,0)
   if not events:
   break
   for event in events:
   print event.EventID, event.StringInserts

then it all works as expected.

This is what I'm doing. I have added the while 1 last week, after Mark
had suggested it.
It did not change anything. ReadEventLog() returns None on successive calls.

Which versions of Python and Pywin32 are you using?
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 76, Issue 17

2009-07-17 Thread Tony Cappellini
Message: 2
Date: Thu, 16 Jul 2009 15:57:31 -0700
From: Tim Roberts t...@probo.com
To: Python-Win32 List python-win32@python.org
Subject: Re: [python-win32] Python parser for Windows Event Logs
Message-ID: 4a5fb05b.2060...@probo.com
Content-Type: text/plain; charset=ISO-8859-1

 Would anyone be willing to try parsing their own SystemEvent log to
 see if they have the same issue (or parse min log and see if the
 results are the same) ?


Similar.  I saved one of the application event logs, and although

Tim, would you try parsing the SystemEventLog (from Windows XP)?
This is the one I'm having problems with, not the application log.

There are other complications with Vista Logs, that i don't even want
to get involved with.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python parser for Windows Event Logs

2009-07-17 Thread Tony Cappellini
Ok- I've figured out the problem.

 After Mark suggested doing the call to ReadEventLog() inside of the while loop,
 I had accidentally left a call to ReadEventLog() outside of the loop.
 So the data coming back from that was just thrown away.

 The reason I didn't see that call is because all of the lines before and after
 it were commented out- and I guess my eyes looked that line looked the same.


Problem solved!
(operator error)
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python parser for Windows Event Logs

2009-07-16 Thread Tony Cappellini
I've added the While loop Mark suggested but still see the same issue.
GetNumberOfEventLogRecords() still returns 6 events,
However the object returned from ReadEvenLog() still only contains 3 objects
The next call to ReadeventLog() returns None


flags = win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
events = win32evtlog.ReadEventLog(hand, flags, 0)
 events
[PyEventLogRecord object at 0x00C5C998, PyEventLogRecord object at
0x00C5C9E0, PyEventLogRecord object at 0x00C5CA28]

Would anyone be willing to try parsing their own SystemEvent log to
see if they have the same issue (or parse min log and see if the
results are the same) ?


On 7/11/09, Mark Hammond skippy.hamm...@gmail.com wrote:
 Check out the ReadEventLog code in win32evtlogutil.py - you will notice you
 need a loop like:

 while 1:
 objects = win32evtlog.ReadEventLog(h, readFlags, 0)
 if not objects:
 break

  Mark
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python parser for Windows Event Logs

2009-07-13 Thread Tony Cappellini
That didn't really change anything.

GetNumberOfEventLogRecords() tells me there are 6 events,

However the object returned from ReadEvenLog() still only contains 3 objects

flags = win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
events = win32evtlog.ReadEventLog(hand, flags, 0)
 events
[PyEventLogRecord object at 0x00C5C998, PyEventLogRecord object at
0x00C5C9E0, PyEventLogRecord object at 0x00C5CA28]

The next call to ReadeventLog() returns None



On 7/11/09, Mark Hammond skippy.hamm...@gmail.com wrote:
 Check out the ReadEventLog code in win32evtlogutil.py - you will notice you
 need a loop like:

 while 1:
 objects = win32evtlog.ReadEventLog(h, readFlags, 0)
 if not objects:
 break

  Mark


  On 11/07/2009 1:38 PM, Tony Cappellini wrote:

 
  Ok, I'm able to parse Event51 logs now.
 
  However, there seems to be a problem with the  object returned from
  ReadEventLogs()
 
  GetNumberOfEvents() tells me there are 6 events.
 
  I can see all sixe events using the EventViewer in Control Panle, on
 Widnwos XP.
 
  However, the iterator returned from RedEvent Log() is consumned after
  only 3 events.
 
 
 hand=win32evtlog.OpenBackupEventLog(None,logFilename)
 
 numEvents=win32evtlog.GetNumberOfEventLogRecords(hand)
  print'\n\t%lu events were found' % numEvents
  flags =
 win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
  events=win32evtlog.ReadEventLog(hand,flags,0)
 
  for ev_obj in events:
   #stops iterating after only 3 events
 
  Would someone verify this?
 
  I see this problem on Python 2.3 and 2.5.4, with Pywin32 Build 213
 
 
  Thanks
 
  Tony
  ___
  python-win32 mailing list
  python-win32@python.org
  http://mail.python.org/mailman/listinfo/python-win32
 


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python parser for Windows Event Logs

2009-07-11 Thread Tony Cappellini
I'll give that a try.

I was using this for my reference
http://timgolden.me.uk/pywin32-docs/Windows_NT_Eventlog.html


On 7/11/09, Mark Hammond skippy.hamm...@gmail.com wrote:
 Check out the ReadEventLog code in win32evtlogutil.py - you will notice you
 need a loop like:

 while 1:
 objects = win32evtlog.ReadEventLog(h, readFlags, 0)
 if not objects:
 break

  Mark


  On 11/07/2009 1:38 PM, Tony Cappellini wrote:

 
  Ok, I'm able to parse Event51 logs now.
 
  However, there seems to be a problem with the  object returned from
  ReadEventLogs()
 
  GetNumberOfEvents() tells me there are 6 events.
 
  I can see all sixe events using the EventViewer in Control Panle, on
 Widnwos XP.
 
  However, the iterator returned from RedEvent Log() is consumned after
  only 3 events.
 
 
 hand=win32evtlog.OpenBackupEventLog(None,logFilename)
 
 numEvents=win32evtlog.GetNumberOfEventLogRecords(hand)
  print'\n\t%lu events were found' % numEvents
  flags =
 win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
  events=win32evtlog.ReadEventLog(hand,flags,0)
 
  for ev_obj in events:
   #stops iterating after only 3 events
 
  Would someone verify this?
 
  I see this problem on Python 2.3 and 2.5.4, with Pywin32 Build 213
 
 
  Thanks
 
  Tony
  ___
  python-win32 mailing list
  python-win32@python.org
  http://mail.python.org/mailman/listinfo/python-win32
 


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 76, Issue 13

2009-07-10 Thread Tony Cappellini
  Message: 1
  Date: Thu, 09 Jul 2009 22:20:56 +0100
  From: Tim Golden m...@timgolden.me.uk
  Cc: python-win32@python.org
  Subject: Re: [python-win32] Python parser for Windows Event Logs
  Message-ID: 4a565f38.40...@timgolden.me.uk
  Content-Type: text/plain; charset=UTF-8; format=flowed


  Let me know if you need help getting the data out in
  the first place; I'm not clear whether you've got that
  covered or not. (And whether you want to be notified
  when the event fires or whether you're merely scanning
  historically).

I can get the data with the struct module, but would prefer your
wrapper if possible.

The systems which I am testing do not have network connections, so I
have to save the
system logs manually to a USB drive and copy them to my development system.

Is there a way with winsys to open a logfile, WITHOUT having to pass a
system name as the first argument? I don't want to process the system
log of my development system, I want to process a system log that I've
copied from the test system. That logfile is in some arbitrary
directory, on my development system.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python parser for Windows Event Logs

2009-07-10 Thread Tony Cappellini
Ok, I'm able to parse Event51 logs now.

However, there seems to be a problem with the  object returned from
ReadEventLogs()

GetNumberOfEvents() tells me there are 6 events.

I can see all sixe events using the EventViewer in Control Panle, on Widnwos XP.

However, the iterator returned from RedEvent Log() is consumned after
only 3 events.

hand=win32evtlog.OpenBackupEventLog(None,logFilename)
numEvents=win32evtlog.GetNumberOfEventLogRecords(hand)
print'\n\t%lu events were found' % numEvents
flags = 
win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
events=win32evtlog.ReadEventLog(hand,flags,0)

for ev_obj in events:
 #stops iterating after only 3 events

Would someone verify this?

I see this problem on Python 2.3 and 2.5.4, with Pywin32 Build 213


Thanks

Tony
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Python parser for Windows Event Logs

2009-07-09 Thread Tony Cappellini
Does anyone know if there is a Python module which will parse Windows
Event Logs?
Using the EventViewer is tedious, and I'd rather be abel to do this
programmatically.


Thanks
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python parser for Windows Event Logs

2009-07-09 Thread Tony Cappellini
Thanks, but those just monitor events.

I need to pull some very specific data from an event log file, after I
know the event has already occurred.

Tim has another module called winsys, and there is an object which
handles some aspects of reading event logs.
http://timgolden.me.uk/python/winsys/event_logs.html#module-event_logs

Tim - what I need to is pull this structure
http://msdn.microsoft.com/en-us/library/ms810313.aspx

from the event log, AFTER an event 51 has already occurred.
http://support.microsoft.com/kb/244780

I can easily look at the Event Viewer to determine if the event has occurred.

I don't see it at a glance, but does your winsys module have a way to do this?

If not, I'll just have to hard code offsets and use the struct module to get it.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] FIle I/O on Windows XP

2009-06-14 Thread Tony Cappellini
I was trying to see if I could speed up processing huge files (in the
10's of Gigabytes)
by passing various values to the readline() method of the file object.

No matter what I passed to readline() each call was slower and slower
than passing no argument at all.

I've used a SATA bus analyzer to see what kind of block sizes WIndows
was using for the reads, and typically for non-AHCI reads, the block
sizes were surpsingly small. 8 blocks were typical.

It's somewhat difficult to separate I/O traffic that windows is
routinely doing even when you're not reading a specific file, so
putting the file on a secondary drive will eliminate most of that
traffic.

Can anyone explain why passing any non-negative values  0 to
readline() makes the file processing slower instead of faster?
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Fwd: Phyton editor

2009-06-03 Thread Tony Cappellini
Message: 4
Date: Wed, 3 Jun 2009 18:57:51 -0400
From: Steven James steven.ja...@gmail.com
To: python-win32@python.org
Subject: [python-win32] Fwd:  Phyton editor
Message-ID:
   e3c91420906031557i75f3fa91w4fb3ffe9f3e2e...@mail.gmail.com
Content-Type: text/plain; charset=iso-8859-1

I like SPE and Wing. Wing isn't free though.
http://pythonide.blogspot.com/
http://www.wingware.com/

There is a free basic version of Wing, but why bother?
Buy the Pro version, get a great debugger/IDE. It's worth every penny.
You don't use Wing for its editing abilities, you use it because it
has great debugging features.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Silent installation of pywin32

2009-05-10 Thread Tony Cappellini
Message: 2
Date: Fri, 08 May 2009 11:42:33 -0700
From: Tim Roberts t...@probo.com
Subject: Re: [python-win32] Silent installation of pywin32
To: Python-Win32 List python-win32@python.org
Message-ID: 4a047d19.7080...@probo.com
Content-Type: text/plain; charset=ISO-8859-1

Tools like py2exe will automatically pull in whatever pieces of pywin32
are
necessary to make your script run.
Py2exe tries to pull in everything automatically, but doesn't always succeed
Recently, I had to manually include a dll it wasn't finding- but that's not
the first time
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Programatically activating secondary monitor?

2009-04-30 Thread Tony Cappellini
Message: 1
Date: Thu, 30 Apr 2009 08:49:58 +0100
From: Tim Golden m...@timgolden.me.uk
Subject: Re: [python-win32] Programatically activating secondary
   monitor?
Cc: python-win python-win32@python.org

One can enable/disable a mutli-head monitor by right clicking on the desktop
and selecting the Settings Tab.
Of course, you need to have a multi-head video card and driver installed
first. but there are times when you want to disable the second
montior/desktop.

When you connect to a system via Remote Desktop which has both
monitors/desktops enabled, you cannot access the applications that are
displayed on the secondary monitor. This is extremely irritating. If you
close those applications and re-open them, they automatically re-ope on the
secondary display. The only way to prevent this is to disable the secondary
video card,and re-open the monitor on the primary display.

Some very old applications (Lotus Notes for example) which happen to be
running on the scondary display, cannot be dragged back to the primary
display.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Specifying an initial directory name for win32ui.CreateFileDialog()

2009-03-30 Thread Tony Cappellini
I want to specify the directory in which win32ui
win32ui.html.CreateFileDialog()
should be displayed.
The arguments in the help PyCFileDialog PyCFileDialog.html = *
CreateFileDialog(bFileOpen, defExt , fileName , flags , filter , parent *)
don't seem to allow this.

I know I can specify the initial  director (among other things) when I
invoke the File Open browser from wxPython and other gui frameworks.

How do I do this with the bare bones Win32 api?


Thanks
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-30 Thread Tony Cappellini
Tim

While monitoring The task manager/Performance Tab

It seems as though Windows XP is almost always paging, even when all of
available memory
is not being used.

This doesn't make sense and seems to be wasteful. Why should the OS be
wasting time paging, when it doesn't need to (aka when all of available
physical ram has not been used)?


 I would caution you not to draw any conclusions based on the physical
 numbers.  You WANT your system to be using all of its physical memory.
 Unused physical memory is just wasted money.  The operating system will
 page things in and out as needed, on a demand basis, to make sure that
 pages you are really USING stay in memory.  The other pages will be used
 by DLLs, other processes, and disk caching.  Also remember that, if the
 page file gets low, the system will allocate more.

 --
 Tim Roberts, t...@probo.com
 Providenza  Boekelheide, Inc.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] rebooting windows from Python

2008-12-05 Thread Tony Cappellini
  To me the bigger criticism is that there are probably 600 other programs 
 that do the same  thing, but what fun would it be for me to use someone 
 else's program...

got it.

 I'll take a look at your program.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Does Python need a native Windows GUI toolkit?

2008-12-01 Thread Tony Cappellini
Back to this thread - has anybody used the new pythoncard stuff?

What do you mean by the new pythoncard stuff ?
Pythoncard has been around for a long time.

I've used it- and it's one of the reasons I now use wxPython directly,
without any wrappers.
(I didn't like Boa - but it's been a long time since I've tried it)
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Does Python need a native Windows GUI toolkit?

2008-11-29 Thread Tony Cappellini
First, I feel that Python already has too many GUI toolkits available, and
could stand to use some consolidation.

I started writing python GUI apps with pyQT,then moved to Pythoncard, and
now I use wxPython directly without looking back. I feel that there needs to
be much more of a separation between the C++ code and Python than pyQT
provides, and I don't feel the C++ influence when I use wxPython, even
though wxWidgets is written in C++ and interfaced with SWIG. I think adding
a wrapper just adds more complexity, and there are already several
intermediate layers  form builders for wx in an attempt to make it
easier.
Now that Nokia is behind QT it would be interesting to see follow its
evolution.

I think ones efforts could be better spent working on wx directly, or
helping Mark Hammond with Python W32 itself. I've never used MFC, so I can't
make the comparison myself, but I've heard Thomas' statement how wx is
similar to MFC, from another source.

Here are an outdated comparison of some attempts to make wx easier to use.
http://wiki.codeblocks.org/index.php?title=Comparison_of_wxSmith_features.

Pythoncard is not listed in the chart above, and that chart is not really a
comparison of intermediate layers.
Pythoncard is still popular and could probably stand to be improved.

With some time, struggling, and cursing, I have now written a few wx apps
from scratch, even using sizers. While I can't do it second nature yet, I
don't  see myself looking
at another intermediate layer. wx has come a long way, the documentation is
getting much better, and the wxPython list is a great resource for solving
problems. Quite a few people have written some new wx components too, but
they are not part of the standard distribution. I feel the Python community
would benefit much better by not competing with something that has this much
momentum (aka developing a native  Windows GUI).

I actually would rather see new any new GUI-related development efforts
going into a community-standardized RAD IDE (aka Delphi-like) environment,
as opposed to a seeing a new toolkit/framework come into existence. I have
been hoping a company like Microsoft or Google would get behind this effort,
more Google than Microsoft.
Since I am an advocate for wx, I would really prefer company-backed
resources put into a completed Delphi-like IDE for wxPython.


I applaud your efforts Thomas whatever the outcome. I know they will benefit
the Python community.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] interprocess communication python and visual basic can it be done?

2008-08-27 Thread Tony Cappellini
I see many prices less than $50 on Amazon, and the publisher is still
selling it for $34.95.
There are 100's of used book services available as well.


On Wed, Aug 27, 2008 at 11:42 AM, Vernon Cole [EMAIL PROTECTED] wrote:



 Why? It's still being published
 http://oreilly.com/catalog/9781565926219/index.html


 Amazon still has them in stock too

 http://www.amazon.com/Python-Programming-Win32-Windows-Programmers/dp/1565926218/ref=sr_1_2?ie=UTF8s=booksqid=1219813190sr=8-2

 Amazon's price is $159 for a new copy.  My copy has $34.95 printed on the
 cover as the price.  On MY budget, $159 is hard to get for book which is
 eight years out of date. (But still the best published source on the
 subject.)


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] interprocess communication python and visual basic can it be done?

2008-08-26 Thread Tony Cappellini

 Message: 2
 Date: Tue, 26 Aug 2008 11:07:56 -0600
 From: Vernon Cole [EMAIL PROTECTED]
 Subject: Re: [python-win32] interprocess communication python and
visual  basic can it be done?
 To: Emanuel Sotelo [EMAIL PROTECTED]
 Cc: python-win32@python.org
 Message-ID:
[EMAIL PROTECTED]
 Content-Type: text/plain; charset=iso-8859-1

 Emanuel:
 Best answer: Find a copy of  *Python Programming On Win32*  by Mark Hammond
 and Andy Robinson and read chapter 7. Unfortunately, copies of the book are
 getting quite hard to get.


Why? It's still being published
http://oreilly.com/catalog/9781565926219/index.html

Amazon still has them in stock too
http://www.amazon.com/Python-Programming-Win32-Windows-Programmers/dp/1565926218/ref=sr_1_2?ie=UTF8s=booksqid=1219813190sr=8-2
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Excel Document

2008-07-25 Thread Tony Cappellini
Message: 1
Date: Fri, 25 Jul 2008 12:52:04 +0200
From: Michiel Overtoom [EMAIL PROTECTED]
Subject: Re: [python-win32] Excel Document
To: python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

Sina wrote...

To read the contents of an excel spreadsheet. In one case I am trying to
read the value of the cell rather than its contents. i.e. if I have a
hyperlink called Document or Procedure which is a hyperlink to
http://intranet/foo.pdf then this script will return Document or Link as
a unicode string rather than the URL that I require.


If you want to read/write a spreadsheet you can also do this on a
system that does not have Excel installed,
and does not  need a COM interface. However, there are some
limitations with this library, but for reading
numbers and text, it has been working well for me.

http://sourceforge.net/projects/pyexcelerator
http://www.lexicon.net/sjmachin/xlrd.htm
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] How Do You Make Your Speech or SAPI 5 Voices

2008-06-26 Thread Tony Cappellini
 Message: 1
Date: Thu, 26 Jun 2008 08:01:21 -0400
From: FT [EMAIL PROTECTED]
Subject: [python-win32] How Do You Make Your Speech or SAPI 5 Voices
   Portable?
To: python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

This doesn't address your portability issue, but is provided as an FYI.
Peter Parente already has a nice Python wrapper from the Microsoft Speech
API- PyTTS
http://sourceforge.net/project/showfiles.php?group_id=65529package_id=74248
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] using the wave module for reading wave files

2008-05-20 Thread Tony Cappellini
In the wave module, is the term frame synonymous with sample?
That is, does the method wave.readframes(1) read a sample that is
getsampwidth() bits wide, where each sample was sampled at the frequency
found at wave.getframerate() ?
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Volume Serial Number

2008-05-16 Thread Tony Cappellini
That's not the serial number of the drive- as assigned by the drive
manufacturer.

If you want the SN from the drive manufacturer, you will need to issue an
IOCTL ATA Passthrough command which sends the  ATA Identify Device command
to the drive. Unless the Winapi has a wrapper for that functionality, you
can't do that via Python.

You would have to install the Windows SDK to compile a tiny program to issue
the Identify Device command and pull out the SN from the data coming back,
which is only 512 bytes.

This would have to be written in C. It's not difficult to do and the program
would only require less than100 lines of C code.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Volume Serial Number

2008-05-16 Thread Tony Cappellini
Message: 5
 Date: Fri, 16 May 2008 10:35:45 -0500
 From: Rickey, Kyle W [EMAIL PROTECTED]
 Subject: [python-win32] Volume Serial Number
 To: python-win32@python.org
 Message-ID:
[EMAIL PROTECTED]
 
 Content-Type: text/plain; charset=us-ascii

 How do I get the volume serial number for a drive? For example in the
 cmd prompt issuing this:

 It looks like Tim Golden has a way to do what you want- via Python!
http://tgolden.sc.sabren.com/python/win32_how_do_i/see_if_two_files_are_the_same_file.html
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Volume Serial Number

2008-05-16 Thread Tony Cappellini
Tim Golden has a way to do just about everything, but this particular
snippet has nothing to do with the original question.

def get_unique_id (hFile):
  (
attributes,
created_at, accessed_at, written_at,
volume,
file_hi, file_lo,
n_links,
index_hi, index_lo
  ) = win32file.GetFileInformationByHandle (hFile)
  return volume, index_hi, index_lo


The link I posted certainly has a misleading name, but the code above
(from that link) returns the volume SN.
Is the fifth item returned from
GetFileInformationByHandle() not the Volume SN?

[0] *int* : dwFileAttributes
[1] *PyTime PyTime.html* : ftCreationTime
[2] *PyTime PyTime.html* : ftLastAccessTime
[3] *PyTime PyTime.html* : ftLastWriteTime
[4] *int* : dwVolumeSerialNumber
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Size of directory

2008-04-22 Thread Tony Cappellini
When I right click on a directory with windows Explorer, a window is
displayed showing

Size:
Size On Disk:
Contains:
Created:
Attributes:
(with the appropriate values for each entry)


How do I get the same information via Python ?

I've looked at os.stat but

os.stat(r'C:\temp')[os.path.stat.ST_SIZE]

only returns the size of a plain file :(


It's really a shame that windows doesn't have a built-in tool to show you a
tree of subdirectories, and how much space is occupied by each subdirectory.

I guess I need to roll my own- once I know what the underlying call is to
get the size of each directory
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Iron Python and Visual Basic 2005 (or 2008) Express

2008-03-05 Thread Tony Cappellini
Here's what's left of the marriage of Python  Delphi
http://www.atug.com/andypatterns/pythonDelphiTalk.htm
http://mmm-experts.com/Products.aspx?ProductId=3

Note- this was around for many years- so may not be compatible with
current versions of Delphi.
I think I first read about this around Delphi 45 days, but i'm not sure.

There was some attempt to get C++ Builder working with Python, but it
wasn't as successful ;(
(we really need Borland-like RAD (wysiwig) IDE for Python.I'd gladly
pay what Delphi costs for one.)
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Executing eval function in VBscript

2008-02-04 Thread Tony Cappellini
I tried the same - after seeing a post regarding calling Python from
an Excel sheet.
It seems some people have done this, as it is posted on several
different websties.
However, I'm getting an error on this line
   sc.Language = python

A script engine for the specified language can not be created

I've tried adding the MSscript control to the references in Excel, but
I still get the same error message




Date: Mon, 4 Feb 2008 15:42:05 +0530
From: Janakiraman Mohanakrishnan [EMAIL PROTECTED]
Subject: [python-win32] Executing eval function in VBscript
To: python-win32@python.org
Message-ID:
   [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

Hi all,
   I have been trying to execute python library functions VBscript,

   Public sc As New MSScriptControl.ScriptControl

   sc.Language = python
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Executing eval function in VBscript

2008-02-04 Thread Tony Cappellini
Date: Mon, 04 Feb 2008 10:05:11 -0500
From: bob gailer [EMAIL PROTECTED]
Subject: Re: [python-win32] Executing eval function in VBscript
To: Janakiraman Mohanakrishnan [EMAIL PROTECTED]
Cc: python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

That's hard to answer until we know what you want to accomplish! Tell us
more. What problem are you trying to solve?

I think he wants to have python functionality from excel, which is
what I'd like to accomplish as well.
(Python embedded into excel, as opposed to launching Excel from Python)



Also I'm not very familiar with MSScriptControl. I googled it and found
no useful documentation. Do you have any references to it?
Everything you want to know about the MSScriptControl is on microsoft's site.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Executing eval function in VBscript

2008-02-04 Thread Tony Cappellini
I may have a type in my previous posts.
I have only used it with VB6 (not .NET)

http://msdn2.microsoft.com/en-us/library/aa227400.aspx

On Feb 4, 2008 6:30 PM, bob gailer [EMAIL PROTECTED] wrote:

 Tony Cappellini wrote:
  Date: Mon, 04 Feb 2008 10:05:11 -0500
  From: bob gailer [EMAIL PROTECTED]
  Subject: Re: [python-win32] Executing eval function in VBscript
  To: Janakiraman Mohanakrishnan [EMAIL PROTECTED]
  Cc: python-win32@python.org
  Message-ID: [EMAIL PROTECTED]
  Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 
  That's hard to answer until we know what you want to accomplish! Tell us
  more. What problem are you trying to solve?
 
 
  I think he wants to have python functionality from excel, which is
  what I'd like to accomplish as well.
  (Python embedded into excel, as opposed to launching Excel from Python)
 
 
 
 
  Also I'm not very familiar with MSScriptControl. I googled it and found
  no useful documentation. Do you have any references to it?
 
  Everything you want to know about the MSScriptControl is on microsoft's 
  site.
 
 I'm glad it is there. I certainly can't find it. I have searched
 microsoft.com and msdn.microsoft.com with no success. All I find are
 forum discussions; no reference. I guess your mileage is better. Can you
 offer any useful links?

 Bob Gailer
 919-636-4239 Chapel Hill, NC


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Executing eval function in VBscript

2008-02-04 Thread Tony Cappellini
http://msdn2.microsoft.com/en-us/library/aa227633(VS.60).aspx


On Feb 4, 2008 6:30 PM, bob gailer [EMAIL PROTECTED] wrote:

 Tony Cappellini wrote:
  Date: Mon, 04 Feb 2008 10:05:11 -0500
  From: bob gailer [EMAIL PROTECTED]
  Subject: Re: [python-win32] Executing eval function in VBscript
  To: Janakiraman Mohanakrishnan [EMAIL PROTECTED]
  Cc: python-win32@python.org
  Message-ID: [EMAIL PROTECTED]
  Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 
  That's hard to answer until we know what you want to accomplish! Tell us
  more. What problem are you trying to solve?
 
 
  I think he wants to have python functionality from excel, which is
  what I'd like to accomplish as well.
  (Python embedded into excel, as opposed to launching Excel from Python)
 
 
 
 
  Also I'm not very familiar with MSScriptControl. I googled it and found
  no useful documentation. Do you have any references to it?
 
  Everything you want to know about the MSScriptControl is on microsoft's 
  site.
 
 I'm glad it is there. I certainly can't find it. I have searched
 microsoft.com and msdn.microsoft.com with no success. All I find are
 forum discussions; no reference. I guess your mileage is better. Can you
 offer any useful links?

 Bob Gailer
 919-636-4239 Chapel Hill, NC


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Reading .py or .pyc from an excel sheet

2008-01-31 Thread Tony Cappellini
Why not just format the entire column as string data, before calling Python?
That's just requires a few menu clicks, then pass that column to Python.

Another option is to use a Python library called xlrd, which reads
Excel (.XLS) files from Python.
This way you can avoid using COM and the need to have Excel on the
machine where you are reading the file.
There are some limits to what you can do with the library, but for
just pulling in data, it should be ok.

Your Python script can check the data type of each cell as you are
iterating over the cells.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Check if user has windows administrator

2008-01-14 Thread Tony Cappellini
Follow-up question.

Why does type-ahead in PythonWin not show more functions after ctypes.windll. ?

Is this because of late-binding???

Message: 3
Date: Mon, 14 Jan 2008 21:29:39 +0200
From: Graeme Glass [EMAIL PROTECTED]
Subject: Re: [python-win32] Check if user has windows administrator
   privilege
To: Patrick Li [EMAIL PROTECTED]
Cc: python-win32@python.org
On Jan 14, 2008 8:55 PM, Patrick Li [EMAIL PROTECTED] wrote:

import ctypes
print ctypes.windll.shell32.IsUserAnAdmin()

(Courtesy of Thomas Heller - from a posting back in 2006)

I have no idea if it will work on Vista. You will need to try it.

hth,
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 58, Issue 4

2008-01-06 Thread Tony Cappellini
Rename the main script in your python application so it's extension is .pyw

Replace the word console in the  py2exe setup.py file, to windows


Message: 3
Date: Fri, 4 Jan 2008 17:43:40 -0100
From: Jo?o Abrantes [EMAIL PROTECTED]
Subject: [python-win32] Starting a .exe py2exe program in background
   mode.
To: python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

Hello everyone.
I have made a python program and converted into an executable using
py2exe. Now I want him to start on windows startup without showing the
DOS Window... I have registered the program on windows startup
registry key:
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 57, Issue 14

2007-12-12 Thread Tony Cappellini
Message: 4
Date: Wed, 12 Dec 2007 21:41:15 +0100
From: Sebastian Friebe [EMAIL PROTECTED]
Subject: Re: [python-win32] USB access using win32file.deviceIOcontrol
To: Python-Win32 List python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

Tim Roberts wrote:
TR That's fundamentally correct.  How are you creating the
TR SCSI_PASS_THROUGH structure in byte_list?  Are you sure it is 42
TR bytes?  Are you setting all the fields correctly?  How are you setting
TR the DataBuffer pointer?  Have you set the Length field correctly?

Don't forget the data direction variable. That's equally as important.
You'll light up your screen blue as the day, if you get
a driver which isn't robust.

Test unit read does not transfer any data so the data transfer length
should be zero, in the CDB and the data direction must variable must
be set to whatever indicates no data transfer.

cdbLength = 16
I would think the CDB should be set to 6, since test unit ready is a
6-buye command, but if 16 worked in your C++ example, tha should be
fine here too.

But I don't have an idea at all, how to port it to Python.
Tim mentioned the struct module, and I would agree, but there may be other ways.


 class SCSI_PASS_THROUGH_DIRECT(object):
But again, I don't know how to handle the buffer pointers inside the
structure.
Nor do  I. You may have to call a DLL from Python to pass a pointer to
the SCSI pass thru layer.

There may be a way to do this with ctypes though.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] USB access using win32file.deviceIOcontrol

2007-12-12 Thread Tony Cappellini
I recently wrote some C code to send SATA commands to a system drive,
using the ATA pass through layer.

I found this news group very helpful, since it deals with drivers.
http://groups.google.com/group/microsoft.public.windowsxp.device_driver.dev/topics

I wouldn't mentioned Python on that newsgroup though. If you post any
questions, pretend your doing it from C.
You may not get any help if you say you're trying to do it from Python. ;-)

Also- you should try to write the C or C++ code to actually send the
command first, until you get the mechanism down,
then use ctypes or a C DLL to be called from Python.

Also, stick with the Test Unit Ready command or any other command that
doesn't transfer data.

It will be easier to work out the mechanism that way. When you start
transferring data, drivers like the buffers to be aligned to some
specific boundary. Rather than get hung up on data transfer now, you
can deal with that later once you understand how to get a simple
command across.



Message: 4
Date: Wed, 12 Dec 2007 21:41:15 +0100
From: Sebastian Friebe [EMAIL PROTECTED]
Subject: Re: [python-win32] USB access using win32file.deviceIOcontrol
To: Python-Win32 List python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

 class SCSI_PASS_THROUGH_DIRECT(object):
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detect when the user launches or closes a

2007-11-20 Thread Tony Cappellini
Patrick,


See if this helps.
http://www.mindtrove.info/articles/pyhook.html

I think it's somewhat similar to Tim Robert's suggestion, just
packaged differently.

I haven't tried it myself- so let us know how it works for your situation.


Message: 7
Date: Mon, 19 Nov 2007 15:15:33 -0800
From: Patrick Li [EMAIL PROTECTED]
Subject: [python-win32] Detect when the user launches or closes a
   program?

Hi,

I am trying to write a program that will perform some operation on the
user's computer when the user launches a particular executable(s) on the
computer and when the user closes them.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 54, Issue 14

2007-09-23 Thread Tony Cappellini
Take a look at SWIG and BOOST.

Message: 1
Date: Sun, 23 Sep 2007 09:23:54 +0200
From: Aviel, Gal [EMAIL PROTECTED]
Subject: Re: [python-win32] Python COM Server, C++ Client - How ???
To: Ryan Ginstrom [EMAIL PROTECTED],
   python-win32@python.org
Message-ID:
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Having multiple versions of PythonWin installed concurrently

2007-08-09 Thread Tony Cappellini
I'm using Python2.5  PythonWin build210 for my main development.

I need to install a package that only runs under Python2.4, and I'd
like to have a corresponding version of PythonWin for 2.4 installed as
well.

Switching between Python2.4  2.5 is easy enough to deal with using
Python environment variables, and I would suspect the same for a
version of PythonWin for 2.4- but I just want to see if there are any
potential problems with having multiple versions of PythonWin
installed concurrently.


thanks
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python-win32 Digest, Vol 50, Issue 5

2007-05-03 Thread Tony Cappellini
When your program starts, take a snapshot of all the storage devices.
You can do this with a timer, every few seconds or so.

If the new snapshot changes from the original, you can call an API to
see if the new device is removable or not. This won't tell you if it's
a USB drive specifically, but for your situation, it may be highly
unlikely people would be connecting additionally floppy drives or
other removable devices.

You could also parse the output of a program called PCI32.exe and
check for new USB devices. PCI32 is free, produces text output only,
and can be called every few seconds (or whatever interval you feel is
appropriate)



Message: 1
Date: Thu, 3 May 2007 08:56:04 +0300
From: Simon Dahlbacka [EMAIL PROTECTED]
Subject: Re: [python-win32] Help needed : FindWindowEx
To: Amit Arora [EMAIL PROTECTED]
Cc: Roger Upole [EMAIL PROTECTED], python-win32@python.org
Message-ID:
   [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

On 5/3/07, Amit Arora [EMAIL PROTECTED] wrote:

  Exact Requirement :
 Need to write a Python script that keeps on running and when a USB device
 is plugged in , it detects the device and flashes a message on the propt or
 logs it to a file
 do suggest your ideas on this 
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] How to use IExtractImage in python

2007-04-19 Thread Tony Cappellini
Steven

Would it be possible to launch AutoCad, then use Python/PIL to do
screenshots of the images?

Message: 1
Date: Wed, 18 Apr 2007 09:15:29 -0400
From: Steven James [EMAIL PROTECTED]
Subject: [python-win32] How to use IExtractImage in python
To: python-win32@python.org
Message-ID:
   [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

I am attempting to add a simple thumbnail preview in a wxpython app I'm
putting together. IExtractImage seems to be the way to access the thumbnails
that Windows Explorer uses.

(I can't use PIL or similar because I'm previewing AutoCAD .dwg files).

I am adapting some Delphi COM code (from
herehttp://www.delphi3000.com/articles/article_3806.asp?SK=)
as follows--i've removed the Malloc and other unnecessary statements:
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Release notes for Build 210

2007-03-19 Thread Tony Cappellini
I'm trying to find the release notes (bug fixes plus new features) for
Build 210.
http://sourceforge.net/project/showfiles.php?group_id=78018

but don't see these in the PyWin32 project in sourceforge.

Are these available online, or does one have to download and install
Build 210 to get the release notes?
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Release notes for Build 210

2007-03-19 Thread Tony Cappellini
For some reason my notes icon is not clickable.
It's likely to be another problem with FireFox (on my end) though.

On 3/19/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 H.  They are visible for me.  What do you see when you click on
 the Notes icon adjacent to the Monitor icon?

 -- jv

 - Original Message -
 From: Tony Cappellini [EMAIL PROTECTED]
 Date: Monday, March 19, 2007 1:12 pm
 Subject: [python-win32] Release notes for Build 210

  I'm trying to find the release notes (bug fixes plus new features)
 for
  Build 210.
  http://sourceforge.net/project/showfiles.php?group_id=78018
 
  but don't see these in the PyWin32 project in sourceforge.
 
  Are these available online, or does one have to download and install
  Build 210 to get the release notes?
  ___
  Python-win32 mailing list
  Python-win32@python.org
  http://mail.python.org/mailman/listinfo/python-win32
 

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] How to detect User presseing escape, or clicking cancel in call to win32gui.GetOpenFileNameW()

2007-03-14 Thread Tony Cappellini
I'm trying to understand how to detect a user pressing Escape, or
clicking on Cancel when
win32gui.GetOpenFileNameW() is called.

When I press escape when the FileOpen dialogue is present, I see the
following error with Python2.5/PWin32 Build 210

error: (0, 'GetOpenFileNameW', 'No error message is available')

Would someone explain what this means, or how to detect the above situatiions?
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] win32con

2007-03-14 Thread Tony Cappellini
Is it an oversight that the win32con constants are not listed in the
PythonWin help?
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Can't post to the list- who is the admin?

2007-03-13 Thread Tony Cappellini
I've been trying to post messages for a few days now- I keep getting
replies telling me my messages are being held.

I've verified that I am subscribed with this address, and I did not
post the messages to the sub/ubsub  address.

Who is the admin?

thanks
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] How to detect User pressing escape, or clicking cancel in call to win32gui.GetOpenFileNameW()

2007-03-13 Thread Tony Cappellini
I'm trying to understand how to detect a user pressing Escape, or
clicking on Cancel when win32gui.GetOpenFileNameW() is called.

When I press escape when the FileOpen dialogue is present, I see the
following error with Python2.5/PWin32 Build 210

error: (0, 'GetOpenFileNameW', 'No error message is available')

Would someone explain what this means, or how to detect the above situations?

My call looks like this


filter='Patches'
customfilter='All Files'
unicodeFilenames=None
unicodeFilenames, customfilter, flags =
win32gui.GetOpenFileNameW(Filter=filter,
CustomFilter=customfilter,
FilterIndex=1,
File='*.pch',
InitialDir=os.getcwd(),
Title='Select Input Files',
Flags=win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER,
DefExt='.pch')
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python-win32 Digest, Vol 48, Issue 2

2007-03-05 Thread Tony Cappellini
Date: Sun, 4 Mar 2007 16:18:55 -0500
From: Roger Upole [EMAIL PROTECTED]
Subject: [python-win32]  Re: win32gui.GetOpenFileName()
To: python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; format=flowed; charset=iso-8859-1;
   reply-type=original
This function expects a buffer containing  an OPENFILENAME structure,
created using the struct module or some other means.

 Is there a way I can select multiple files with either of the above
 mentioned calls?
 (pressing Control doesn't work)

Pass win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER
 in the Flags to enable this.

Thanks Roger, where did you find this information?

From the Pythin Win help file
win32gui (more).GetOpenFileName
int = GetOpenFileName()
Creates an Open dialog box that lets the user specify the drive,
directory, and the name of a file or set of files to open.
Return Value
If the user presses OK, the function returns TRUE. Otherwise, use
CommDlgExtendedError for error details.
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python-win32 Digest, Vol 46, Issue 18

2007-01-24 Thread Tony Cappellini

If you want to hide the window which your app was launched, rename the .py
file to .pyw
You wan't see the console window then

Message: 9
Date: Wed, 24 Jan 2007 09:40:47 +0100
From: le dahut [EMAIL PROTECTED]
Subject: [python-win32] Launch process
To: python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

What's the best way to launch a process and waiting for its exit code ?
I'm looking for something that can take win32con.SW_HIDE as argument
(os.spawnv don't).
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] List of drives / removable drives

2006-12-20 Thread Tony Cappellini

Is there a way to differentiate between floppy, network, hard drive,
removable (aka USB flash) drives? though Pythonwin?

My searches came up with Tim Golden's mapped drives, which is somewhat
helpful, but not particular to my needs.
http://tgolden.sc.sabren.com/python/win32_how_do_i/show_mapped_drives.html

win32api.GetVolumeInformation doesn't return anything specific- other than
'FAT' which is used on a floppy, but somehow
I was expecting something a little more specific.


thanks
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] List of drives / removable drives

2006-12-20 Thread Tony Cappellini

Will try this- thanks

On 12/20/06, Howard Lightstone [EMAIL PROTECTED] wrote:


  
  
   Is there a way to differentiate between floppy, network, hard drive,
removable (aka USB flash)
   drives? though Pythonwin?

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Console width in characters

2006-12-02 Thread Tony Cappellini

I'm trying to find an API that will give me the width of a cmd console
window, in charaters.

GetSystemMetrics(SM_CXSCREEN) will return it in pixels- but that doesn't
help.

If the user resizes the console, I want to be able to adjust the text output
of a program

I've looked at the WConio package- that may do it, but I'd rather just uses
a straight API (if possible), because WConio isn't maintained.

Is there an API that returns the number of characters of the printable
area of a console windows?

I'm using Python 2.3.4, and build 202 of PythonWin

thanks
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Programmatically capturing the text in a cmd console, for a program that has completed execution

2006-10-30 Thread Tony Cappellini
In Windows XP, after a program has completed it's execution in a cmd console...Is there a way to *programmatically* capture the text that is in the scrollback buffer?I usually set my buffers to 10K lines or more, so there is a lot of text I'd like to capture.
I want to do this programmatically, as opposed to using a mouse to mark and copy.thanks

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Midi files to Wav files

2005-11-18 Thread Tony Cappellini



Try pysonic
http://pysonic.sourceforge.net/


Message: 2
Date: Thu, 17 Nov 2005 16:35:37 +0100
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
Subject: [python-win32] Midi files to Wav files
To: python-win32@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi !

I want to convert my mid files to way files in MS Windows.

I know that I can play the mid files, and I can record them as wav  -
with MMSystem unit.
I need to play a midi file and record it in in-line. But how can I do it ?
Anybody can help me ? I need some informations to start this work.

Thanx for help: dd

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


RE: [python-win32] win32com.Dispatch() vswin32com.client.gencache.EnsureDispatch() vswin32com.client.DispatchWithEvents()

2005-03-22 Thread Tony Cappellini

help(win32com.client.DispatchWithEvents) should print an IE example.
At 12:56 AM 03/22/05, Mark Hammond wrote:
I did see the example, but didn't know which form of Dispatch it works like.
I've read Chapter 12 , several times- but this stuff doesn't COM easy to me.
 What I would like to know is- is DispatchWithEvents() like the
 unreliable Dispatch(), or is it more like using EnsureDispatch() +
 event handling ?
DispatchWithEvents is more like EnsureDispatch - it requires the makepy
early-binding.
 Does anyone have some example sof using
 win32com.client.DispatchWithEvents() ?
help(win32com.client.DispatchWithEvents) should print an IE example.
Mark
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Erratic python Win debugger operation

2005-03-02 Thread Tony Cappellini
Has anyone else had the problem with the PW debugger, where the debug 
toolbar goes away after running a script ?

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32