/* * ActionBar Updater-Makro, by Rainer M. Engel, 2012 * ActionBar is a plugin for ImageJ created by Jerome Mutterer * http://imagejdocu.tudor.lu/doku.php?id=plugin:utilities:action_bar:start */ print("\\Clear"); print("start updating ActionBar.."); print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"); ijDir = getDirectory("imagej"); ActBar = ijDir+"plugins"+File.separator+"ActionBar"+File.separator+"YOUR-ACTION-BAR.txt"; // YOUR ActionBar ActScr = File.openAsString(ActBar); //print(ActScr); SRClines= split(ActScr,"\n"); print("-> found "+lengthOf(SRClines)+" lines in ActionBar-Script"); // filter path-containing lines from script ----------------------------------- paths = newArray(); // create Array to store paths in ranks = newArray(); // create Array to store ranks in vers = newArray(); // create Array to store versions in for (i=0; i found "+lengthOf(paths)+" linked makros inside of ActionBar-Script"); //------------------------------------------------------------------------------ // check existence of makros --------------------------------------------------- makroC = newArray(); // create Array to count found makros for (i=0; i found "+lengthOf(makroC)+" makros at their defined paths"); //------------------------------------------------------------------------------ // check for updated makros ---------------------------------------------------- UpdateV = 0; UpdateP = newArray(); // Updated paths to new versions UpdateC = 0; for (i=0; i found "+UpdateC+" update(s) in makros"); //------------------------------------------------------------------------------ // Assemble updated action-bar file--------------------------------------------- outLog = File.delete(ActBar); outLog = File.open(ActBar); c = 0; for (i=0; i ActionBar-file has been updated!"); //------------------------------------------------------------------------------ print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"); // FUNCTIONS .................................................................. function getPath(path) { // get string of path only dotIndex = lastIndexOf(path, "\")"); if (dotIndex!=-1) path = substring(path, 0, dotIndex); first = indexOf(path, "(\""); if (first!=-1) path = substring(path, first+2, lengthOf(path)); return path; } function getVerIncr(version) { // get version from path dotIndex = lastIndexOf(version, "."); if (dotIndex!=-1) version = substring(version, 0, dotIndex); first = indexOf(path, "_v"); if (first!=-1) version = substring(version, first+2, lengthOf(version)); version = IJ.pad(version, 0); return version; } //.............................................................................