Login  Register

Re: trouble saving (not printing) text window

Posted by jmutterer on Dec 15, 2008; 8:39pm
URL: http://imagej.273.s1.nabble.com/trouble-saving-not-printing-text-window-tp3694247p3694248.html

Chuck,

 you can print (save) directly to a file on disk. See
http://rsb.info.nih.gov/ij/macros/SaveTextFileDemo.txt for a demo.
 You can also print to a text window first. Then to save it to disk, you can
use:

 f = File.open("/Users/yourname/yourfile.txt");
 selectWindow("index.html");
 content = getInfo();
 print(f,content);
 File.close(f);

 Jerome.


> On Mon, Dec 15, 2008 at 9:17 PM, Charles P. Daghlian <
[hidden email]> wrote:
>>
>> Of course I meant saving, not printing, as the earlier email subject
indicated.
>>
>> Good morning,
>>
>> I am having trouble getting a macro to save a text window. Despite having
explicitly opened a text window and printed to it using  code from the web
site, when I call selectWindow("index.html"); saveAs("text") , I get an
error - 'This command requires a TextWindow such as the "Log" window on
an"Info for..." window.' As usual, I may be missing something obvious.
>> ImageJ 1.42d, Mac OS X
>>
>> Chuck
>