macで実行中のGoogleSketchUpをアクティブにし、Rubyコードエディタを表示させ、クリップボードのテキストをコピーして実行させるAppleScriptです。
使用方法:
- VimなどでSketchUp用Rubyを作成する
- コード全体をクリップボードにコピーする
- このスクリプトを呼び出す
Vim側でこれを呼び出すプラグインは、現在作成中です。
QuickRunなどと連携できたら最高ですが、ただのRubyファイルと紛らわしいので、独自に実装するほうがいいかも知れません。
~/bin/activate_sketchup.scpt
if application "SketchUp" is running then
tell application "SketchUp" activate end tell
else
return
end iftell application "System Events" get properties get every process if UI elements enabled then tell process "SketchUp" set frontmost to true end tell (*日本語版専用*) tell process "SketchUp" tell menu bar 1 tell menu bar item "ウィンドウ" tell menu "ウィンドウ" click menu item "Ruby コンソール" end tell end tell end tell end tell tell application "System Events" keystroke "v" using {command down} keystroke return end tell else tell application "System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\"" end tell end ifend tell