08.01.07

Update on the Bookmarking thing

Posted in AppleScript, Macintosh, VoodooPad at 1:33 am by Lazra

There was a bug in this script. It took the wrong URL when multiple pages were opened. Never trust code from some stranger, I tell you. There is still a flaw, sometimes it changes the active Safari window for some or no reason. Buuut: Now there is a list of the acronyms and what’s their meaning. And the input works a bit different: type the acronym followed by a space and then the description. Page creation or direct addressing by pagename does not work anymore.
Here is the code. I edited it also in the previous post.

Edit: Ok, I hope I killed the flaw now. Script is updated again.

on run

tell application "Safari" to set new_bm_url to URL of document 1 of window 1
activate

set acronyms to {"s", "a", "g", "o", "d", "l"}
set pagenames to {"bm Science", "bm Apple", "bm Games", "bm Other", "bm Software Dev", "bm Read Later"}

set d_l to ""
repeat with x from 1 to number of items of acronyms
set d_l to d_l & item x of acronyms & " - " & item x of pagenames & return
end repeat

display dialog d_l as text default answer ""
set text_result to text returned of result

set acronym to first character of text_result
set bookmark_note to characters 3 thru (number of characters of text_result) of text_result as text

tell application "VoodooPad"

repeat with x from 1 to number of items of acronyms
if item x of acronyms is acronym then
set itemnumber to x
end if
end repeat

set pagename to item itemnumber of pagenames

append text bookmark_note & return & new_bm_url & return to page pagename of document 1

end tell

end run

Leave a Comment