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

Jim jf_byrnes at comcast.net
Wed Apr 8 15:28:45 EDT 2020


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

If I use the following code the pop-up does not appear so I don't need 
Pyautogui.

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()
S().dispatch('GoToCell', ('ToPoint', 'Diversification.R1'))
S().dispatch('PasteSpecial', ('Format', 0))

Note: My original message hasn't appeared yet so I could not reply to it.

Regards,  Jim



More information about the Tutor mailing list