[Tutor] Pyautogui clicking on a modal pop-up dialog

Jim jf_byrnes at comcast.net
Sat May 2 10:53:39 EDT 2020


On 5/1/20 9:46 PM, Tim G. wrote:
> Hey Jim,
> There's a simple way to do that just get a screenshot of the ok button,
> crop it down to just the button and then put it in the parenthesis. It
> should look like pyautogui.click("button.png")
> You can find a sample in the docs here:
> https://pyautogui.readthedocs.io/en/latest/screenshot.html

Tim,

I was able to solve the problem by changing the original paste() line to

S().dispatch('PasteSpecial', ('Format', 0))

This prevented the popup from showing and the script continued without 
interruption.

Regards,  Jim

> On Wed, Apr 8, 2020 at 3:41 PM Jim <jf_byrnes at comcast.net> wrote:
> 
>> I am using OOSheet and Pyautogui to update a Libreoffice calc sheet.
>>
>> The following code snippet works until it hits the paste() function.
>>
>> cols_to_copy = copy_cellrange()
>> # Copy the columns necessary to calculate the portfolios diversity
>> colA = S(cols_to_copy[0]).copy()
>> S('Diversification.R1').paste()
>> pyautogui.click()
>>
>> Once I get to paste() it pops up a Libreoffice dialog warning me I am
>> pasting into cells that contain data, do I want to paste. The cursor
>> sits over the OK button but the click() never runs.
>>
>> Is there anyway to get Pyautogui to click the button?
>>
>> Thanks,  Jim
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> 




More information about the Tutor mailing list