on run argv if (count of argv) is 0 then error "Expected shell command argument" end if set shellCommand to item 1 of argv tell application "iTerm" activate if (count of windows) = 0 then create window with default profile end if tell current session of current window write text shellCommand end tell end tell end run