Website Popups Using Automator

Automator in Lion (11.7, 2011) introduced a fascinating action: Website Popup. What it does is open a standalone web viewer given a URL. I find Website Popups to be particularly useful for reference sites such as those documenting an API, especially those in the Apple Developer Library which have their own navigation mechanism (in particular, using a table of contents on the left).

Download this workflow and move it to ~/Library/Workflows:
WebsitePopup.workflow.zip (20.9 KB)

Then import Website Popups v. 1.3.kmmacros (2.0 MB), which contains:

  • a macro for calling the workflow; it takes a URL as a parameter and creates a Website Popup for that URL
  • a bunch of preconfigured macros which call that macro for websites likely to be of interest to readers of this forum

The group shows the macros as a palette for one action when activated by a hot key. The submacro is the last item on the palette — selecting that gives you the opportunity to specify a URL to be opened.

Details

The website popup may be closed by typing Escape or clicking Cancel. It may also be closed by clicking OK, in which case selected text gets put on the System Clipboard. The popup stays on top of regular windows, like a Help page, which has both advantages and disadvantages. There may be more than one popup active at a time.

Navigation of a page‘s links is particularly fast. ⌥⌘← goes to the previous page visited, and ⌥⌘→ to the next. Other than that, there are no tabs, history, bookmarks, or anything else you would see in a real browser.

The Website Popup action has some customizations. Adjust the details of the Open Website Popup action to your liking. The width was chosen to conform to the expected width of many of the Apple documentation sites. (I am not sure whether there are system settings that might affect how wide the window will be relative to its contents.)

Display Arbitrary HTML

I named the macro group “Website Popups” because that‘s what Automator calls them. Actually, though, they may be used for an existing file (HTML, PDF, plain text, etc.) or one constructed by a program or macro. (See, for instance, Creating a Web/HTML Page with AppleScript or JXA -- Suggestions?, for which a website popup might be useful.) A program or macro could construct a file — perhaps in /tmp — and open it with the Open Website Popup macro or a variation on its last action. Remember to use file:// instead of http:// when opening files.

Website Popup Applications

You can create a double-clickable Open Website Popup application by adding a Get Specified URLs action before the Website Popup step and specifying the URL you want to use. The process will appear in Activity Monitor under the name of the application, and it is an application process of System Events. However, it will not appear on the dock, or any kind of application switcher.

Failed Efforts

I tried programming something like this in Swift and Objective-C, but didn‘t get very far, partly because of the confusion caused by Apple‘s replacement of WebView with WKWebView in 10.10.

I also tried customizing the window size for each website, but could‘t find a way to do it. I can‘t even see a way to give the popup focus when it first opens. (One hack I did try, but rejected as too random and inaccurate, was to execute an asynchronous macro that clicked the mouse where the popup popped up.)

Automator‘s documentation of the Website Popup action claims that its input is one or more URLs, but I wasn‘t able to get multiple URLs to work.

Background

The contents of this post, the workflow, and the macro is based on information derived from quite a few web sites, so I am not citing any, which I would otherwise do. A Google search on "website popup" will find many of them. Some of particulars of website popups described above were discovered by experimentation.

2 Likes

Hey Mitchell,

Thanks! I was looking for that the other day and couldn’t find it.

-Chris

New version; old version replaced in the original post. Changes:

  • corrected a few icons
  • opened URL now goes on clipboard for convenience
  • lots more entries, including more Apple documentation
  • changed name and order of a few menu entries to improve clarity

Version 1.3:

  • changed palette to three columns
  • added more sites
  • rearranged ordering of entries

By the way, at this point the macro group contains 46 links, and a few of the macros have comments with others (in particular, references to earlier versions of Apple release notes for various technologies). Even if you don’t use this macro group, and I really can’t understand why you wouldn’t, you might at least find many of the links quite useful.

I no longer have any idea what any of this paragraph means. If you do, please let me know. :confounded:

if focus is in the popup, that is

New version:
Website Popups v. 1.4.kmmacros (3.2 MB)
The original post was too long ago for me to be able to edit it, so I couldn't replace the version there.

Many more links. Rearranged menu.

how can I resize the popup window?[quote=“minjie_he, post:1, topic:6646”]
mounted
[/quote]

The size is determined by KM. There are parameters that control the menu appearance, and changing some of those might give you what you want.

  • Select the Website Popups group.
  • Make sure none of its macros are selected.
  • Click
  • Make any adjustments you wish.

A post was split to a new topic: What is Best Language to Learn for Programming iOS Apps?