« spctl 設定変更 | トップページ | ダークモード終了 »

manページ書き出し

【スクリプトエディタで開く】


set aliasIconPath to POSIX file "/System/Library/CoreServices/Finder.app/Contents/Resources/Finder.icns" as alias
set theResponse to "COMMAND" as text


try
  
  set objResponse to (display dialog "man XXXXX | col -b > ~/Desktop/XXXXX.txt" with title "入力してください" default answer theResponse buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 10 without hidden answer)
  
on error
  log "エラーしました"
  return "エラーしました"
  error number -128
end try
if true is equal to (gave up of objResponse) then
  return "時間切れですやりなおしてください"
  error number -128
end if
if "OK" is equal to (button returned of objResponse) then
  set theResponse to (text returned of objResponse) as text
else
  log "エラーしました"
  return "エラーしました"
  error number -128
end if

set strCommandText to "man " & theResponse & " | col -b > ~/Desktop/" & theResponse & ".txt"


tell application "Terminal"
  launch
  activate
  set objWindowID to (do script "\n\n")
  delay 2
  do script strCommandText in objWindowID
  delay 1
  set strWindowID to get the id of front window
  close window id strWindowID saving no
end tell


|

« spctl 設定変更 | トップページ | ダークモード終了 »

Terminal」カテゴリの記事