Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use iTerm With OnMyCommand' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use iTerm With OnMyCommand
Authored by: SimonDorfman.com on Nov 21, '04 08:05:10AM
AppleScript is natively supported in OMC 1.6: you do not have to use call osascript to execute AppleScript code. Here's what I added to my com.abracode.OnMyCommandCMPrefs.plist file to get this working. Also note that the code below works even when the path has spaces in it. I fixed that problem by adding single quotes around the whole '__OBJ_PATH__' enjoy

		<dict>
			<key>ACTIVATION_MODE</key>
			<string>act_folder</string>
			<key>COMMAND</key>
			<array>
				<string>
				tell application "iTerm"
					activate
					set myterm to (make new terminal)
					tell myterm
						set mysession to (make new session at the end of sessions)
						tell mysession
							exec command "/bin/tcsh"
							write text "cd '</string><string>__OBJ_PATH__</string><string>'; ls -alF"
						end tell
					end tell
				end tell
				</string>
			</array>
			<key>ESCAPE_SPECIAL_CHARS</key>
			<string>esc_for_applescript</string>
			<key>EXECUTION_MODE</key>
			<string>exe_applescript</string>
			<key>NAME</key>
			<string>Change dir to this folder and list content in iTerm</string>
			<key>NOTES</key>
			<string>Does not work with folders containing non-ASCII chars</string>
			<key>VERSION</key>
			<integer>1</integer>
		</dict>


[ Reply to This | # ]