/* BARlib.ijm * IJ BAR: https://github.com/tferr/Scripts#scripts * * Common BAR library to be placed in BAR/lib. This file hosts functions to * be used across all your macros. To add these scripting additions, run the * following _before_ running your macro files: * * libPath = call('bar.Utils.getLibDir') + 'BARlib.ijm'; * libContents = File.openAsString(libPath); * call('ij.macro.Interpreter.setAdditionalFunctions', libContents); * * Once a new instance of the macro interpreter is initiated, you can confirm * the availability of new additions by running: * * confirmLoading(); */ /////////// UTILITIES /////////// /** Acknowledges accessibility to this file */ function confirmLoading() { showMessage("BAR lib successfully loaded!"); } /** Returns text from the system clipboard or an empty string if no text was found */ function getCliboardText() { return String.paste; //IJM already has a built-in function for this } /** Returns a random uuid */ function randomString(length, spacers) { template = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; nChars = lengthOf(template); string = ""; for (i=0; i