Skip to content

Instantly share code, notes, and snippets.

@miura
Created September 9, 2020 14:00
Show Gist options
  • Save miura/3e6998599a7db63125e8ebaf694ca232 to your computer and use it in GitHub Desktop.
Save miura/3e6998599a7db63125e8ebaf694ca232 to your computer and use it in GitHub Desktop.
//20200909 Kota Miura
// temporal colorcode fix
testpath = "/Users/miura/Desktop/tmp/rewritemacro/Temporal-Color_Code.ijm";
ijmpath = testpath;
ijpluginDir = getDir("plugins");
thefile = ijpluginDir + "Scripts/Image/Hyperstacks/Temporal-Color_Code.ijm";
ijmpath = thefile;
if ( File.exists(ijmpath) ){
createMacroBackup( ijmpath );
str = File.openAsString( ijmpath );
str = replace(str, "lutA = makeLUTsArray\\(\\)", "lutA = getList\\(\"LUTs\"\\)");
File.saveString(str, ijmpath);
} else {
print( ijmpath );
print("...that file seems to be not existing. Please check the path");
}
function createMacroBackup( path ){
filename = File.getNameWithoutExtension(path);
dirname = File.getDirectory(path);
backuppath = dirname + filename + "-backup.macro";
print( "Backup:", backuppath);
File.copy(path, backuppath);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment