Skip to content

Instantly share code, notes, and snippets.

@MLKrisJohnson
Created November 27, 2019 19:35
Show Gist options
  • Save MLKrisJohnson/d13b0652d95300b0685207b7ecb3dfae to your computer and use it in GitHub Desktop.
Save MLKrisJohnson/d13b0652d95300b0685207b7ecb3dfae to your computer and use it in GitHub Desktop.
AppleScript that directs Terminal to tail a log file and apply a filter to it.
-- Opens a new terminal window displaying MobileLabs.DeviceConnect.Services.log
-- Relies on these definitions in ~/.bashrc:
--
-- alias filter-mllog='sed -e '\''s/MobileLabs/ML/g'\'' -e '\''s/DeviceConnect/DC/g'\'' -e '\''s/AirStream/AS/g'\'' -e '\''s/Gateway/Gw/g'\'' -e '\''s/Services/Sv/g'\'' -e '\''s/Framework/Fw/g'\'
-- alias tail-services='tail -F /Users/kris/.dcdata/Logs/MobileLabs.DeviceConnect.Services.log | filter-mllog'
tell application "Terminal"
set newTab to (do script "tail-services")
tell newTab
set custom title to "Services Log"
end tell
-- TODO: We should really find the window that contains newTab, but it's easy to just assume it's now "window 1"
tell window 1
set position to {0, 20}
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment