画面写真は英語のインターフェイスを使用しています。図はガイドの言語に切り替わります。アプリの表示言語によって、コントロール名が異なる場合があります。
AppleScript — コマンドリファレンス
Mac アプリの「自動化」と同じコマンド解説とコピー可能な例を掲載しています。既存のコマンドと 2.0.17 で追加された内容を含みます。

各コマンドの解説と完全なスクリプト例を、Mac アプリ内蔵の資料から同期しています。実行前にサンプル名と ID を置き換えてください。実際の接続や設定を変更する例もあるため、ページ全体を一度に実行しないでください。
コマンドリファレンス
ここに示すコマンド句を使います。接続名またはグループタグは引用符で囲みます。
start
ウインドウを表示せずに Secure Pipes を起動します。
tell application "Secure Pipes" to start
show
Secure Pipes のウインドウを表示します。
tell application "Secure Pipes" to show
hide
ウインドウを隠し、Secure Pipes と接続は実行したままにします。
tell application "Secure Pipes" to hide
shutdown
Secure Pipes を終了し、実行中の接続を停止します。
tell application "Secure Pipes" to shutdown
list connections
保存済みの接続を一覧表示します。
tell application "Secure Pipes" to list connections
list connection groups
接続グループとして使われているタグを表示します。
tell application "Secure Pipes" to list connection groups
connect connection "Build Tunnel (Local Forward)"
保存済みの接続を開始します。
tell application "Secure Pipes" to connect connection "Build Tunnel (Local Forward)"
disconnect connection "Build Tunnel (Local Forward)"
保存済みの接続を停止します。
tell application "Secure Pipes" to disconnect connection "Build Tunnel (Local Forward)"
connection status "Build Tunnel (Local Forward)"
接続の現在の状態を取得します。
tell application "Secure Pipes" to connection status "Build Tunnel (Local Forward)"
connect group "engineering"
保存済みの起動設定でグループを開始します。
tell application "Secure Pipes" to connect group "engineering"
disconnect group "engineering"
グループとメンバーの接続を停止します。
tell application "Secure Pipes" to disconnect group "engineering"
スクリプトでは接続 UUID を使うと、名前を変更しても動作します。一意の名前や種類を含む完全な名前も使えます。同名の接続には UUID を指定してください。
リモートデスクトップ
list remote desktops
保存済みの RDP/VNC 接続を一覧表示します。
tell application "Secure Pipes" to list remote desktops
get remote desktop "<ID>"
ID で接続を読み取ります。認証情報は返しません。
tell application "Secure Pipes" to get remote desktop "DESKTOP-ID"
create remote desktop <JSON>
name と values で接続を作成します。プリセットホストには hostProfileUUID を指定します。
tell application "Secure Pipes" to create remote desktop "{\"name\":\"Office desktop\",\"values\":{\"hostProfileUUID\":\"PRESET-HOST-ID\",\"remoteDesktopType\":\"rdp\",\"remoteDesktopUsername\":\"alice\",\"remoteHost\":\"192.168.1.91\"}}"
tell application "Secure Pipes" to create remote desktop "{\"name\":\"Office VNC\",\"values\":{\"hostProfileUUID\":\"PRESET-HOST-ID\",\"remoteDesktopType\":\"vnc\",\"remoteDesktopVNCOpenMode\":\"screenSharing\"}}"
update remote desktop <JSON>
id で更新します。name と values は省略できます。
tell application "Secure Pipes" to update remote desktop "{\"id\":\"DESKTOP-ID\",\"values\":{\"remoteDesktopOptions\":{\"screen mode id\":1,\"audiomode\":2}}}"
open remote desktop "<ID>"
必要に応じて SSH トンネルを開始してから、設定済みの RDP/VNC クライアントを開きます。
tell application "Secure Pipes" to open remote desktop "DESKTOP-ID"
delete remote desktop "<ID>"
ID で切断済みの接続を削除します。
tell application "Secure Pipes" to delete remote desktop "DESKTOP-ID"
ユーザー名は書き込めますが、保存済みのユーザー名は返しません。SSH パスワードと認証用ファイルは Secure Pipes で設定し、デスクトップのパスワードはクライアントで入力してください。
タスク計画
予約操作を作成・管理します。読み取りでパスワードや秘密鍵の内容は返しません。
list task plans
機密情報を除いた JSON で計画を一覧表示します。
tell application "Secure Pipes" to list task plans
get task plan "work-start"
ID で機密情報を除いた計画 JSON を読み取ります。
tell application "Secure Pipes" to get task plan "work-start"
create task plan <JSON>
検証済み計画を作成します。操作には接続/グループ ID を使い、認証情報を含めません。
tell application "Secure Pipes"
create task plan "{\"id\":\"work-start\",\"hour\":9,\"minute\":0,\"repeat\":2,\"actions\":[{\"type\":\"start_group\",\"id\":\"work\"}]}"
end tell
update task plan <JSON>
既存 ID と変更するフィールドで計画を更新します。
tell application "Secure Pipes"
update task plan "{\"id\":\"work-start\",\"hour\":8,\"minute\":45,\"repeat\":2,\"actions\":[{\"type\":\"start_group\",\"id\":\"work\"}]}"
end tell
set task plan enabled "work-start"
時刻設定を変えずに有効/無効にします。パラメーターは既定で true です。
tell application "Secure Pipes" to set task plan enabled "work-start" enabled false
tell application "Secure Pipes" to set task plan enabled "work-start" enabled true
run task plan "work-start"
保存済み計画を即時実行し JSON 結果を返します。
tell application "Secure Pipes" to run task plan "work-start"
delete task plan "work-start"
ID で保存済み計画を削除します。
tell application "Secure Pipes" to delete task plan "work-start"
JSON は repeat 0–6、指定曜日、ISO 8601 または YYYY-MM-DD の期間と検証済み操作をサポートします。先に list connections と list connection groups で ID を取得してください。
ルールと利用シナリオ
ルールの変更やシナリオの切り替えには、ID または一意の名前を使用します。切り替え時には接続中のセッションを切断し、再接続します。シナリオを削除してもルールは残り、ほかのシナリオに属さないルールは共通ルールになります。
list proxy rules
ルールを順番に、ID、名前、有効状態、動作、シナリオ ID とともに一覧表示します。
tell application "Secure Pipes" to list proxy rules
list scenarios
共通シナリオを含むシナリオの ID、名前、使用状態を一覧表示します。
tell application "Secure Pipes" to list scenarios
current scenario
現在使用中のシナリオ名を表示します。
tell application "Secure Pipes" to current scenario
switch scenario "Office"
ID または一意の名前でシナリオを切り替え、影響を受ける接続を選択したルールで再接続します。
tell application "Secure Pipes" to switch scenario "Office"
enable proxy rule "Work websites"
ID または一意の名前でルールを有効にします。
tell application "Secure Pipes" to enable proxy rule "Work websites"
disable proxy rule "Work websites"
ルールを削除せずに無効にします。
tell application "Secure Pipes" to disable proxy rule "Work websites"
set rule scenarios "Work websites" scenarios {"Office", "Travel"}
ルールのシナリオ割り当てを置き換えます。Universal を指定すると共通ルールになります。
tell application "Secure Pipes" to set rule scenarios "Work websites" scenarios {"Office", "Travel"}
create scenario "Travel"
一意の名前でシナリオを作成し、ID を返します。
tell application "Secure Pipes" to create scenario "Travel"
rename scenario "Travel" to "Mobile work"
ルールの割り当てを保持したままシナリオ名を変更します。
tell application "Secure Pipes" to rename scenario "Travel" to "Mobile work"
delete scenario "Travel"
ルールを残してシナリオを削除します。他のシナリオに属さないルールは共通ルールになります。
tell application "Secure Pipes" to delete scenario "Travel"
一連の操作例
tell application "Secure Pipes"
set savedRules to list proxy rules
set savedScenarios to list scenarios
set selectedScenario to current scenario
switch scenario "Office"
enable proxy rule "Work websites"
disable proxy rule "Work websites"
set rule scenarios "Work websites" scenarios {"Office", "Travel"}
set rule scenarios "Work websites" scenarios {}
set newScenarioID to create scenario "Travel"
rename scenario newScenarioID to "Mobile work"
delete scenario newScenarioID
end tell
プロキシとネットワーク共有
共有には保存済みのアドレス、ポート、認証設定を使用します。必要に応じて確認ウィンドウが開きます。ゲートウェイモードではリスクの確認と macOS の承認が必要です。
list proxy servers
設定済みプロキシサーバーの ID、名前、種類、接続先を一覧表示します。認証情報は含みません。
tell application "Secure Pipes" to list proxy servers
transparent proxy status
透過プロキシの実行状態、システム拡張の状態、バージョンの一致状況を表示します。
tell application "Secure Pipes" to transparent proxy status
initialize transparent proxy
システム拡張をインストールまたは修復します。macOS の承認が必要な場合があります。透過プロキシは起動しません。
tell application "Secure Pipes" to initialize transparent proxy
start transparent proxy
システム拡張の準備が整ったら、現在のルーティングルールで透過プロキシを起動します。
tell application "Secure Pipes" to start transparent proxy
stop transparent proxy
透過プロキシを停止します。ネットワーク共有はこのサービスに依存します。
tell application "Secure Pipes" to stop transparent proxy
network sharing status
共有とゲートウェイの状態を表示します。実行中は有効なモード、停止中は保存済みのモードを示します。
tell application "Secure Pipes" to network sharing status
set sharing modes "both"
次回の手動起動でプロキシ、ゲートウェイ、両方、またはオフを選択します。変更前に共有を停止してください。
tell application "Secure Pipes" to set sharing modes "both"
start network sharing
選択したモードと保存済みのアドレス、ポート、認証設定で共有を開始します。確認が必要な場合があります。
tell application "Secure Pipes" to start network sharing
stop network sharing
ゲートウェイと共有プロキシのリスナーを停止します。透過プロキシは実行を続けます。
tell application "Secure Pipes" to stop network sharing
一連の操作例
tell application "Secure Pipes"
set servers to list proxy servers
set proxyState to transparent proxy status
initialize transparent proxy
start transparent proxy
set sharing modes "both"
set sharingState to network sharing status
start network sharing
stop network sharing
stop transparent proxy
end tell
接続・アクティビティ・ログ
一覧に表示された ID で正確に参照できます。詳細は JSON テキストで返されます。
group status "engineering"
グループの結果と各メンバーの接続状態を表示します。
tell application "Secure Pipes" to group status "engineering"
wait for connection "Build Tunnel" timeout 30
接続の準備完了を待ちます。失敗やタイムアウト時はエラーになります。
tell application "Secure Pipes" to wait for connection "Build Tunnel" timeout 30
preview route "example.com" port 443
現在のシナリオでのローカルルールの適用を予測します。接続テストではありません。
tell application "Secure Pipes" to preview route "example.com" port 443 application "com.apple.Safari" transport "TCP"
test proxy server "proxy-id"
保存済みプロキシをテストし、結果、理由、所要時間を返します。
tell application "Secure Pipes" to test proxy server "proxy-id"
list active flows "PROXY"
プロキシの通信を表示します。共有は LAN、両方は ALL を指定します。
tell application "Secure Pipes" to list active flows "PROXY"
list active flows "LAN"
ネットワーク共有の接続を表示します。
tell application "Secure Pipes" to list active flows "LAN"
end active flow "flow-id"
ID を指定して接続中のフローを終了します。
tell application "Secure Pipes" to end active flow "flow-id"
list recent logs
機密情報を除いた最近のログを最大 200 件、新しい順に表示します。
tell application "Secure Pipes" to list recent logs
log detail "log-id"
ID を指定して最近のログの詳細を表示します。
tell application "Secure Pipes" to log detail "log-id"
ターミナルでの実行例
ターミナルで osascript を使って AppleScript コマンドを実行します。macOS からターミナルによる Secure Pipes の制御を許可するか確認されることがあります。
接続グループを一覧表示
osascript -e 'tell application "Secure Pipes" to list connection groups'
出力例
engineering, on-call
接続タグでグループのメンバーが決まります。起動時は保存済みの順序、並列・逐次モード、エラー処理設定に従います。
グループを開始または停止
osascript -e 'tell application "Secure Pipes" to connect group "engineering"'
osascript -e 'tell application "Secure Pipes" to disconnect group "engineering"'
接続の確認と操作
osascript -e 'tell application "Secure Pipes" to list connections'
osascript -e 'tell application "Secure Pipes" to connection status "Build Tunnel (Local Forward)"'
osascript -e 'tell application "Secure Pipes" to connect connection "Build Tunnel (Local Forward)"'
ターミナルから実行
ファイルを保存し、そのパスを osascript に渡します。
osascript ~/Scripts/Connect\ Tunnel.applescript
スクリプトファイルから実行
例を .applescript ファイルとして保存し、スクリプトエディタまたは osascript で実行します。
名前で接続
例の接続名を list connections が返す名前に置き換えます。
on run
-- Leave this blank to skip opening a URL after connecting.
set postConnectURL to ""
-- Get the saved connections.
tell application "Secure Pipes"
set availableConnections to list connections
end tell
if (count of availableConnections) is 0 then return
set selectedConnection to choose from list availableConnections
if selectedConnection is false then return
set targetConnection to item 1 of selectedConnection
-- Start the selected connection and wait up to 90 seconds.
tell application "Secure Pipes"
connect connection targetConnection
set currentState to "connecting"
repeat with attempt from 1 to 90
set currentState to connection status targetConnection
if currentState is "connected" then exit repeat
if currentState is "authentication failed" or currentState is "unknown host key" or currentState is "host key changed" or currentState is "invalid" or currentState is "error" then exit repeat
delay 1
end repeat
end tell
-- Open the URL only if the connection comes up.
if currentState is "connected" and postConnectURL is not "" then
open location postConnectURL
end if
return currentState
end run
グループを選んで接続
使用可能なタグを一覧表示し、選択したグループ内の接続を開始します。
on run
-- Get the groups saved in Secure Pipes.
tell application "Secure Pipes"
set availableGroups to list connection groups
end tell
-- Let the user know if there are no groups to choose from.
if (count of availableGroups) is 0 then
display dialog "No tagged connection groups are available." buttons {"OK"}
return
end if
-- Ask which group to start.
set selectedGroup to choose from list availableGroups
if selectedGroup is false then return
set targetGroup to item 1 of selectedGroup
tell application "Secure Pipes"
connect group targetGroup
end tell
end run
オートメーションのアクセス許可
macOS の確認が表示されたら、「システム設定」>「プライバシーとセキュリティ」>「オートメーション」で、ターミナルやスクリプトエディタなど、スクリプトを実行するアプリに Secure Pipes の制御を許可してください。
Secure Pipes 2.0.17 に基づく · 2026 年 11 月 9 日更新