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

erinhouston at gmail.com erinhouston at gmail.com
Tue Jun 14 12:43:45 EDT 2005


So here is a class that should do what you want.  I don't use pamie we
use a in house python ie driver.  But it has the same problem.  Here is
a class that should do what you want.

import winGuiAuto
import threading


class SaveAsDocDialog (threading.Thread):
....'''Some Internet Explorer dialog windows will halt all other
....IE functionality until they are populated.  This class is
....used to handle these dialog windows.
....This little class saves a document to the pc'''
....def __init__(self, docPath):
........'''The constructor method.'''
........threading.Thread.__init__(self)
........self.windowName = "Save As"
........self.hwnd = None
........self.document = docPath

....def fetchWindow (self,attempts=20):
........'''Grab the handle of the dialog window'''
........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):
........'''Overriding the "run" method for threading.'''
........self.fetchWindow()
........oButtons = winGuiAuto.findControls(self.hwnd,"&Save","Button")
........fText = winGuiAuto.findControl(self.hwnd,None,"Edit")
........winGuiAuto.setEditText(fText,self.document)
........time.sleep(0.5)
........for oButton in oButtons:
............winGuiAuto.clickButton(oButton)


#usage
saveAS = SaveAsDocDialog("c:\\test.txt")
saveAS.start()
#here you put the action that opens up the save as dlg
#have no clue what the pamie call would be.
saveAS.join()


Hope this was of help to you.




More information about the Python-list mailing list