Berman Berman - 2 years ago 167
Python Question

How to export data from a GUI executable using python

Here is a programm I want to get a token from(allocated with red):
enter image description here

I'm trying to do it using subprocess module:

import subprocess
sda = subprocess.Popen(r'C:\Program Files (x86)\SDA New\Steam Desktop Authenticator.exe', stdout = subprocess.PIPE)
outs = sda.communicate(timeout=15)[0]

it returns an emtry string. How can I get the token?

Answer Source
from pywinauto import application
from pywinauto import clipboard

app = application.Application()
app.start(r'C:\Program Files (x86)\sda 1.06\Steam Desktop Authenticator.exe', timeout = 5)
sda = app.window_(title_re = "Steam Desktop Authenticator")
code = clipboard.GetData()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download