//Extract current coordinates of Results and Log windows and W x H of Results window from the IJ preferences file. //Use them to relocate the windows with setLocation. //JG Wolodzko October 2012 dir = ".imagej"; if (getInfo("os.name")=="Mac OS X") dir = "Library/Preferences"; path = getDirectory("home") + dir+File.separator + "IJ_Prefs.txt"; prefs=File.openAsString(path); print("\\Clear");//clear the Log window xIndex=indexOf(prefs,"results.loc=")+12;//1st character after '=' xEndIndex=indexOf(prefs,",",xIndex);//The next occurrence of a comma xRes=substring(prefs,xIndex,xEndIndex); xR=parseInt(xRes); LineFeed=fromCharCode(10); yIndex=xEndIndex+1; yEndIndex=indexOf(prefs,LineFeed,yIndex);//The next occurrence of a line feed yRes=substring(prefs,yIndex,yEndIndex); yR=parseInt(yRes); print("results.loc="+xR+","+yR); wIndex=indexOf(prefs,"results.width=")+14;//1st character after '=' LineFeed=fromCharCode(10); wEndIndex=indexOf(prefs,LineFeed,wIndex);//The next occurrence of a line feed wRes=substring(prefs,wIndex,wEndIndex); wR=parseInt(wRes); hIndex=indexOf(prefs,"results.height=")+15;//1st character after '=' LineFeed=fromCharCode(10); hEndIndex=indexOf(prefs,LineFeed,hIndex);//The next occurrence of a line feed hRes=substring(prefs,hIndex,hEndIndex); hR=parseInt(hRes); print("results.width="+wR); print("results.height="+hR); xIndex=indexOf(prefs,"log.loc=")+8;//1st character after '=' xEndIndex=indexOf(prefs,",",xIndex);//The next occurrence of a comma xRes=substring(prefs,xIndex,xEndIndex); xR=parseInt(xRes); LineFeed=fromCharCode(10); yIndex=xEndIndex+1; yEndIndex=indexOf(prefs,LineFeed,yIndex);//The next occurrence of a line feed yRes=substring(prefs,yIndex,yEndIndex); yR=parseInt(yRes); print("log.loc="+xR+","+yR);