1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macのSketchUpで、rubyコードを自動実行する

1
Last updated at Posted at 2012-05-29

macで実行中のGoogleSketchUpをアクティブにし、Rubyコードエディタを表示させ、クリップボードのテキストをコピーして実行させるAppleScriptです。

使用方法:

  1. VimなどでSketchUp用Rubyを作成する
  2. コード全体をクリップボードにコピーする
  3. このスクリプトを呼び出す

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
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?