trouble saving (not printing) text window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

trouble saving (not printing) text window

Charles P. Daghlian
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
Reply | Threaded
Open this post in threaded view
|

Re: trouble saving (not printing) text window

jmutterer
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
>