Printing with python
Florian Schulze
florian.proff.schulze at gmx.net
Fri Oct 18 17:07:25 EDT 2002
On Fri, 04 Oct 2002 14:09:43 +0200 Grzegorz Makarewicz <mak at trisoft.com.pl> wrote:
>
> I have tested this small script with AR 4 (perhaps) and it has worked,
> now 5.05 simply wont start :(
>
> Sorry, cant help
> mak
>
>
I have written a small code snippet which starts up Acrobat Reader and
makes a connection (attached).
Could someone give me more help on dde with python. For example: Do I need
to explicitely close the connection or is that done automatically when the
variable gets destroyed? To repeat that, I don't need general dde help, but
help on the python implementation of it.
Regards,
Florian
-------------- next part --------------
import os
import _winreg
import win32process
import win32con
import dde
import time
def pdftest():
key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\AcroRd32.exe')
acrord = _winreg.QueryValue(key, "")
sui=win32process.STARTUPINFO()
sui.wShowWindow = win32con.SW_HIDE
sui.dwFlags = win32con.STARTF_USESHOWWINDOW
p = win32process.CreateProcess(acrord, "", None, None, 0, win32process.NORMAL_PRIORITY_CLASS, None, None, sui)
server = dde.CreateServer()
server.Create("PyAcroview")
conversation = dde.CreateConversation(server)
timeout = 20
while timeout > 0 and conversation.Connected() == 0:
try:
conversation.ConnectTo("Acroview", "Control")
except:
time.sleep(1)
--timeout
conversation.Exec('[FileOpen("%s")]' % 'C:/home/Dev/python/test/wegberg Kopie.pdf')
More information about the Python-list
mailing list