Christian Heilmann

Why Homesite 5 still rocks my world

Tuesday, August 23rd, 2005 at 11:25 am

I have the fun job at the moment right now to turn a lot of word documents into HTML, as the client does not have a CMS or want one.
The Homesite keyboard shortcuts are a real treat there (ctrl+shift+p to turn the highlighted section into a paragraph), and the right-click “turn into unordered list” helps a lot, too.

However, what was missing was a keyboard shortcut to turn a line into a heading. What is cool about Homesite 5 though is that you cannot only write your own toolbars, menus and containers with something called VTML, which is much like XUL) but you also have an API to completely script the editor itself. So what I did is write a small headings.js file and attached it to the keyboard shortcut ctrl+2 (ctrl+1 already replaces all special characters with numbered entities – another script I did) via the Options -> Customise -> Script Shortcuts dialogue.
When I now write something like

1Welcome to the last day of your former life

and press ctrl+2 it turns it into

Welcome to the last day of your former life

the number defines the weight of the heading (1 to 6). The script is easy enough:

function Main()
{

var selectedString = ‘’;
var weight=1;
// highlight the current line and store its content in s
Application.ActiveDocument.SelectCurrentLine();
s = Application.ActiveDocument.SelText;
// get the first character and add the tag brackets with that weight
// around the line
weight=s.substr(0,1);
var r=’< h ' + weight + '>‘+s.substr(1,s.length) +’< / h ' + weight + '>‘;
// replace the highlighted line with the new one
Application.ActiveDocument.SelText = r;
}

//Following is some textile bug:

More Information about the API is available at The Macromedia Site.

Share on Mastodon (needs instance)

Share on Twitter

Newsletter

Check out the Dev Digest Newsletter I write every week for WeAreDevelopers. Latest issues:

Dev Digest 146: 🥱 React fatigue 📊 Query anything with SQL 🧠 AI News

Why it may not be needed to learn React, why Deepfake masks will be a big problem and your spirit animal in body fat! 

Dev Digest 147: Free Copilot! Panel: AI and devs! RTO is bad! Pi plays!

Free Copilot! Experts discuss what AI means for devs. Don't trust containers. Mandated RTO means brain drain. And Pi plays Pokemon!

Dev Digest 148: Behind the scenes of Dev Digest & end of the year reports.

In 50 editions of Dev Digest we gave you 2081 resources. Join us in looking back and learn about all the trends this year.

Dev Digest 149: Wordpress break, VW tracking leak, ChatGPT vs Google.

Slowly starting 2025 we look at ChatGPT vs Google, Copilot vs. Cursor and the state of AI crawlers to replace web search…

Dev Digest 150: Shifting manually to AI.

Manual coding is becoming less of a skill. How can we ensure the quality of generated code? Also, unpacking an APK can get you an AI model.

My other work: