Takazudo
5/9/2011 - 6:05 PM

applescriptExamples.as

-- tell application "iTerm"
-- 	tell the first terminal
-- 		tell the last session
-- 			set cmd to "cd /temp/"
-- 			write text cmd
-- 		end tell
-- 	end tell
-- end tell
-- tell application "Finder"
-- 	if exists process "iTerm" then
-- 		display dialog "Hello World"
-- 	end if
-- end tell
-- tell application "iTerm"
-- 	tell (make new terminal)
-- 		launch session "Default"
-- 		tell current session
-- 			write text "hoge"
-- 		end tell
-- 	end tell
-- end tell

tell application '$Terminal'
	activate
	if not (exists window index 1) then
		set myterm to (make new terminal)
		tell myterm
			launch session "via MacVim"
		end tell
	end if
	tell the first terminal
		tell current session
			write text 'cd $current_path'
		end tell
	end tell
end tell

-- if exists process "iTerm" then
-- 	tell application "Finder"
-- 		display dialog "Hello World"
-- 	end tell
-- end if