Murphy Mac - Screencasts and Tutorials » Posts in 'Intermediate' category

Hide Everything

desktopEver want to hide ALL your applications and start with a clear, swept off desktop on your Mac? Yeah, there’s Exposé, but that’s not the same as what we’ll see here. When you show your desktop via Exposé you’re not changing the state of your applications to hidden – so as soon as you switch to an application the others will all be visible too.
If you’ve used Windows you may have used the Show Desktop icon in the taskbar to minimize all windows. We’re not going to minimize, we’re going to hide. But the end effect is the same. You’re looking at your desktop with nothing in your way.
How do we do this? A very short and simple Applescript. With one small concession.
If you’ve ever tried to hide ALL your applications you probably know what our obstacle is.

Try this: Switch to Finder and hit Command-Option-H. That hides all applications except Finder. Once they're hidden try hitting Command-H to hide the Finder itself. It doesn't work.

So here’s a workaround that’s acceptable to me: Our Applescript will hide the windows of all applications except the Finder. Then it will CLOSE all the Finder windows. The end result is a clean desktop with application windows that stay out of sight until you summon them back into view.
Optionally, you could include the 3 lines of the script after the line “Close every window” (commented out with dashes in the image below) to open up a single Finder window to a specified folder and use that as your starting point.

script

Once you’ve created the script you need a way to kick it off. I use TextExpander for a lot of these things. TexExpander is a fantastic text replacement utility that can also run Applescripts when you type certain characters. For example, Murphy might type dsktp or ddesk to make TextExpander run our script and display the clean desktop. There’s a lot more to TextExpander than running Applescripts, but I find it very handy in that capacity. Instead of memorizing somewhat arbitrary key combinations you can make up a code – so your shortcuts are more like keywords with meaning than shortcuts that generally only carry one letter. Murphy covered TexExpander here.
As an alternate check out FastScripts from Red Sweater Software. FastScripts lets you assign a script to a keyboard shortcut. And it has powerful features for helping you manage your script library. If you’re a heavy Applescripter you probably already know about it. If not, take a look at the features.

| Permalink

View Airport Express Connections via Command Line

airport expressThese days I need two Airports to cover the house.   There’s an Airport Extreme and an Airport Express that’s wired via Ethernet to extend the network.   The Express was acting a little flaky and I wanted to know if anyone was connecting to it.  (check out Glenn Fleishman’s e-book for in-depth info on optimizing your Apple wireless network.)

One option is using the Airport Utility to see connections to your Apple wireless access points.  But that’s a lot of clicks, and you can’t easily check it from your iPhone or iPad.   Here’s an alternative:  Use an SNMP command to see what’s going on with your Airport Express.

Murphy found a suitable command on Polydistortion.net, shown below:

snmpget -v 2c -c PASSWORD -M /usr/share/snmp/mibs:$HOME/share/mibs \
-m+AIRPORT-BASESTATION-3-MIB MyAirportExpress.local AIRPORT-BASESTATION-3-MIB::wirelessNumber.0

You can delete that backslash at the end of the top line and enter it all as one line in Terminal.  You also want to enter your router’s password in place of password, and your router’s name in place of MyAirportExpress.   Don’t get confused and enter your wifi password or the name of your wireless network.  It’s the name of the router you’re looking for and the administrative password.

When you enter that in Terminal you should get a response that looks something like this:

AIRPORT-BASESTATION-3-MIB::wirelessNumber.0 = INTEGER: 0

The last number represents the number of clients connected to that Airport.  In this case there aren’t any.
I tried using the same command to query my Airport Extreme and had no luck.  I saw reports of people having trouble with SNMP once the last Airport firmware update hit.   Let me know if you have a solution.
The Terminal command was a more direct way for me to get the information I was looking for.  Using an app like TouchTerm SSH I can get the answer from my phone or iPad as well.
Take a look at the brief screencast.  First it quickly demonstrates how many clicks Airport Utility requires to get the information.  Then it shows the Terminal command being executed.
The command is really long.  You could create an alias and save it in your .profile file so it would always be available in your Terminal.  That way you could enter something like “aeusers” in the Terminal instead of the long command.  See Murphy’s post on alias creation for more information.
The page where Murphy found the command for querying the Airport had other commands as well. SNMP (Simple Network Monitoring Protocol) is a cross-platform protocol that’s been around forever – you can do plenty with it. The Airport can also report its information via Syslog, but that’ll have to wait for another day.
Screencast | Permalink

VLC for iOS Update Plays EyeTV Recordings

packageWith one little step – instead of re-encoding – you can drop your EyeTV recordings onto your iPad, iPhone, or iPod touch.

When the first VLC Media Player (itunes link) app for iPad came out I tried dropping an EyeTV recording into it – including the container file. No dice – the file wasn’t recognized. I tried an EyeTV container with the new release of VLC for iPad too – but it still wasn’t recognized. But right-clicking on the container and showing its contents allowed me to copy the mpg file residing within onto the iPad. VLC for iPad recognized the mpg and played it. The initial release didn’t work for the EyeTV mpg either.

The .eyetv file is much larger than what you’d get if you encoded it for your i-device. But for a video I plan to watch once and delete I’m happy to skip the encoding.

The VLC app doesn’t use the standard playback components provided in iOS APIs – like the player you’d see in an app such as Dropbox. For example, my Bluetooth keyboard playback controls don’t work in VLC for iPad.

Playback isn’t as tight as m4v files I’ve played back using Dropbox and other apps, but it’s not terrible either. Definitely not as clear as playing back an .eyetv file on my Mac – but again – that’s ok, there’s some value in getting a video onto my iOS device without encoding it – sometimes it’s worth the tradeoff.

That said, I just loaded a short scene from an action movie, recorded in standard definition, to my iPhone 4.  Playback was a bit pixelated.

VLC for iOS does keep track of where you left off watching a video. And it’s free.  The VLC Media Player is nice to have for times when encoding isn’t otherwise necessary.

Murphy Uses Bluehost | Permalink

Reboot or Sleep a Mac from your iPhone

Sometimes Murphy is just a little too lazy to go upstairs and reboot a Mac that needs rebooting. With an iPhone or iPod touch you don’t need to leave the sofa.

Today, Murphy was watching tv on the iPhone via EyeTV’s iPhone app. It started to lock up so a reboot seemed like a good idea. Murphy has Touch Term installed on the iPhone. And the Mac is set to accept SSH sessions. One tap to connect and one command to start the reboot was all it took. Here’s what you need:

  • First, go to Sharing in your System Preferences. Turn on Remote Login. This allows your Mac to allow incoming SSH sessions.
  • On your iPhone install Touch Term, or some other SSH client. Murphy remembers getting Touch Term for free, but now it starts at $3.99. You might want to comparison shop for similar products.
  • Next, configure Touch Term to connect to your Mac, either by name or ip address.
  • Once you’ve connected just type the command to reboot your Mac, and press Return. Here’s the command:    sudo shutdown -r now

Murphy took the extra step of creating a shell script to run that command, so there’s less to type when it’s time to reboot.  That’s all there is to it.

You might want a command to send your Mac to sleep instead of rebooting it.  This command should accomplish that:   osascript -e 'tell application "System Events" to sleep'

Of course, you can always try something completely different.  A long time ago Murphy wrote some posts about using the Mail app on a Mac to trigger events.  Murphy has Applescripts on the Mac that do different things when emails come in with certain characteristics.  Scripts that adjust iTunes, retrieve files, or put the Mac to sleep.  The whole thing was based on a post here.

Some of these scripts had issues with different updates to OS X and changes to Mail.  Your results may vary…

I haven’t looked into other ways to reboot my Mac from the iPhone, so if you’ve got a good way let me know.

As always, be careful when using the Terminal.

| Permalink

Find Duplicate Files with Tidy Up

Tidy Up
Murphy has built up a ton of duplicate files over the years.  All kinds of stuff, some files with the same file name, some with different file names.  Many of the files are half-baked backups thrown onto external drives in haste.  Some are just the result of poor housekeeping.

I’ve used various tools to get the mess under control.  Later we’ll be looking at a tool called CD Finder that despite its name can be very helpful in cataloging an unruly collection of disks and drives.  We’ll be looking at the diff command too – which is already on your Mac.  But first let’s take a look at Tidy Up, an extremely helpful tool for finding duplicate files and deleting them.

Tidy Up can look beyond the filename to determine if files are duplicates or not.  In the screencast Murphy uses Tidy Up to look at file content and size.  There are many other criteria sets the application can use to evaluate files.

Tidy Up can also dig into iPhoto and iTunes databases in search of duplicates.  Mail mailboxes too.  Information about deleted files is then synced back to the applications.  We’ll look at these features in another screencast.

One feature Murphy really likes:  The ability to keep a single copy from a duplicate grouping.  Tidy Up groups identical files together in its search results.  The application will display all but a single file from each group, allowing you to delete all the extras at once.

Tidy Up can also restore content you’ve deleted to its original location, as long as you haven’t emptied the trash.

You can use Tidy Up to scan multiple drives at once or just a folder that you suspect has duplicates.  It’s probably best to experiment a little before deleting anything – to ensure you’re getting the results you expect.

Watch Now | Permalink