March 23, 2009

Automatic Tr.im URL Shortening & Click Tracking with TextExpander

The guys who make one of my favorite applications, TextExpander, posted a great tip a while back to automatically shorten urls that are on the clipboard with the tr.im service.

It works wonderfully, except there is no way to track how many people click your shortened urls because you’re not logged into your tr.im account when the urls are shortened. There is a crazy easy way to log in to your tr.im account when TextExpander shortens your urls.

  • Add this line as a new TextEpxander snippet and set it as an Applescript. Fill in your username and password where it says username:password.

  • *
do shell script "curl --basic -u username:password http://tr.im/api/trim_url.xml?url=`pbpaste` | tr '>' '\n' | tr '


  • You can also simply download this TextExpander snippet to add to TextExpander. You still must put your username and password where it says username:password. :)

  • Set the shortcut to something like “trm” or similar.

Thats it! Anytime you want to shorten a url in any application, copy the url to the clipboard. Next go to where you’d like to paste the url. Type in “trm” or your shortcut, and it will paste the shortened url automatically.

July 7, 2007

Automatic iPhone Video Conversion with VisualHub

Ok. So let’s say you’ve got your iPhone, your mac with Tiger, and a copy of VisualHub.

  • First, you need to be able to script VisualHub. To do that, you’re going to have to download this special script dictionary.

    Next you’re going to install this script library. To do so you need to (taken right from VisualHub’s instructions):

    1) Control-click (right-click if you got ‘em) on the VisualHub application, and select “Show Package Contents” from the contextual menu.

    2) Drill down a couple folders. Double-click on “Contents”, then “Resources”, and finally, “Script”.

    3) Drag the “automation.scpt” file you just downloaded into this Scripts folder. You can close the window when done. If you did it right, then the next time you open VisualHub its title bar will read “VisualHub 1.x Automation Tech Preview”.

  • Now that you can automate VisualHub, you can download the Automator workflow & VisualHub iPhone settings file here.

    The settings file just tells VisualHub to convert to the iPhone format, at a standard (“WiFi”) quality, and to automatically add the finished file to iTunes.

  • Next, to install the settings file, you can really do this anywhere you like, but I installed it in my user’s documents folder. To do this, just drag the “VisualHub” folder to your documents folder. After installed the path would look like HardDrive/Users/ShortUserName/Documents/VisualHub/settings.vhub.

  • Now that you’ve instaled the settings file, all you have to do is install the workflow. Double click the “Export to VisualHub” workflow and it should open in Automator.

  • Once it is open, set the correct paths in the applescript. The applescript window in Automator should look like this:

    on run {input, parameters}
    
    tell application "VisualHub" to set VisualHub to load script 
    (scripts path of main bundle & "/automation.scpt" as POSIX file)
    
    tell VisualHub
        LoadSettings("HardDrive:Users:
        ShortUserName:Documents:VisualHub:
        mysettings.vhub")
        SetSaveLocation("HardDrive:Users:
        ShortUserName:iPhoneVideosFolder)
        AddFiles(input)
        StartConversion()
        QuitApp()
    end tell
    
    return input
    end run
    

    Change the two file paths in to the proper locations of the settings file and a folder you’d like the converted video files to download to. Make sure to change “HardDrive” to the name of your hard drive, and “ShortUserName” to the name of your home folder (your short user name) in both paths.

  • All that is left to do is to save it. Now you have to decide how you’d like to use it. You can:

    1) Save it as Finder Plugin.

    2) Save it as a Folder Action.

    Saving it as a Finder Plugin will create a Contextual Menu item in the finder. So, whenever you select a video file you’d like to automatically convert, you’d just control-click (right-click) the file and select “Export to VisualHub” from the “Automator” menu in the pop-menu that comes up.

    Saving it as a Folder Action will cause any file that is placed in a specified folder to automatically be converted ti the iPhone format.

    Note: If you save it as Folder Action, make sure you have the new iPhone video file saving to a different location (the second file path that you set above) than the original, or you will just have an continuous loop of file conversion going on.

    Both methods are useful and its up to which one you choose.

That should be it with any luck. Now you should be able to have just about any video file you’d like automatically converted to the iPhone format for watching on your new iPhone! :D

Clicky Web Analytics