Previous month:
April 2012
Next month:
July 2012

Simple AppleScript to Open A URL From A List In Text File

One of the reasons I've always liked using an Apple Macintosh is AppleScript.  I know there is PowerShell on Windows but I don't find it as easy to just solve a problem as seamlessly with AppleScript.  

Here is an example ...

I have been subscribed to an email feed from DefenseLink that gives you pictures taken by DOD photographers.  However, the links get messed up (BLOCKED) by the anti-malware software on the mail servers at work.

So I take the messed up URLs and save them to a text file.   Then I run this script when I want to review the pictures:

property myURL : ""

tell application "TextWrangler"

activate

select line 1 of window 1

set myURL to contents of selection

delete line 1 of window 1

end tell

tell application "Google Chrome"

activate

set myTab to make new tab at end of tabs of window 1

set URL of myTab to myURL

end tell

Pretty easy.  Meets my needs. Solves a problem.  Good deal.