3

I m making an Excel automation via pywinauto library. But there is a hard challange for me due to using Excel Oracle add-ins called Smartview.

I need to click 'Private Connections' button, however i can't find any little info in app.Excel.print_control_identifiers() Private Connections

So i tried to use inspector.exe for find ui element regarding private connections button, however i couldn't find any little solvetion inside of inspector.exe's result inspector's result

Then i used another program called UISpy, however i can only find private connection's pane inside of the program. UISpy's result

i tried to find an answer but i couldn't find out anything. So, can you help me to click here?

By the way here is my code :

import pywinauto
from pywinauto import application
from pywinauto.keyboard import send_keys
from pywinauto.controls.common_controls import TreeViewWrapper
program_path = r"C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
file_path    = r"C:\Users\AytugMeteBeder\Desktop\deneme.xlsx"
app = application.Application(backend="uia").start(r'{} "{}"'.format(program_path, file_path))
# sapp = application.Application(backend="uia").connect(title = 'deneme.xlsx - Excel')
time.sleep(7)
myExcel = app.denemeExcel.child_window(title="Smart View", control_type="TabItem").wrapper_object()
myExcel.click_input()
Panel = app.denemeExcel.child_window(title="Panel", control_type="Button").wrapper_object()
Panel.click_input()
time.sleep(1)
app.denemeExcel.print_control_identifiers()
mete BEDER
  • 41
  • 3

1 Answers1

0

I am not sure if you resolve your problem, but if you want, you can try the code below:

import time
import pywinauto
from pywinauto import Application
from pywinauto.keyboard import send_keys
from pywinauto.controls.common_controls import TreeViewWrapper

program_path = r"C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
file_path = r"C:\Users\AytugMeteBeder\Desktop\deneme.xlsx"
app = Application(backend="uia").start(r'{} "{}"'.format(program_path, file_path))
# sapp = application.Application(backend="uia").connect(title = 'deneme.xlsx - Excel')
time.sleep(7)
myExcel = app.denemeExcel.child_window(title="Smart View", control_type="TabItem").wrapper_object()
myExcel.click_input()
Panel = app.denemeExcel.child_window(title="Panel", control_type="Button").wrapper_object()
Panel.click_input()
time.sleep(1)

# The code that I added
switch_to_button = app.denemeExcel.child_window(title="Switch to", control_type="SplitButton").wrapper_object()
switch_to_button.click_input(coords=(43, 19))
private_conn = app.Content.child_window(title="Private Connections", control_type="MenuItem").wrapper_object()
private_conn.click_input()
time.sleep(1)

I used py_inspect to find the elements.

Hope this can help you.

Charles
  • 21
  • 3