简体   繁体   中英

How to export data from a GUI executable using python

Here is a programm I want to get a token from(allocated with red): 在此处输入图片说明

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]
print(outs)

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

Solution:

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")
time.sleep(2)
sda.Copy.Click()
code = clipboard.GetData()
sda.Close()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM