[英]Clicking button using Apple Script
你不能用“新”的按鈕的 name
,因為該數值 name
的屬性 button 1 of group 1 of toolbar 1 of window 1 of application process "Microsoft Remote Desktop"
的missing value
。
然而,對於該值 description
屬性是New
,所以下面的示例 代碼 的AppleScript工作對我來說:
activate application "Microsoft Remote Desktop"
delay 1
tell application "System Events" to tell application process "Microsoft Remote Desktop"
click (every button of group 1 of toolbar 1 of window 1 whose description is "New")
end tell
delay
命令的值 ,或者可能需要也可能不需要其他delay
命令 。 適當調整和的值 ,或添加/刪除delay
命令 。 如果僅在打開主窗口的情況下已經運行Microsoft遠程桌面,則可以使用以下示例代碼行獲取button 1 of group 1 of toolbar 1 of window 1
的button 1 of group 1 of toolbar 1 of window 1
的屬性 :
tell application "System Events" to get properties of button 1 of group 1 of toolbar 1 of window 1 of application process "Microsoft Remote Desktop"
注意: 示例 AppleScript 代碼就是這樣,它沒有任何錯誤處理 ,僅用於說明完成任務的多種方式之一。 用戶有責任根據需要/需要添加/使用適當的錯誤處理 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.