print pdf file to network printer using python

2005-07-21 Thread scrimp
Well, Ive been searching through google groups and Ive seen a lot about
printing a pdf file, but I havent seen a definite answer. I tried this
code:

f = open(printer_path, 'w')
f.write(pdffile_path)
f.close()

Basically it doesnt work and what it prints out is the value of
pdffile_path variable. If anyone can offer some help, Id appreaciate it
thanks!

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: print pdf file to network printer using python

2005-07-21 Thread scrimp
I just tried it and all that printed out was garbage. I found another
way to do it. It all depends on what you wanna do. If u want to print
to the default printer (easiest way) then just use this line:

win32api.ShellExecute(0, "print", file_path, None, ".", 0)

file_path of course being the full path of the file

Now, if u wanna print to another printer then u have to add a line:

win32print.SetDefaultPrinter(printer_name)
win32api.ShellExecute(0, "print", file_path, None, ".", 0)

printer_name being the NAME of the printer that is installed on the
machine not the path of the printer

Everything works good and the PDF file comes out perfect. The only
problem I have is that ShellExecute command starts up a blank session
of Acrobat Reader. I need that Acrobat to be terminated. I think by
using ShellExecute it does not provide the correct handle that python
needs to terminate the process. Any suggestions?

-- 
http://mail.python.org/mailman/listinfo/python-list


is this possible?

2005-07-22 Thread scrimp
Is it possible to print a PDF file using python without having acrobat
reader installed on the machine??

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is this possible?

2005-07-22 Thread scrimp
I am using reportlab not to generate PDF files, but I want to be able
to print them without having to install acrobat reader. I looked
through the users guide and found nothing about printing to a printer
(programmatically). I want to be able to automate the printing of
reports when they are available. Does anyone know how this is done
using reportlab? thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


FTP/TLS connection using python

2005-05-04 Thread scrimp
Hello,
   I was wondering if there is any other way to securly connect to an
FTP site using SSL or TLS? I dont have the option of purchasing
M2Crypto from the site. Any help/suggestions would help. Thanks!

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FTP/TLS connection using python

2005-05-04 Thread scrimp
Wow, thanks very much Ive been searching on google for a few days now
and have never seen this yet. Thanks ill take a look at what I can do
with this

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FTP/TLS connection using python

2005-05-05 Thread scrimp
Does anyone know how I can get m2crypto installed on a windows box w/o
paying for the installer? I think thats dumb to charge for the windows
version and the unix version is free...o well

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list


saving .zip or .txt email attachments instead of deleting them

2005-06-02 Thread scrimp
How would I go about retriving an email message and stripping out the
attachment into a file. I have seen examples where they would read in
the file and delete the attachment and replace it with text saying that
the attachment was removed.

For testing purposes Im using a pop3 server to receive messages from. I
can log into the pop3 server get all the messages and print them to the
screen or to a file.

I have another script that I got from ActiveSource that deletes the
attachment. This is where I will need to save the attachment instead of
deleting it. Any help is appreciated thanks!

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: saving .zip or .txt email attachments instead of deleting them

2005-06-02 Thread scrimp
Im using the winpython IDE to run that script for the unpacking the
email. The usage says unpackmail [options] msgfile. I type unpackmail
-d filename and it gives me a syntax error. What modifications did u do
to that module to make it work?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: saving .zip or .txt email attachments instead of deleting them

2005-06-02 Thread scrimp
OK i got past that syntax error I think. This is the error I am getting
nowAttributeError: 'NoneType' object has no attribute 'lower' All
Im reading is a text file of the email message with an attachment --zip
file

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: saving .zip or .txt email attachments instead of deleting them

2005-06-03 Thread scrimp
Here is the complete traceback..sorry about that though.

I used the run button and entered in "C:\email.txt" for the msgfile
parameter thats used for input

This email.txt file has a zip file attached to it and is all in text,
so hopefully I am working with the correct input file. I used the pop3
example given in the python documentation to pick up a message on the
mail server and read and wrote the information to a file --> email.txt

Traceback (most recent call last):
  File
"C:\PYTHON23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
  File "C:\My Documents\python scripts\EmailUnpack.py", line 83, in ?
main()
  File "C:\My Documents\python scripts\EmailUnpack.py", line 71, in
main
ext = mimetypes.guess_extension(part.get_type())
  File "C:\PYTHON23\lib\mimetypes.py", line 178, in guess_extension
extensions = self.guess_all_extensions(type, strict)
  File "C:\PYTHON23\lib\mimetypes.py", line 157, in
guess_all_extensions
type = type.lower()
AttributeError: 'NoneType' object has no attribute 'lower'

Again, thanks!

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list


Using PAMIE to upload and download files...is it possible?

2005-06-06 Thread scrimp
Ive been using PAMIE 1.4 to try to automate web page processes. The one
thing I cannot do with it is upload files and download files.

With uploading files, the file input box does not allow PAMIE to enter
in a path to a file.

With downloading files, I can click on the link to download the file,
but thats where I get stuck at. It brings up that download window and
then it brings up the where to save window.

Theres no errors that I encounter when I get stuck at these spots it
justs sits there not knowing what to do.

If anyone has had success in both uploading or downloading or even some
insight, I would greatly appreciate your help. Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using PAMIE to upload and download files...is it possible?

2005-06-10 Thread scrimp
Thank you. I will try to come up with something I will post more if I
have any other questions. Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using PAMIE to upload and download files...is it possible?

2005-06-10 Thread scrimp
This is your code I used...I didnt change anything from it

def useSaveASDialog(filePath=None):
from watsup.winGuiAuto import findTopWindow,findControl,setEditText
from time import sleep

rVal = None
handle = winGuiAuto.findTopWindow("Save As")
sButton = winGuiAuto.findControl(handle,"&Save","Button")
sEdit = winGuiAuto.findControl(handle, None, "Edit")
if filePath != None:
winGuiAuto.setEditText(sEdit, filePath)
rVal =  winGuiAuto.getEditText(sEdit)
winGuiAuto.clickButton(sButton)
return rVal

So, in the interactive window I make an instantiation of it and this is
what I get

r = useSaveASDialog("C:\Downloads")
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\My Documents\python scripts\mytest1.py", line 6, in
useSaveASDialog
handle = winGuiAuto.findTopWindow("Save As")
  File "C:\PYTHON23\lib\site-packages\watsup\winGuiAuto.py", line 158,
in findTopWindow
raise WinGuiAutoError("No top level window found for wantedText=" +
WinGuiAutoError: No top level window found for wantedText='Save As',
wantedClass=None, selectionFunction=None, maxWait=1, retryInterval=0.1

So, I fire up IE manually and find a link to click on that brings up
the download window and the first window I run into is the File
Download window with an Open, Save, Cancel, and More Info buttons. I
click on Save and that brings up the Save As window, so from there I go
back to PythonIDE and do the same command in the window and it
PythonIDE crashes. The weird thing is though it puts the path inside
the Filename text box. Just the path without the file. Ill be testing
this more next week, so ill get back with you then. Thanks for the
start though!!

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using PAMIE to upload and download files...is it possible?

2005-06-14 Thread scrimp
I dont see the modaltest.py would u please send me a link to it. I
still have not been able to gets winGuiAuto to work. I have pamie
logging into a site, navigating to the downloads section, and clicking
the link of the file to download and it stops right there.

I am downloading a zip file and there are two windows that come up. The
first one is the File download window in which it asks to either Open,
Save, Cancel, or More Info and then after clicking Save it brings up
another window Save As and asks where you want the file This is my
code:

rVal = None
dnldpath = "C:\\"
dnld = findTopWindow("File Download")
btnSave = findControl(dnld, "&Save", "Button")
clickButton(btnSave)

save = findTopWindow("Save As")
btnSave2 = findControl(save, "&Save", "Button")
editPath = findControl(save, None, "Edit")
if dnldPath != None:
setEditText(editPath, dnldPath)
rVal = getEditText(editPath)
clickButton(btnSave2)

and then I just quit IE right after that. Thanks again!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using PAMIE to upload and download files...is it possible?

2005-06-14 Thread scrimp
Theres one problem with the code that I saw off the bat. My PAMIE
script takes IE all the way up the window thats called "File Download".
It has 4 buttons Open, Save, Cancel, More Info. The code u gave to me
is for the next window I reach AFTER I click manually on Save. It
brings up the Save As window.

Anyways, I did the PAMIE part manually and the Save As window was open
waiting for the SaveAsDocDialog to click Save. It never did, in fact
all it did was freeze up python and crash it. So, im still at a stand
still here.

I know for sure my PAMIE part of the code works. It gets me to where I
need to use winGuiAuto. winGuiAuto just sits there and does nothing for
me. The window name "File Download" does NOT work for me. I have no
idea where or how to find the className of the window.

Again, thanx for all the help. Ill keep on trying it though

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using PAMIE to upload and download files...is it possible?

2005-06-16 Thread scrimp
Well, thanx to Erin I got everything I needed to do to work.

I basically used 2 classes and wrote a driver using PAMIE
1 for the two File Download windows and 1 for the Save As window

Here are the classes I used. I took out the comments, but its really
not too hard to understand
class FileDownloadDialog (threading.Thread):
   def __init__(self):
  threading.Thread.__init__(self)
  self.windowName = "File Download"
  self.hwnd = None

   def fetchWindows (self,attempts=20):
  tries = 0
  while tries 0:
  wHwnd = hw
  self.hwnd = wHwnd
  oButtons = winGuiAuto.findControls(self.hwnd,"&Save","Button")

  time.sleep(0.5)
  for oButton in oButtons:
 winGuiAuto.clickButton(oButton)

Heres the 2nd class I used
class SaveAsZipDialog (threading.Thread):
def __init__(self, docPath):
threading.Thread.__init__(self)
self.windowName = "Save As"
self.hwnd = None
self.document = docPath

def fetchWindow (self,attempts=20):
tries = 0
while tries < attempts:
tries = tries + 1
try:
self.hwnd = winGuiAuto.findTopWindow(self.windowName)
return
except:
print 'Checking for window named "'+ self.windowName +
'"',
print 'Attempt ',tries
time.sleep(1)
def run (self):
self.fetchWindow()
fText = winGuiAuto.findControl(self.hwnd, None, "Edit")
winGuiAuto.setEditText(fText,self.document)
oButtons = winGuiAuto.findControls(self.hwnd,"Save")
time.sleep(0.5)
for oButton in oButtons:
   winGuiAuto.clickButton(oButton)

I used PAMIE to get me through the web stuff and when it clicked on the
link to download the zip file I wanted these two classes would kick in
and take over from there. If anyone needs help feel free to email me or
post up on here. Thanks again Erin!

--Barry

-- 
http://mail.python.org/mailman/listinfo/python-list