In my little series of postings today I want to start with a little goodie, an integration script to iCab.
– https://icab.de/
– iCab - The Taxi for the Internet
– iCab is an alternative web browser for the Apple Mac with numerous useful features not found in other browsers.
– iCab is shareware and costs $10 / 10 EUR, but it can be also used for free with a small limitation.
(I am a mere user, no other affiliation.)
Since iCab is scriptable to a certain degree and has a lot less quirks than say, Firefox, developing this was quite easy. The script goes into the Get Adress pane after registering the iCab app using the [+] in Settings > Scripts > Scripteditor.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
property NSString : a reference to current application's NSString
on decodeURL(encodedString)
-- Create an NSString object
set anNSString to NSString's stringWithString:encodedString
-- Decode percent-encoded sequences
set decodedString to anNSString's stringByRemovingPercentEncoding()
return decodedString as text
end decodeURL
-- main
tell application "iCab"
activate
set myName to get name of front document
set myURL to get url of front document
end tell
if myURL is in {"empty:blank", ""} then
return -- nothing
else if myURL begins with "file://" then -- in this case myName will be "" for any file
set AppleScript's text item delimiters to "/"
set myName to decodeURL(last item of (get text items of myURL)) -- get the full file name instead
end if
return ("[" & myName & "](" & myURL) & ")"
Feature of note: the script tries (and hopefully succeeds) to handle file URLs properly.
Why file URLs? Most people are probably not aware that you can use most browsers (among them iCab and especially Firefox) as one-stop-document-previewing-app.
I. e. open a blank window and drag and drop pictures, text files, videos, pdfs and many other file types on the big white void or on the browser’s icon in the dock to view them. Using my script Hookmark is able to access name and file URL from iCab.
This script is free for everybody and of course may or should be included in Hookmarks standard integration script library.