[英]Is it possible to capture the text output of an Android google-voice-typing from terminal?
假設我想使用我的智能手機的麥克風在我的終端中輸入文本,使用 google voice2speech 引擎。 我該怎么辦?
我會先聽 output 的google-voice-typing
,(但如何?)然后重定向到stdin
。
adb
命令有簡單的方法嗎?
您可以使用AndroidViewClient/culebra來
#! /usr/bin/env python3
from com.dtmilano.android.viewclient import ViewClient
helper = ViewClient.view_client_helper()
# mic in voice search widget
obj_ref = helper.until.find_object(body={
'clazz': 'android.widget.ImageButton',
'clickable': True,
'desc': 'Voice Search'
})
response = helper.ui_device.wait(oid=obj_ref.oid)
helper.ui_object2.click(oid=response['oid'])
print('Speak now...')
helper.ui_device.wait_for_window_update()
# text in search results
obj_ref = helper.until.find_object(body={
'res': 'com.google.android.googlequicksearchbox:id/googleapp_srp_search_box_text',
'clazz': 'android.widget.TextView'
})
response = helper.ui_device.wait(oid=obj_ref.oid)
print('Text:')
print(helper.ui_object2.get_text(oid=response['oid']).text)
output 會是這樣的
Speak now...
Text:
this is another example
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.