Skip to content

Applescript stopped working with nightlies

The below script which works on the 2.1 series of iTerm2 doesn't work with the nightlies. The problem is this line 'set _terminal to current terminal'.


on alfred_script(q) tell application "iTerm" activate

		try -- We don't need error messages
			set miniaturized of windows to false
		end try
		
		try
			set _terminal to current terminal
			set _session to current session of _terminal
		on error
			set _term to (make new terminal)
			tell _term
				launch session "Default"
				set _session to current session
			end tell
		end try
		
		tell _session
			write text q
		end tell
	end tell
	tell application "System Events"
		set visible of process "iTerm" to true
	end tell
end alfred_script