For No One

RSS

Posts tagged with "Apple"

➩ App Store Trials

Amy Worrall:

I’m going to add my voice to those calling for trials of App Store apps. Here’s how I could see it working: Developers can choose whether to allow a trial of 1, 7 or 30 days, or to disallow trials…

I think her plan makes sense, but I have one question/suggestion about this part:

Once a trial is used up, you can’t get a trial of that app again on the same Apple ID.

What about after the app gets an update? Say you try out Photoshop, but it’s missing one feature you desperately crave (automatic LOLcat-style captions, naturally). You want to hold out until they add that feature. Years pass, and they add it, so you want to check their implementation (does the font they chose do your wit justice?). If you can’t try it out again, after a certain amount of time, or after a certain number of updates, that makes trials a lot less useful.

(via Daring Fireball)

May 3

Running AppleScripts from Automator

These days, I’ve been using Automator more and more to run AppleScripts (especially since Mountain Lion came out and disallowed Calendar, née iCal, from triggering AppleScripts directly: http://apple.stackexchange.com/questions/59257/ical-no-longer-runs-scripts).

I began copying and pasting scripts into my workflows, which is a messy solution. I kept the scripts around, because it’s easier to write and debug them in AppleScript Editor, and especially since I converted them to plaintext scripts and uploaded them to GitHub, it’s very useful to be able to easily diff them, as well.

But there’s a better way. A much better way, in fact. AppleScripts can call other AppleScripts, and this works from within the Run AppleScript workflow action, as well. The full solution looks like this:

on run {input, parameters}
    
    run script file "Macintosh HD:Some Directory On Disk:a cool script.applescript"
    
end run

Doing it that way, the Automator is a simple wrapper – you can set it and forget it. I’ve even confirmed that this works with scripts in the plain text .applescript format and compiled AppleScripts (.scpt).

Update

You can also pass the input and parameters arguments into your scripts from Automator as well. Just use the same on run handler that the Run AppleScript action defaults to (as shown above) in your script file, and pass the arguments from Automator like so:

run script file "path to script like above" with parameters {input, parameters}

On purchasing an older iPhone

A relative recently asked me whether he should get an iPhone 4 as his first iPhone, two models behind the iPhone 5, released roughly 6 months ago. I imagine the advice I gave will probably apply to the same question around this time next year, substituting model numbers.

No one knows when the next iPhone will be coming out, but odds are in favor of August or later. I would definitely recommend against the iPhone 4 at this point in time - I had it for 2 years, and it was great when it was new, and is still decent now, but starting to show its age. And when you buy a phone, you’re committing to 2 years of using it. Disregarding the points situation1, an iPhone 4 is free (or maybe $1) when you sign up for a 2-year contract. The iPhone 5 is only $199, which is nothing compared to how much you’re going to be spending on a service plan over the life of the contract.

I’ve owned the 1st-gen iPhone, the 4, and now the 5, always buying them at launch, and have been relieved to upgrade both times. After a couple of years, the older phones start to feel slower. Apps run slower, you start to get constrained by the memory, and you’ll lose support for the latest OS sooner. I would strongly recommend the iPhone 5 if it’s at all possible - the 4G/LTE alone justifies the price difference, not to mention the larger screen, and thinner/lighter design.

I might add, depending on the person, to wait for the next model. If I were ready for a new phone, that’s what I would be doing. I had to wait 2.5 years between iPhone 4 and iPhone 5, because of the change in release cycle they began with the 4S. If I were impatient (or didn’t care about obsolescence), I would have gotten a 4S when my 4’s contract was up.

My upgrade strategy for Apple devices though, is to wait for the next model when I’m ready to upgrade. You guarantee yourself the longest period between product releases you could possibly anticipate. Of course, that doesn’t apply if your phone/computer breaks and you need a new one, but if you’re in a position to do so, I would recommend it. Also, you may be someone who doesn’t care about having the latest and greatest, and every model of iPhone has been great, so you have to make your own decision.


  1. He has reward points from a credit card which can help him get a phone at a discount. 

I wonder whose job it is to come up with sample data for display Macs in the Apple Store. They’re definitely having fun at it…

I wonder whose job it is to come up with sample data for display Macs in the Apple Store. They’re definitely having fun at it…

Jan 2

Hi, I am trying to use your HandBrakeCLI code with Automator, but I am getting the following error: "Variable re_compile is not defined". I am using Mountain Lion. Cheers!.

Anonymous

Thanks for pointing that out! I neglected to mention that you need to install the Satimage.osax AppleScript extension. the re_compile you’re seeing is because I use regular expressions to handle the command line output of HandBrake. I’ve updated the post to include information about installing Satimage.

littlebigdetails:

iTunes - When adding a free item to a Wish List, an alert reminds you that you can download it right away.

I love the copy of this message, as well, subtly suggesting a reason you may want to download it immediately.

littlebigdetails:

iTunes - When adding a free item to a Wish List, an alert reminds you that you can download it right away.

I love the copy of this message, as well, subtly suggesting a reason you may want to download it immediately.

Dec 5

Using HandBrake on a list of files

I download a lot of videos on the web, and most of the time, they don’t come wrapped up as an iTunes-friendly m4v file. Even when they do, they may not necessarily be encoded in a way that plays nicely with all of my iOS devices (AppleTV, iPhone, iPad, etc.). So, for a long time, my download process has gone like this before loading into iTunes:

  1. Download
  2. Transcode
  3. Tag

The tools I use for the first and third steps have not changed for a long time, but there has been a lot of movement in the Mac video transcoding space. What do I mean by transcoding? I take video that arrives in a particular format (let’s say Ogg Theora) and convert it into a format my devices accept (typically some flavor of MPEG-4 my Apple devices).

VisualHub

For years, I used an awesome tool named VisualHub, and it did everything I wanted. I dragged in a list of files, told it which device I wanted to play them on, and let it rip. It even made use of OS X’s Xgrid infrastructure to encode multiple files simultaneously, distributed among my Mac Pro’s 8 cores, as well as any other networked machines I cared to use. But VisualHub died (so to speak).

It was reborn as an open source project named (poorly, in my opinion) FilmRedux. I tried using it, and found it lacking in various regards. Another project forked the code base and went in its own direction, calling itself VideoMonkey. I used it for a while, dealing with its superficial bugs and slow rate of development, simply because I couldn’t find another tool that would (usually) work the way I desired.

HandBrake

Of course, this all applies to lists of files. If I had a single file to transcode, I used HandBrake as soon as it began accepting arbitrary files for input (it originated as a tool for ripping DVDs, for which it still excels). I love HandBrake, and would use it for all my transcoding needs, if only I could use it for a list of files. The interface has been written with ripping DVDs in mind, however, and so you can only select one file at a time. So I set out to fix that, with my tool of choice: automation!

The Solution

I wanted a way to give HandBrake a list of files, and have it transcode all of them to a particular folder, using a particular settings preset. I realized this seems to be an idea ready-made for an OS X Service, and luckily, Automator (bundled with the OS) allows you to easily make Services. But, HandBrake doesn’t support AppleScript and doesn’t export any Automator Actions, so I needed to figure out another way to automate it. Luckily, HandBrake provides a CLI (command line interface) executable for the Mac.

First, you need to install the Satimage AppleScript extension. Follow the link, download the Satimage___.pkg installer, and run it. If you’re on Mountain Lion (with default Gatekeeper settings), you will need to right-click the file and click Open1, since it hasn’t been signed by the developer, but other than that, it works 100% in Mountain Lion. The installer is very basic, only copying the Satimage.osax extension into your /Library/ScriptingAdditions/ folder.

To create your own service, follow these steps:

  1. Launch Automator.app

    Automator

  2. Click File > New (Cmd+N)

  3. Select Service

    Service

  4. Click the Choose button

  5. Set the following two dropdowns at the top of the service’s definition: Service receives selected files or folders in Finder

    Settings

  6. Drag in the Action named Run AppleScript (you can search to find it quickly)

    Action

  7. Copy and paste the script below as the script’s text

  8. Click the Compile button to make sure the AppleScript pasted is valid

    Hammertime

  9. Click File > Save (Cmd+S), and enter a name (I chose “Encode With HandBrake”), which will show up in the Services menu

on run {input, parameters}
    set handbrakeCli to "/Applications/HandBrakeCLI"
    set defaultPreset to 7
    
    -- Make sure HandBrakeCLI is installed
    set handbrakeInstalled to false
    tell application "Finder" to if exists handbrakeCli as POSIX file then set handbrakeInstalled to true
    if not handbrakeInstalled then
        display alert "Install HandBrake CLI" message "Please install HandBrakeCLI into the /Applications directory

The HandBrake CLI can be downloaded at http://handbrake.fr/downloads2.php" as critical
        return
    end if
    
    set the destination to POSIX path of (choose folder with prompt "Select the conversion destination")
    
    set the presetList to do shell script handbrakeCli & " -z"
    
    set eachPreset to every paragraph of presetList
    
    set groupEx to re_compile "<[ ]*(.+)"
    set presetEx to re_compile "[ ]*\\+[ ]*([^:]*):"
    
    set displayNames to {}
    set presetNames to {}
    
    set group to ""
    
    repeat with preset in eachPreset
        if length of preset > 0 then
            if preset starts with "<" then
                -- Pull out the group's name
                set group to find text groupEx in preset using "\\1" with regexp and string result
            else if preset contains "+" then
                set presetName to find text presetEx in preset using "\\1" with regexp and string result
                copy presetName to end of presetNames
                copy group & " > " & presetName to end of displayNames
            end if
        end if
    end repeat
    
    set chosenDisplayPreset to choose from list displayNames with title "HandBrake preset" with prompt "Choose a HandBrake preset" default items {item defaultPreset of displayNames}
    
    if chosenDisplayPreset = false then
        return
    end if
    
    set chosenDisplayPreset to chosenDisplayPreset as text
    
    set presetIndex to 1
    repeat with i from 1 to (count of items in displayNames)
        if item i of displayNames is equal to chosenDisplayPreset then
            set presetIndex to i
            exit repeat
        end if
    end repeat
    
    set chosenPreset to item presetIndex of presetNames
    
    repeat with inputFile in input
        -- Get original file's name
        
        set thePath to POSIX path of inputFile
        set prevTIDs to AppleScript's text item delimiters
        set AppleScript's text item delimiters to "/"
        -- Get the file name
        set inputFileName to (item -1 of (every text item of thePath)) as text
        
        -- Get the file name without an extension
        set AppleScript's text item delimiters to "."
        set inputFileNoExtension to items 1 through -2 of (every text item of inputFileName)
        set AppleScript's text item delimiters to prevTIDs
        
        -- Put back together if file name included periods
        set outputFileName to ""
        repeat with fileNamePart in inputFileNoExtension
            set outputFileName to outputFileName & fileNamePart & "."
        end repeat
        
        -- Put on the preferred extension
        set outputFileName to outputFileName & "m4v"
        
        set handbrakeCommand to "nice " & handbrakeCli & " -i " & quoted form of (POSIX path of inputFile) & " -o " & quoted form of (destination & outputFileName) & " --preset='" & chosenPreset & "'"
        --return handbrakeCommand
        do shell script handbrakeCommand
    end repeat
    return input
end run

To use the service:

  1. Select the files you wish to convert in Finder
  2. Right click (or Control-click) on the selection
  3. Click Services > Encode With HandBrake (or whatever you named your Service in Step 10 above)
  4. The Service will prompt you for an output folder for the conversion. Select the folder you want your converted files to land in
  5. The Service will also prompt you for a HandBrake preset to encode with2. Select the one you wish to use. Unfortunately, the CLI doesn’t support custom presets defined in the GUI app
  6. A spinning gear icon will show up on the Menu Bar at the top of your screen until the job finishes

This script has worked solidly for me for a long time, and I hope you enjoy it. As always, you can let me know if you have any problems or feature requests.

Update

I’ve gotten feedback that the re_compile command is not working for some (all?) of you. D’oh! I forgot to mention you need to install the Satimage.osax AppleScript extension. I’ve had it for a while and forgot that this script uses Regular Expressions. I’ve updated the post to include those instructions.


  1. This is described on the Gatekeeper support page, under the “How to open an app from a unidentified developer and exempt it from Gatekeeper” heading 

  2. I have it defaulting to the Apple > AppleTV 2 preset, which you can change in the following line of AppleScript: set defaultPreset to 7 

Barcodes in Passbook

On the latest episode of The Talk Show, The iPhone 5 Episode, John Gruber and MG Siegler discussed barcodes on an iPhone screen not scanning properly, and speculated that Passbook (a new feature of iOS 6) might require a special type of scanner. They’re partially right, as explained in the wwdc videos about Passbook1.

Passbook authors can choose between three styles of barcode:

  • PDF417
  • Aztec
  • QR

Those three styles all have something in common: they’re 2D barcodes, as contrasted from the old-school 1D barcodes, as seen in most stores.2 The presenter in the WWDC videos explains their choice to only support 2D barcode formats.

Scanners for 1D barcodes typically use lasers to read them, and those do not work (at least not well) with iPhone screens, as I’ve experienced in the past with scanned-in rewards cards. The 2D formats can only be read by optical scanners (taking photos of the target), which work fine with iPhone screens. Passbook cranks up the brightness on the phone’s screen all the way when it’s displaying a barcode to make a successful scan even more likely.

Not all barcode scanners will properly read an iPhone’s screen, but Apple chose barcode formats for Passbook which require scanners that will work.


  1. The links require an Apple Developer account, but not a paid one. The free accounts have access to the WWDC session videos. I think (and hope) these are no longer under NDA, since iOS 6 has been publicly released. 

  2. The Wikipedia barcode article gives examples of many popular 1D and 2D barcode formats 

➩ How reckless

Katie Marsal, on AppleInsider, regarding the recent break-in at the under-renovation Jobs residence:

…the suspect also managed to swipe the late Apple co-founder’s car keys and wallet — which contained just $1…

You mean that Jobs carried his entire year’s salary – in cash – in his wallet? How many of you would do that?

littlebigdetails:

iOS - The feature Speak Selection (on Settings &gt; General &gt; Accessibility) shows the characters of the fable The Tortoise and the Hare for the voice speed settings.
/via Victor Boaretto

The original 1984 Mac used the same iconography in its control panel for keyboard repeat rate:



Mac image courtesy of Toasty Tech

littlebigdetails:

iOS - The feature Speak Selection (on Settings > General > Accessibility) shows the characters of the fable The Tortoise and the Hare for the voice speed settings.

/via Victor Boaretto

The original 1984 Mac used the same iconography in its control panel for keyboard repeat rate:

Mac image courtesy of Toasty Tech