Hi,
Is there any way to remember what the user has entered in a macro Dialog, so it becomes the default next time it's run? I have done this in plugins using ij.Prefs. Can you access Prefs from a macro? Thanks, Chris Nicolai www.qub.buffalo.edu |
Hi Chris,
you can save macro options in the prefs, but it is not obvious - you have to use the 'call' macro command to directly access the static methods of ij.Prefs. E.g., for an integer number: captureTime = parseInt(call("ij.Prefs.get", "captureTool.captureTime","2")); Dialog.create("Capture Options"); Dialog.addNumber("Capture Time", captureTime,0,6,"seconds"); Dialog.show(); captureTime = round(Dialog.getNumber()); call("ij.Prefs.set", "captureTool.captureTime",toString (captureTime)); (This example is from the Video Capture macro, http:// rsb.info.nih.gov/ij/macros/tools/VideoCaptureTool.txt) Michael ________________________________________________________________ On 5 May 2010, at 18:38, Chris Nicolai wrote: > Hi, > > Is there any way to remember what the user has entered in a macro > Dialog, so > it becomes the default next time it's run? I have done this in > plugins > using ij.Prefs. Can you access Prefs from a macro? > > Thanks, > Chris Nicolai > www.qub.buffalo.edu |
Hello,
The following macro works fine until the last line. The Plot Profile command executes, but the file is not saved. No error messages appear. I need to know how to include the save or saveAs option for the Plot Profile command. Also, is there a place where the option syntax is documented for all menu commands (such as Plot Profile)? Thanks, Rick Simmons //---------- get image dimensions in pixels width = getWidth; height = getHeight; //---------- copy original image to new window fileName = getTitle(); newFileName = fileName + " (copy)"; run("Duplicate...", "title=[" + newFileName+"]"); selectWindow(newFileName); //---------- prepare image run("Enhance Contrast", "saturated=0.4"); run("Make Binary"); //---------- draw line and then create profile plot stepBy = round(height/10); makeLine(0,stepBy,width,stepBy); run("Plot Profile", "save=c:\\rls\\test.xls"); --------------------------------------------------------------------------------------------------------- This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. --------------------------------------------------------------------------------------------------------- |
Hi,
On Tue, 25 May 2010, SIMMONS, RICK L [AG/1850] wrote: > The following macro works fine until the last line. The Plot Profile > command executes, but the file is not saved. No error messages appear. > > [...] > > run("Plot Profile", "save=c:\\rls\\test.xls"); The "Plot Profile" plugin is only recordable insofar it shows the plot window. To get at the plot values from the Plot Profile, you will need to use the Plot.getValues() macro function. Example: http://rsb.info.nih.gov/ij/macros/examples/PlotGetValuesDemo.txt To save the values to a file, you will need to use the File.open(), print() and File.close() methods. Example: http://rsb.info.nih.gov/ij/macros/SaveTextFileDemo.txt (Note that this example does not call File.close(), which might result in a short write, i.e. an incomplete file) Hth, Johannes |
Free forum by Nabble | Edit this page |