Launching Traktor & Maschine, turn off Wi-Fi, close all Apps, all with a keyboard shortcut.

*Updated* The other day I was reading an article on DJ Tech Tools called “DIY Autosave in Traktor”. It talked about setting up a keyboard shortcut and using a third party app called ‘QuickKeys’ in order to autosave your collection and a few of your settings. Great article, so go read it if you haven’t read it yet.

Since it’s almost 2013 and I get lazier (or smarter) as I age I decided to automate the difficult task of opening up my Traktor and Maschine software while closing all other applications and turning WIFI off, all mapped out to a keyboard shortcut. The beauty of DJTT’s article is that it uses an application that works for both Windows and Mac OS X. Again, I am lazy so you will get the non third party Mac only tutorial.

Automator Chooser

First thing we need to do is open up “Automator” located in your Applications/Utlities/ Folder. Choose ‘Service’ for the type of document we are creating. We chose service instead of an application so we can give it a keyboard shortcut later. Since we are not sending any inputs to our service application change the ‘Service receives selected’ ‘text’ to ‘no input’ in ‘any application’.

On the left hand side in your Library under Actions, click on ‘Utilities’, then drag the ‘Run Applescript’ action to the right. In this new window you are going to copy and paste the code below to be able to turn WIFI off.

1
2
3
4
5
6
7
property airportUtil : "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I"
set res to do shell script airportUtil & " -p || exit 0"
if res contains "on" then
-- Toggle Airport off
do shell script "networksetup -setairportpower en1 off 2>/dev/null"
set apStatus to false
end if

Automator Workflow 1Next step is to go in your Library under Actions, click on ‘Utilities’ then drag ‘Quit All Applications’ to the right side. I left the ‘Ask to save changes’ ticked in case I was currently working on something important and needed to save the file. I always run the Activity Monitor (located in Applications/Utilities) to keep an eye on my Memory levels. So if you have any applications that you would like to keep open, this is the place to add them. Click ‘Add’, find the application you would like to keep open and add it to the list.
Now we open up Traktor. We need to first select the Application and then launch it. So on the left in your Library click on ‘Files & Folders’ and then drag ‘Get Specified Finder Items’ action to under the ‘Quit All Applications’ action. Click ‘Add’ and find the Traktor app in your Applications folder. Next step is to launch the application we just selected. Under ‘Files & Folders’ drag the ‘Open Finder Items’ action to right under the recent action we created. Make sure that the ‘Open with:’ option is set to ‘Default Application’.

Automator Workflow 2Next thing I did was to add a pause, just to wait a few seconds before trying to launch the Maschine software. I wanted to make sure that Traktor was completely loaded before trying to start up Maschine. So in Automator in your Library, click on ‘Utilities’ and drag the ‘Pause’ action to the right, right under our ‘Open Finder Items’ action. I then set it to 15 seconds.

Now we need to select and launch the Maschine software. In you library under ‘Files & Folders’ drag the ‘Get Specified Finder Items’ action to our list on the right. Click ‘Add’ and find the Maschine app in your Applications folder.  Under ‘Files & Folders’ drag the ‘Open Finder Items’ action to right under the recent action we created. Make sure that the ‘Open with:’ option is set to ‘Default Application’.

Automator Workflow 3We then added another Pause to make sure everything is loaded and then switch views from the Maschine to Traktor. Click on ‘Utilities’ and drag the ‘Pause’ action to the right, I set it to 15 seconds again. From the same ‘Utilities’ folder in your library drag the ‘Run AppleScript’ to the right, underneath everything else we have done. Copy and paste the code below:

1
2
3
4
5
6
on run {input, parameters}
tell application "Traktor"
activate
end tell
return input
end run

You can test the code by clicking on ‘Run’. If everything works correctly, then all that is left is to save. I gave it a name of ‘Open Trakshine’ to easily identify the service when we go in and add a keyboard shortcut to activate it. Once everything is saved, close the Automator App.

System Preferences Keyboard ShortcutOpen “System Preferences” and click on ‘Keyboard’. Then click on ‘Keyboard Shortcuts’ if it’s not already highlighted near the top of the window. On the left hand side click on ‘Services’. On the right side, scroll down to where you see ‘General’. You should see the service we created above, I called mine ‘Open Trakshine’. Click on it, and you should see a button that says ‘add shortcut’ where it used to say ‘none‘. Once you click on the button a text box will appear in its place. That is when you hit the key combinations you want to hit on your keyboard in order to launch our Automator workflow we created. I chose control+option+command+t’ to launch everything. I chose something that wasn’t already in use in another program. For example I originally chose control+option+command+1 but when I am in the finder it managed to sort my folders on my desktop.

That is it. This is a good way to get into DJ position as quickly as possible. Get all set up without forgetting that you left some other program open. I don’t ever use my Bluetooth but it’s good practice to turn that off too. I saw something called blueutil where you install and run some command lines to toggle bluetooth on/off. You can probably run the code by adding a ‘Run a Shell Script’ action. If anyone needs a tutorial on how to make that happen hit me up on the comments. I hope you all enjoyed if you have any questions, comments…  Do you guys use automator for anything?

Like my Facebook Page: Rob Cifre aka Bamboo
Like my crew: Swing Kids
Like my Agency: Agency Sounds

Free music on my Bamboo Podcast on iTunes Subscribe today!

UPDATE some of you have been asking for a way to ‘exit out of DJ Mode’ by turning on WiFi quitting Traktor and also saving and quitting Maschine.

This is really simple and quick. Open the “Automator” app and choose a new ‘Service’. Change the ‘text’ to ‘no input’. Drag the ‘Run AppleScript’ action from ‘Utilities’ and paste this code in the box:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
on run {input, parameters}
tell application "Traktor"
activate
end tell
tell application "System Events"
key down {command}
keystroke "q"
key up {command}
end tell
tell application "Maschine"
activate
end tell
tell application "System Events"
key down {command}
keystroke "s"
keystroke "q"
key up {command}
end tell
return input
end run

Now we need to turn the WiFi back on, so drag another  ‘Run AppleScript’ action from ‘Utilities’ and paste this code in the box:

1
2
3
4
5
6
7
8
9
property airportUtil : "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I"

set res to do shell script airportUtil & " -p || exit 0"

if res contains "off" then
-- Toggle Airport on
do shell script "networksetup -setairportpower en1 on 2>/dev/null"
set apStatus to true
end if

Save the file, and close “Automator”. Open “System Preferences” and click on ‘Keyboard’. Then click on ‘Keyboard Shortcuts’. On the left hand side click on ‘Services’. On the right side, scroll down to where you see ‘General’. You should see the service we created above, I called mine ‘Close Trakshine’. Click on it, and you should see a button that says ‘add shortcut’ where it used to say ‘none‘. Once you click on the button a text box will appear in its place. That is when you hit the key combinations you want to hit on your keyboard in order to launch our Automator workflow we created. I chose control+option+command+x’ to close everything.

Thanks I hope this helps you all! Please share this if you enjoyed being slightly more efficient.

Leave a Reply