Skip to content

Instantly share code, notes, and snippets.

@narath
Created October 14, 2023 15:54
Show Gist options
  • Select an option

  • Save narath/3bbff31f42f31853a3e2b78bb5ae6f91 to your computer and use it in GitHub Desktop.

Select an option

Save narath/3bbff31f42f31853a3e2b78bb5ae6f91 to your computer and use it in GitHub Desktop.

Revisions

  1. narath created this gist Oct 14, 2023.
    8 changes: 8 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    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).
    14 changes: 14 additions & 0 deletions get_address.scp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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
    14 changes: 14 additions & 0 deletions get_name.scp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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