Jump to content

rsvore

Members
  • Posts

    7
  • Joined

  • Last visited

rsvore's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I have it figured out in Python. I called the save_click function by passing in two arguments self.save_click(570,540). I had used the coordinates from AutoIt but they were missing the OK button after some investigation I found the new coordinates to use. Now, AutoIt may work with the new coordinates but for now I'm keeping the script all Python. To get the right coordinates of the OK button I screen captured the screen scrape that showed the dialog box within the Firefox browser pasted it in Paint.net and found the x and y from the ruler. I was using coordinates of only the dialog box which didn't work from AutoIt. Here is the Python function: def save_click(self,x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
  2. Thanks Universalist, I'll give this a try this morning. What does click(10,10) mean/do. I know this is not a Python forum but: I named the function to save_click becaus I was getting a problem with a .click I had in another function. So I call the function self.save_click(269,258) and give it two arguments. But I get the error that the click(10,10) is a global name and needs to be defined. self.save_click(269,258) def save_click(self,x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0) click(10,10)
  3. I tried this in Python to click on the save button, but it doesn't work. pwa_app = pywinauto.application.Application() w_handle = pywinauto.findwindows.find_windows(title=u'Opening 1350672610_address_book.png', class_name='MozillaDialogClass')[0] window = pwa_app.window_(handle=w_handle) window.SetFocus() window.Click() window['OK'].Click() """ window.ClickInput('OK') """ """ window.PressMouseInput()""" window.PressMouse()
  4. Sure, how? I would rather not have to use the AutoIt script and just do it in Python if possible. Thanks
  5. Well, when the Python script runs it opens Firefox and navigates to a particular page then selects an icon on the screen to download a file. The "Save" dialog box pops up and this is where I call the AutoIt file to select the save button in the dialog box. The title in the dialog box is "Opening 201227510028031.tif". So, the AutoIt finds it and clicks the save button.The python script finishes successfully. I did add a time.sleep(10) in the python script to give AutoIt a chance to work. But again Autoit doesn't click the save button every time. Here is a snip-it of the Python script where I call AutoIt : driver.find_element_by_css_selector("img[alt="Open:"]").click() """ add AutoIt here to download first file """ autoit.Run("SelectFilenetSavedialogue2.au3") time.sleep(10)
  6. Here is my AutoIt script: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- $csnNumber = "Opening " & "201227510028031" & ".tif" Func Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc AU3RecordSetup() WinWaitActivate($csnNumber,"") MouseClick("left",268,256,1)
  7. I'll say I'm new to Python and AutoIt. I created a Python script using Selenium. The Python scripts works fine. Now I'm looking at calling an AutoIt script that clicks the save a file dialog box. I added autoit.Run("SelectFilenetSavedialogue3.au3") in my Python script. I ran the Python script and everything worked, I then ran the script again (because I could believe I got it to work the first time) and the second time the AudIt script did not select the Save button as in the first time I ran the Python script. Now, I may not be calling the Audit script right or the state of Audit is lost, just not sure why it would work once then not again. Any thought? Thanks
×
×
  • Create New...