0

Applescript に相当する appscript.rb にコードを書きたい:

tell App "TextEdit"
    properties of front window
end tell

しようとしている

te =  app("TextEdit")
puts        te.windows[1].properties

プロパティ名のリストを返しますが、値は返しません。

答えてくれてありがとう。

4

1 に答える 1

0

AppleScriptのリファレンスに相当するRubyAppscriptにpropertiesは、末尾にアンダースコアが付いていますproperties_getまた、クエリを実行するためにを使用する必要があります。

te = Appscript.app('TextEdit')
te.windows.first.properties_.get

最後の式の結果は、RubyのHashクラスのインスタンスになります。


質問のタイトルにはが記載されています。これは、システムイベントから利用できるオブジェクトUI_elementに関心があることを示している可能性があります。UI elements

se = Appscript.app('System Events')
teap = se.application_processes['TextEdit']

# properties of frontmost UI element window
teap.windows.first.properties_.get

# properties of first-level UI elements of frontmost UI element window 
teap.windows.first.UI_elements.properties_.get
于 2012-02-19T05:06:28.570 に答える