Tuesday, July 6, 2010

Using Applescript to Extract Hyperlinks from a Word document

I was working with a Word document that had a bunch of hyperlinks, and I thought that what I'd like to do is to create a table of URL's, kind of like a list of figures or list of tables. Applescript to the rescue! This script creates a new table at the insertion point that has two columns: link text and URL. It's smart enough to eliminate duplicate entries, and uses the table sort command to sort the results.

tell application "Microsoft Word"
set allTexts to {}
set allLinks to every hyperlink object of active document
set theTable to make new table at active document ¬
with properties {number of rows:1, number of columns:2}
insert text "Link" at text object of cell 1 of row 1 of theTable
insert text "URL" at text object of cell 2 of row 1 of theTable
repeat with theLink in allLinks
set theText to text to display of theLink
if allTexts does not contain theText then
make new row at end of theTable with properties ¬
{allow break across pages:false}
insert text (theText) at text object of cell 1 ¬
of last row of theTable
insert text (hyperlink address of theLink) ¬
at text object of cell 2 of last row of theTable
set allTexts to allTexts & {theText}
end if
end repeat
table sort theTable field number 1 with exclude header
end tell

Tuesday, February 23, 2010

Reason #27 why Windows annoys me

The psychic tension from seemingly always having updates ready for my computer.

Sunday, February 21, 2010

How I Finally got Dora Links to Work

Dora Links has been the bane of my existence since about 8AM Christmas morning. For months I've been looking online to see if anyone else was having the same problem I was having -- I got the software downloaded and installed, but then when I went to start it, I got the following error message:

temp_launcher.bin has encountered a problem and needs to close. We are sorry for the inconvenience.

Here's what I did to solve this: I navigated to the Dora Links folder in my Program Files folder. Inside that folder I saw two applications: one called Launcher, and one called Dora Links. I double-clicked on the Dora Links application, and voila! Happiness and joy!

Can I get more step-by-step directions?

These directions work assuming you used the defaults when installing.
  • Go to the Start Menu, and select "My Computer"
  • Double-click on the C: drive icon
  • Double-click on the Program Files folder
    • At this point, it might give you some sort of warning message about not messing with this folder. Generally, this is right -- you don't want to just go messing around in here willy-nilly. But for now, we'll throw caution to the wind. Click on the link that lets you see the contents of your Program Files folder.
  • Double-click on the Mattel folder
  • Double-click on the Dora Links folder
  • Look for the application named "Dora Links". Double-click on it.

So what's happening here?

The shortcut that's installed on the desktop and on the Start Menu goes to that Launcher application. Going straight to the Dora Links application seemed to work better.

What happened when you tried to call the Dora Links support number?

They were clueless. First, I confused them when I said that my email address was @mac.com -- they couldn't quite believe that I was running Windows on my Mac. Then, I confused them when I said that the software only took maybe 30 minutes to download and 10-15 minutes to install (I must have higher-speed internet and a faster computer than the person at tech support). Basically, they said that I must not have downloaded the software correctly or the install didn't really finish.

Wednesday, February 10, 2010

Refused to get unsafe header "X-JSON"

Was doing some development involving the prototype.js framework and ran into this error message in Safari while trying to use Ajax.Request. The URL I was requesting via Ajax.Request was on a production server, but the page I was testing was on my laptop (i.e., localhost). So, Safari refused, protecting against doing a request against a different server. As soon as I moved the page into production it worked.

Sunday, August 2, 2009

What to do when iPhone pictures won't show up in iPhoto

Sometimes when I plug in my iPhone after I've taken some pictures, iPhoto doesn't launch automatically, and when I launch it manually, it doesn't recognize that the iPhone has pictures on it. I've found that logging out of my account on the mac and logging back in fixes that. Don't know why, don't really care. (I think maybe it has to do with my iPhone being plugged in when E starts up iPhoto under her account).