The Premium version of Core Shell and Core Tunnel have AppleScript support, you can automate tasks and improve productivity with only a teaspoonful of programming knowledge.
The AppleScript dictionary contains the available AppleScript commands for Core Shell and Core Tunnel. To view the dictionary:
- Open the AppleScript Editor in Applications > Utilities.
- Choose File > Open Dictionary.
- Select Core Shell or Core Tunnel. Click Choose.
Examples
Core Shell
Version 2.2 or later:
SSH Terminal Profile
tell application "Core Shell"
set myProfile to create ssh profile with name "SSH Profile Created via ApplesScript" user "mylogin" address "localhost" options {IdentityFile:"~/.ssh/my_new_id_rsa", ExitOnForwardFailure:"no"} tags {"applescript", "this-mac"}
set mysterWin to open shell on myProfile with in new tab
tell mysterWin
get history of its terminal
repeat until result contains "Connected"
delay 1
get history of its terminal
end repeat
do script "ls" in mysterWin
end tell
-- close mysterWin
end tell
Local Terminal Profile
tell application "Core Shell"
set myProfile to create local profile with name "Local Profile Created via ApplesScript" run command "/bin/bash" working directory "~/workspace/projects/CoreSSH" tags {"applescript", "bash"}
set mysterWin to open shell on myProfile with in new tab
tell mysterWin
do script "ls" in mysterWin
end tell
-- close mysterWin
end tell
Version 1.7 ~ 2.0:
tell application "Core Shell"
set myHost to create host with name "Host Created via ApplesScript" user "mylogin" address "localhost" options {IdentityFile:"~/.ssh/my_new_id_rsa", ExitOnForwardFailure:"no"} tags {"applescript", "this-mac"}
set mysterWin to open shell on myHost with in new tab
tell mysterWin
get history of its terminal
repeat until result contains "Connected"
delay 1
get history of its terminal
end repeat
do script "ls" in mysterWin
end tell
-- close mysterWin
end tell
Core Tunnel
Version 1.6 or later is required.
tell application "Core Tunnel"
script Helper
on waitUnitlConnected(theTunnel)
get state of theTunnel
repeat until result = "Connected"
delay 1
get state of theTunnel
end repeat
end waitUnitlConnected
end script
set mysterTunnel to a reference to (first tunnel where name = "A Mysterious Tunnel")
connect mysterTunnel
tell Helper to waitUnitlConnected(mysterTunnel)
-- disconnect mysterTunnel
-- connect "A Mysterious Tunnel"
-- disconnect "A Mysterious Tunnel"
-- connect with tag "tag_name"
-- disconnect with tag "tag_name"
-- connect all
-- disconnect all
end tell