2017-05-28 57 views
0

在這個腳本:Applescript - 「AXMain」是什麼意思?

global frontApp, frontAppName, windowTitle 

    set windowTitle to "" 
    tell application "System Events" 
     set frontApp to first application process whose frontmost is true 
     set frontAppName to name of frontApp 
     tell process frontAppName 
      tell (1st window whose value of attribute "AXMain" is true) 
       set windowTitle to value of attribute "AXTitle" 
      end tell 
     end tell 
    end tell 

    return {frontAppName, windowTitle} 

什麼是 「AXMain」 是什麼意思?我找不到任何地方的文檔或其他問題!

回答

1

AX是一個類別前綴,代表可訪問

AXMain的一個窗口意味着這個窗口是應用程序的主窗口

+0

謝謝!你還記得你發現這個的地方嗎?即如果在某處存在隱藏文檔? – Dylanthepiguy

+0

有[OS X輔助功能編程指南](https://developer.apple.com/library/content/documentation/Accessibility/Conceptual/AccessibilityMacOSX/index.html#//apple_ref/doc/uid/TP40001078-CH254 -SW1),它解釋了這項技術。這些屬性沒有詳細描述,但其中大部分都是不言自明的。 – vadian