Using PAMIE to upload and download files...is it possible?
scrimp
scrimp212 at yahoo.com
Thu Jun 16 10:10:54 EDT 2005
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<attempts:
tries = tries + 1
try:
self.hwnd = winGuiAuto.findTopWindows(self.windowName)
return
except:
print 'Checking for window named "'+ self.windowName + '"',
print 'Attempt #',tries
time.sleep(1)
def run (self):
self.fetchWindows()
oButton = []
for hw in self.hwnd:
tButton = winGuiAuto.findControls(hw,"&Save","Button")
if len(tButton) <> 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
More information about the Python-list
mailing list