Skip to content

Instantly share code, notes, and snippets.

@narath
Created October 14, 2023 15:54
Show Gist options
  • Save narath/3bbff31f42f31853a3e2b78bb5ae6f91 to your computer and use it in GitHub Desktop.
Save narath/3bbff31f42f31853a3e2b78bb5ae6f91 to your computer and use it in GitHub Desktop.
Fix Hookmark Freeplane Get Address Script

To implement this:

  • add get_name.scp to the Get Name script in HookMark > Settings > Scripts > FreePlane > Get Name
  • update get_address.scp for the Get Address script
  • Save

Should work.

Nice to have: FreePlane has a Copy > Copy URI which copies a URI to the current node. It might be nice to copy this which would let you link directly to a particular node (as opposed to just the map).

tell application "System Events"
set window_name to title of first window of (first application process whose frontmost is true)
set AppleScript's text item delimiters to {" - Freeplane - Mind map mode "}
set delimitedList to every text item of window_name
if ((count of delimitedList) is equal to 2) then
set myTitle to item 1 of delimitedList
if myTitle ends with "*" then
set myTitle to text 1 thru ((length of myTitle) - 1) of myTitle
end if
set myUrl to item 2 of delimitedList
end if
return myUrl
end tell
tell application "System Events"
set window_name to title of first window of (first application process whose frontmost is true)
set AppleScript's text item delimiters to {" - Freeplane - Mind map mode "}
set delimitedList to every text item of window_name
if ((count of delimitedList) is equal to 2) then
set myTitle to item 1 of delimitedList
if myTitle ends with "*" then
set myTitle to text 1 thru ((length of myTitle) - 1) of myTitle
end if
set myUrl to item 2 of delimitedList
end if
return myTitle
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment