I'm tring to write a shortcut script in spark for opening the terminal.

on run {input, parameters}

  tell application "Utilities/Terminal" // tried Utilities:Terminal and Terminal too
    reopen
    activate
  end tell

end run

how can make this work? I'm using 10.10.2 as OSX version.


Solution 1:

This is the correct method:

tell application "Terminal"
    if not (exists window 1) then reopen
    activate
    -- insert your code here
end tell

EDIT You can open new windows with do script

tell application "Terminal"
    do script ""
end tell

Solution 2:

tell application "Terminal"
   activate
  tell application "System Events" to keystroke "n" using {command down}
end tell

Should do the job.