Skip to content

Instantly share code, notes, and snippets.

@cibomahto
Last active January 10, 2023 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cibomahto/3c47e7b06622aad732cbea4ac11900c4 to your computer and use it in GitHub Desktop.
Save cibomahto/3c47e7b06622aad732cbea4ac11900c4 to your computer and use it in GitHub Desktop.
Press the 'start' button in the Saleae Logic 2 gui
# The Saleae Logic 2 GUI has a scripting API, but it's designed for full automation, and doesn't
# seem to have a method for telling the GUI to just start a capture. So forget it, let's just
# invoke the button ourselves...
#
# Tested with Windows 10 and Saleae Logic 2.4.3, you'll likely need to tweak this
def start_capture():
import pywinauto
app = pywinauto.application.Application(backend="uia").connect(title_re="Logic 2.*")
i = 0
for window in app.windows():
for c in window.children():
#print('child:', c)
for cc in c.children():
#print(' cchild:', type(cc), cc)
# the program does not support accessability, guess that the 4th image is the 'start' button
if(type(cc) == pywinauto.controls.uiawrapper.UIAWrapper) and (cc.friendly_class_name() == 'Image'):
if i == 3:
#print(cc, dir(cc))
cc.invoke()
i += 1
if __name__ == "__main__":
start_capture()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment