Skip to content

Instantly share code, notes, and snippets.

@patrickwelker
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save patrickwelker/64ed979290c8ea36530d to your computer and use it in GitHub Desktop.

Select an option

Save patrickwelker/64ed979290c8ea36530d to your computer and use it in GitHub Desktop.
Podcasting Scripts
on run
# Disable Notification Center
#do shell script "launchctl load /System/Library/LaunchAgents/com.apple.notificationcenterui.plist" # Depracted in Yosemite
tell application "System Events"
option key down
delay 0.2
try
click menu bar item "Notification Center" of menu bar 2 of application process "SystemUIServer"
end try
option key up
end tell
# Quit Dropbox
tell application "Dropbox" to quit
# Quit Tweetbot
tell application "Tweetbot" to quit
# Turn off Caffeine
tell application "Caffeine"
if not active then
turn on
end if
end tell
# Turn off Function Keys (to avoid messing with the Skype level)
set FunctionKey to "defaults read \"Apple Global Domain\" com.apple.keyboard.fnState"
set FunctionKeyStatus to do shell script FunctionKey
repeat 3 times
--display dialog "Please enter your name:" default answer ""
--set FunctionKeyStatus to text returned of result
set FunctionKeyStatus to do shell script FunctionKey
tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events" to tell process "System Preferences"
click checkbox 1 of tab group 1 of window 1
end tell
quit application "System Preferences"
if FunctionKeyStatus = "0" then exit repeat
end repeat
if FunctionKeyStatus = "1" then
do shell script "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title '⚠️ Failure!' -message 'Disabling Function Keys did`t work!' -sender com.peterborgapps.LingonX2"
else if FunctionKeyStatus = "0" then
do shell script "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title '📡 Ready to Podcast!' -message 'Function Keys disabled!' -sender com.rogueamoeba.AudioHijackPro2 -activate com.rogueamoeba.AudioHijackPro2"
--error number -128
end if
# Start Recording Session
tell application "Audio Hijack Pro"
launch
activate
# Variables for session names
set trackMic to the first session whose name is "☲ MIC ☲" -- routed IN 2 to CH. 3 via TotalMix Loopback
set trackSkype to the first session whose name is "☲ Skype ☲" -- on default CH 1/2
set trackFX to the first session whose name is "☲ FX ☲" -- routed IN 5/6 to CH. 1/2 via TotalMix Loopback
# Start Hijacking
start hijacking trackMic
start hijacking trackSkype
start hijacking trackFX
delay 3
# Start Recording
start recording trackMic
start recording trackSkype
start recording trackFX
-- tell trackMic to start recording
-- tell trackSkype to start recording
end tell
end run
on run
# Disable Notification Center
tell application "System Events"
option key down
delay 0.2
try
click menu bar item "NotificationCenter, Do Not Disturb enabled" of menu bar 2 of application process "SystemUIServer"
end try
option key up
end tell
# Launch Dropbox
tell application "Dropbox" to launch
#Turn of Caffeine
tell application "Caffeine" to quit
# Turn on Function Keys
set FunctionKey to "defaults read \"Apple Global Domain\" com.apple.keyboard.fnState"
set FunctionKeyStatus to do shell script FunctionKey
repeat 3 times
set FunctionKeyStatus to do shell script FunctionKey
tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events" to tell process "System Preferences"
click checkbox 1 of tab group 1 of window 1
end tell
quit application "System Preferences"
if FunctionKeyStatus = "1" then exit repeat
end repeat
if FunctionKeyStatus = "1" then
do shell script "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title '✅ Okay!' -message 'Everything is back to normal!' -sender com.manytricks.KeyCodes"
else if FunctionKeyStatus = "0" then
do shell script "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title '⚠️ Failure!' -message 'Function Keys still active!' -sender com.peterborgapps.LingonX2"
--error number -128
end if
# Stop Recording Session
tell application "Audio Hijack Pro"
activate
# Variables for session names
set trackMic to the first session whose name is "☲ MIC ☲" -- routed IN 2 to CH. 3 via TotalMix Loopback
set trackSkype to the first session whose name is "☲ Skype ☲" -- on default CH 1/2
set trackFX to the first session whose name is "☲ FX ☲" -- routed IN 5/6 to CH. 1/2 via TotalMix Loopback
# Start Hijacking
stop hijacking trackMic
--stop hijacking trackSkype
stop hijacking trackFX
end tell
end run
@Zettt
Copy link

Zettt commented Sep 18, 2014

Fix for Notification Center on Yosemite:

# Disable Notification Center
tell application "System Events"
    option key down
    delay 0.1

    try
        click menu bar item "Notification Center" of menu bar 2 of application process "SystemUIServer"
    end try
    try
        click menu bar item "NotificationCenter, Do Not Disturb enabled" of menu bar 2 of application process "SystemUIServer"
    end try

    option key up
end tell

@patrickwelker
Copy link
Author

@Zettt Great. Had to increase the delay to 0.2 on my old Mac -_-*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment