Re: [python-win32] AVDoc and PDDoc

2006-09-24 Thread Justin Ezequiel
 From: Michael S [EMAIL PROTECTED]

 I am trying to write a short Python script to create
 some PDFs.
 I create instances of App, AVDoc and PDDoc using the
 following syntax:
 app = Dispatch(AcroExch.App)
 doc = Dispatch(AcroExch.AVDoc)
 pd = Dispatch(AcroExch.PDDoc)

 However when I call pd = doc.GetPDDoc(), the Python
 interpreter
 complains about the member function not being found. I
 know for sure
 that it is there, since I can execute the code in VB
 no problem.


was experimenting with Acrobat months ago

import win32com.client.dynamic

NOSAVE = -1
PDSAVEFULL = 1

class Acrobat2pdfError(RuntimeError): pass

def Acrobat2pdf(src, dst):
avdoc = win32com.client.dynamic.Dispatch(AcroExch.AVDoc)

if not avdoc.Open(src, doc2pdf):
raise Acrobat2pdfError(unable to open %s % src)

pddoc = avdoc.GetPDDoc()

if not pddoc.Save(PDSAVEFULL, dst):
raise Acrobat2pdfError(unable to save %s % dst)

if not pddoc.Close():
raise Acrobat2pdfError(unable to close %s % dst)

del pddoc

if not avdoc.Close(NOSAVE):
raise Acrobat2pdfError(unable to close %s % src)

del avdoc

if __name__ == '__main__':
import os
src = rC:\test\file1.doc
dst = rC:\test\file2.pdf
Acrobat2pdf(src, dst)
assert os.path.isfile(dst)
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Code help (Aleksandar Cikota)

2006-04-09 Thread Justin Ezequiel
FocusMax.FocusControl.Focus starts the auto focus operation and returns when
Focus is complete. This Method has the same effect as if the user clicked
the Focus button on the Focus tab (in FocusMax), but there is no reaction
and  I don't get any error message.

Python code:
FM.Focus() # you need the parentheses to call the method

in VBScript, the parentheses are not required

I sometimes forget the parentheses too when porting VB COM code to Python
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] String weirdness on python 2.4 / windows

2005-10-19 Thread Justin Ezequiel
 Date: Thu, 20 Oct 2005 10:04:24 +1000
 From: Kinsley Turner [EMAIL PROTECTED]

 I checked the icon, it seemed to be ok.  I'm unfamiliar with win32
 tools, but it seemed that the data being delivered from the socket
 rendered differently from a python print() compared to a terminal
 'type icon.ico'.  I cut the code out and tested it in isolation - this
 showed it to be flawless.  Despite appearing correct in other software
 the binary identical icon appears broken in IE 6.something.

for what its worth, had a similar problem serving up images from a
Python CGI script running on Apache on WinXP.

what worked for me was adding the -u switch to the shebang
#!E:\Python23\python.exe -u

-u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
 see man page for details on internal buffering relating to '-u'

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


[python-win32] run external program but with timeout

2005-06-15 Thread Justin Ezequiel
Greetings,

I want to run an executable but I need to be able to kill it if 
it has not completed after 5 or so minutes.

Googling gets me signal.signal(signal.SIGALRM, handler)
but I need to use this from Windows.

I have Python 2.3.4 on WinXP Pro.

Had a look at the Python for Windows Documentation and it 
seems that I can use the win32process module.

I will have a go at this but if anybody has done this before 
and would be willing to share, please do.

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


Re: [python-win32] run external program but with timeout

2005-06-15 Thread Justin Ezequiel
On 6/15/05, Justin Ezequiel [EMAIL PROTECTED] wrote:
 
 I want to run an executable but I need to be able to kill it if
 it has not completed after 5 or so minutes.
 

Forgive me. Just now found a Demos folder and a winprocess.py file
that at first glance will be exactly what I need.
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32