I wonder if AppleScript can print a variable in the top menu bar in OSX 10.11 ?
There is a simple way, using AppleScriptObjC as described here:
use framework "Foundation" use framework "AppKit" use scripting additions property StatusItem : missing value property newMenu : class "NSMenu" -- myVariable derived from whatever code >> set myVariable to ">> " & "Output of script: value of variable." & " <<" set bar to current application's NSStatusBar's systemStatusBar set StatusItem to bar's statusItemWithLength:-1.0 StatusItem's setTitle: myVariable set newMenu to current application's NSMenu's alloc()'s initWithTitle:"Custom" StatusItem's setMenu:newMenu delay 5 current application's NSStatusBar's systemStatusBar()'s ¬ removeStatusItem:StatusItem
On the original page I posted code that gets a display-dialog's return & puts it onto the menu bar.