Bookmarklet

From iMacros
Jump to: navigation, search

In general a bookmarklet is an applet, a small computer application, stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. The term is a portmanteau of the terms bookmark and applet. Whether bookmarklet utilities are stored as bookmarks or hyperlinks, they are designed to add one-click functionality to a browser or web page. When clicked, a bookmarklet performs some function, one of a wide variety such as a search query or data extraction. Usually the applet is a JavaScript program.

An iMacros Bookmarklet is a bookmarklet that starts an iMacros macro. As the iMacros bookmarklet can use all functions of iMacros it can automate more complex tasks e. g. run complete form filling sequences or start the up/download of files. In addition an iMacros based bookmarklet is much faster to create and requires no Javascript or DOM knowledge.

iMacros for Chrome uses bookmarklets by default to store the iMacros inside the regular Chrome bookmarks. So if you record an iMacros in Chrome, it has already the right format to be used inside a web page.

Example Firefox Chrome

In this wiki, you will find a "Copy URL in PhpBB Forum Format" link below each site's main heading. This is a bookmarklet with an iMacro inside! When clicking it, it will run a macro (in iMacros for Firefox Firefox or iMacros for Chrome Chrome) that copies the current URL to the clipboard in a format you can use in the iMacros forum or any other PhpBB based forum.

The macro code is:

 VERSION BUILD=1100208 RECORDER=CR
 'create forum style link from current URL
 SET !VAR1 [url={{!URLCURRENT}}][/url]
 'put to clipboard
 SET !CLIPBOARD {{!VAR1}}

E.g. when clicking that link right on this very site, the clipboard will contain the following string

 [url=http://wiki.imacros.net/Bookmarklet][/url]

You need to have iMacros for Firefox or iMacros for Chrome installed for this to work. iMacros for Internet Explorer support will be available soon.

Tip: You can embed such iMacros bookmarklets on your own website or forum too! Here's how:

  1. Using iMacros for Firefox, right-click the macro file in the iMacros sidebar
  2. Select "Add to bookmark" on the pop-up menu
  3. Click the "Make Bookmarklet" radio button
  4. Click the "Copy to Clipboard" radio button
  5. Click OK
  6. Paste the contents into the HREF attribute of an Anchor element in your source HTML file
  7. Surround the entire HREF value with double-quotes, then use your editor's search-and-replace function to convert the embedded double-quotes in the href value to quot;