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

erinhouston at gmail.com erinhouston at gmail.com
Wed Jun 8 14:48:32 EDT 2005


You are opening up the file open dialog when you are trying to do this
right?
If so you will need to use winguiauto. To find the dialog and the use
it to enter the info you want.

I included some code that shows how to do this.  One other problem you
are going to have is that these dialogs are called by ie.  pamie uses
com to control ie.  So the button click will not return antell after
you have delt with the dialog box.  Best way to deal with this is to
span a new thred befoe you click the button to deal with the dialog.

def useSaveASDialog(filePath=None):
...."""
....This function sets the file path if it is spesified then
....saves the file to the location listed it will return the
....file path of the saved file.
....or None if the file didn't get saved for some reason.
...."""
....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
def useChooseFileDialog(filePath=None):
...."""
....This function sets the file path if it is spesified then
....saves the file to the location listed it will return the
....file path of the saved file.
....or None if the file didn't get saved for some reason.
...."""
....rVal = None
....sButton = None
....handle = winGuiAuto.findTopWindow("Choose file")

....sButton = winGuiAuto.findControls(handle,"&Open","Button")
....print sButton
....sEdit = winGuiAuto.findControl(handle, None, "Edit")
....if filePath != None:
........winGuiAuto.setEditText(sEdit, filePath)
....rVal =  winGuiAuto.getEditText(sEdit)
....winGuiAuto.clickButton(sButton[1])
....return rVal

Hope this was of help to you.

Erin.




More information about the Python-list mailing list