16/07/12

Permalink 10:59:20 pm, Categories: Software, OSX  

iTunes new unplayed playlist

Hell, why not. Every other blog on the interwebs has these silly little 'tips'.

So, I recently purchased a bunch of CDs and added them to iTunes. Now, how to listen to them all?

I'm a shuffle kind of person, so I use the "Recently Added" smart playlist. However, it does repeat, which is no good. So, what to do?

Pretty simple really. Duplicate the "Recently Added" playlist (right click, and select duplicate). Then edit it (right click and select edit), and add a new criteria (click the + button, moron), and select the criterion "Plays" and is and 0. Make sure "Live updating" is checked (it should be, unless you've been stuffing around with the default settings in iTunes).

The effect of this is that your recently added, non podcast (that's the default) media, that you have not played will be on this list. So, in theory it should shuffle through, removing items as they are played. Or not. iTunes does some counter intuitive shit.

Permalink 10:40:45 pm, Categories: Mac OS X  

Command line to show installed office 2004 version

This is not fool proof, but seems to work pretty well:

ls -1rt /Applications/Microsoft\ Office\ 2004/Updater\ Logs/ | tail -n1

It will give output like:
11.6.2 Update Log.txt

it just gives you the newest file/folder in the Updater Logs

Permalink 10:39:57 pm, Categories: Mac OS X  

Get application version from command line

This works with many applications. Most applications are .app bundles, and have an Info.plist with the version number. You can pull this out directly with PlistBuddy (if you know the key name).

With some apps, you need to know also where to look.

/usr/libexec/PlistBuddy -c "Print CFBundleVersion" /Applications/Microsoft\ Office\ 2008/Office/MicrosoftComponentPlugin.framework/Resources/Info.plist

Handy, if you want to do a bulk update, but want to know which packages to install first, or which computers need updating.

Permalink 10:33:36 pm, Categories: Mac OS X  

ASR multicast restore

Full article here

You do this from terminal. So you can do it from at least 10.4+ install media.

You will need an image (dmg) ready, and accessible from the computer running asr. First prepare the image with:

asr -imagescan image.dmg

For unicast, you can now chuck the image on a share and run:
asr -source afp://fileserver.example.com/image.dmg -target /Volumes/MacintoshHD -erase

The tricky bit:
You need to create a plist config file. It needs bugger all inside it, but is a necessary step.

Two keys are required—Data Rate and Multicast Address—but additional keys are supported to specify functionality. You can create it in property list editor, or just fire up pico and make sure you create all the necessary headers by hand.
It should look something like:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Data Rate</key>
        <integer>600000</integer>
        <key>Multicast Address</key>
        <string>224.77.2.121</string>
</dict>
</plist>

Now you have created the plist, you can start your asr multicast server

asr -source multicastimage.dmg -server configuration.plist

And from the client computers, you can join the multicast with:

asr -source asr://myserver.com -target /Volumes/MacintoshHD -erase

The rest of the article discusses sensible network considerations (multicast traffic is something which needs to be managed carefully), and GUI front ends (what's the point? ;) )

Permalink 10:29:51 pm, Categories: Mac OS X  

Logout user via terminal

Yes, sometimes you need to log people out (tidily), and sometimes you don't have access to their screen. This is a one liner that does it.

/bin/launchctl bsexec $(ps -xawwo pid,command | grep "/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder$" | awk '{print $1}') /usr/bin/osascript -e 'tell application "System Events" to log out';

Taking it apart, we are using bsexec option of launchctl to execute the osascript in the same "Mach bootstrap namespace hierarchy" as Finder. The whole middle bit (the bit in $(...)) is just doing a ps, grepping out the Finder process, and then awking the pid for the Finder process. What if there are multiple users with Finder processes? Then it breaks. But really, how often does that happen.

Please don't ask me what a "Mach bootstrap namespace hierarchy" is. The basic idea, is that if you just try to the osascript to log out, the osascript won't reach "System Events" (which belongs to Finder), and it doesn't work.

Now, the quick and dirty way to do this is to kill the loginwindow process. But that doesn't prompt users to save work, or close out apps properly or any of the other house keeping that actually Logging Out is meant to do.

Also, using AppleScript (via the terminal's open scripting architecture support) to quit Applications is handy:

osascript -e 'tell application "Microsoft Outlook" to quit';
osascript -e 'tell application "FireFox" to quit';

:: Next Page >>

September 2017
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  

All My Bloggings

All Blog entries in one convenient location.

Are we getting close?

Search

XML Feeds

What is this?

powered by b2evolution free blog software