Skip navigation.

Harold's Home

   Home > Personal > Downloads > Applescripts
PHP Scripts

CLI fun
Mail on 404
HB-NS (NewsScript)


APOD to Desktop
Dreamweaver Extensions


Other stuff
Central Grinder

OOOk Default:

VJ stuff
VJ Tools
Sample Movies


Please note that this page is slighly outdated.
I have stopped updating this page but you can check my weblog for more applescript fun. Here's the AppleScript section.

QuickTime - Set Loop Property
I recently had to process a few folders with about 500 quicktime movies in total and check the loop menu item and then save them. I thought this might easily be done with Applescript so I downloaded the QuickTime 5.0.2 scripts from Apple but despite having about a gazillion scripts in it none of them changed the loop property, so I adapted one of the scripts to my satisfaction. It even works the other way round. Just doubleclick the droplet to set the preferences (true for looping or false for not looping) and then drop a few files or even a whole bunch of folders onto it.
This droplet works in MacOS 10.1.5 but should also work in OS 9 though I haven't tested that.
You'll need to have installed Applescript for this to work of course, I recommend the latest version.

Download, 32k

Applescripting the commandline calendar tool in Mac OS X
This small applescript will display the output of the commandline tool calendar in a dialog window. It allows you to put the contents of the output on the clipboard as well. The script is heavily commented but I suggest reading up on the command by typing "man calendar" in the Terminal.
standard output

output placed on clipboard
Download, 4k

BBEdit border attribute script
An applescript that sets the border of all images in a document to zero, which can be very handy.
Before: <IMG SRC="../pix/home.gif" ALT="home">
After: <IMG SRC="../pix/home.gif" ALT="home" BORDER="0">
Download, 4k

BBEdit prepend tab to selection
OK, just found out that BBEdit actually has an in-built function that does exactly this. It's called Shift Left and it's in the text menu. ( Command ] ). This is way faster than my AppleScript so I suggest you use that instead. BTW Shift Right ( Command [ ) does exactly the reverse. I'll leave the AppleScript here as a reminder for all (and myself) that BBEdit has hidden depths and that "Reading Manuals Can Be A Good Thing Too"™.
Copy and paste this script in the AppleScript editor.
This is a script that uses the Prefix/Suffix Lines... Tool that comes with BBEdit 6.1.
This might work in earlier versions of BBEdit though there are no guarantees.
This script was created by me (Harold) because the Prefix/Suffix Lines... Tool doesn't appear to allow a tab to be prepended using the dialog box and I find that I often want to indent a section of code with one tab extra, for instance when I have just added a new if clause.
How this works:
Takes the current selection, uses "add prefix" to prepend a tab.
Will only work on text windows. You might want to change/censor the dialog button values.

tell application "BBEdit 6.1"
  set w_class to class of window 1
  if w_class is text window then
   if (selection of text window 1 as text) is "" then
    display dialog "You need to select some text first" buttons "Oh Darn
      default button "Oh Darn"
   add prefix "\t" with selection only
  end if
  -- display dialog if window 1 isn't a text window
   display dialog "Window 1 is not a text window" buttons "Shit
     default button "Shit"
  end if
end tell

BBEdit comment javascript
An applescript that will put // before every line of selected javascript, effectively commenting it. Great for if you're testing some piece of code. BBdit can do this with the inbuilt commenting tool but I have left this as an excercise.
Download, 4k

XML version of this site
About, copyright, privacy and accessibility | Mail