Kenichi Maehashi's Blog
脳内コアダンプ

Fluent Interface で AppleEvent を送出できる Xojo ライブラリ
Saturday | January 4, 2014
Xojo で AppleEvent を Fluent に (method chaining で) 書きたかったので、ラッパーライブラリを書いてみた。こんな感じで使います。
Dim ae As AppleEvent = FluentAppleEvent _
.To_("com.apple.finder") _
.Get(Specifier.Id("appf", "com.apple.iTunes")) _
.As_("alis") _
.Send(2)

If ae <> Nil Then
MsgBox(ae.ReplyFolderItem.NativePath)
Else
MsgBox("Failed")
End If
AppleScript で書くと以下のコードに相当します。
try
with timeout of 2 seconds
tell application "Finder"
get application file id "com.apple.iTunes" as alias
end tell
end timeout
display dialog the result as string
on error
display dialog "Failed"
end try
需要があれば公開したいが、これが本当に必要な人は世界に 10 人くらいしかいない気がする。
コメント (0)
コメント


<< 前ページ[1]

トップページに戻る
Copyright © 2006-2021 Kenichi Maehashi, All Rights Reserved.