Applescript に相当する appscript.rb にコードを書きたい:
tell App "TextEdit"
properties of front window
end tell
しようとしている
te = app("TextEdit")
puts te.windows[1].properties
プロパティ名のリストを返しますが、値は返しません。
答えてくれてありがとう。
Applescript に相当する appscript.rb にコードを書きたい:
tell App "TextEdit"
properties of front window
end tell
しようとしている
te = app("TextEdit")
puts te.windows[1].properties
プロパティ名のリストを返しますが、値は返しません。
答えてくれてありがとう。
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