Re: cgwindow and output file name [message #80769] |
Wed, 11 July 2012 08:33 |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den onsdagen den 11:e juli 2012 kl. 15:43:55 UTC+2 skrev David Fanning:
> Mats Löfdahl writes:
>
> > When you use the "Save Window As" functionality in a
> > cgwindow, the default file name is cgwindow.EXT in
> > the current directory, where EXT depends on the format you want.
> >
> > If you want another file name you can seklect an
> > existing file name or type in a new name in the popup
> > dialogue. This becomes a bit tedious (and error prone)
> > if you have to do it a lot. I've been looking for a
> > way to specify the file name when creating the window >
> > but I can't find anything.
> >
> > Is there a way to do it?
>
> There are not too many things you can do when
> you are working with an interactive program. I
> could, of course, give you a place to write the
> filename you want, but that is nearly as tedious
> as, well, writing it the way you are doing it now. :-)
>
> Still, you do have this control already, because
> it is possible to ask cgWindow to output the
> contents of the window independently of the window. And,
> of course, you can specify the name of the output
> file when you do so:
>
> cgControl, OUTPUT='whateveryoulike.png'
The changes you did to cgcmdwindow__define.pro (your later posts) are probably useful too, but cgcontrol solved my problem. Thanks so much!
|
|
|
|
Re: cgwindow and output file name [message #80771 is a reply to message #80770] |
Wed, 11 July 2012 07:44  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> In this case, I don't see a clear way forward. I wonder
> if anyone else has a good idea?
OK, a little coffee helped.
Here is what I have done. I now save the root name and
output directory of the last file you have output in
cgWindow. All subsequent output commands construct
their default filename from the *last* filename output.
This will keep you in the same output directory and
make it easier to choose your own names.
You can find the updated program here:
http://www.idlcoyote.com/programs/cgcmdwindow__define.pro
Let me know what you think.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: cgwindow and output file name [message #80773 is a reply to message #80771] |
Wed, 11 July 2012 06:43  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mats Löfdahl writes:
> When you use the "Save Window As" functionality in a
> cgwindow, the default file name is cgwindow.EXT in
> the current directory, where EXT depends on the format you want.
>
> If you want another file name you can seklect an
> existing file name or type in a new name in the popup
> dialogue. This becomes a bit tedious (and error prone)
> if you have to do it a lot. I've been looking for a
> way to specify the file name when creating the window >
> but I can't find anything.
>
> Is there a way to do it?
There are not too many things you can do when
you are working with an interactive program. I
could, of course, give you a place to write the
filename you want, but that is nearly as tedious
as, well, writing it the way you are doing it now. :-)
Still, you do have this control already, because
it is possible to ask cgWindow to output the
contents of the window independently of the window. And,
of course, you can specify the name of the output
file when you do so:
cgControl, OUTPUT='whateveryoulike.png'
I do store the name of the *last* file you interacted with
with cgPickfile (presumably, in this case, the last file
you wrote if you are only working with one window at a time)
and I could retrieve the basename of that file and use it.
There will be errors from time to time if you are using
cgPickfile for other things.
I could also (but this is a LOT more work and I have
a full-time job now) allow you to suggest a name for
the output file and use that. That may, in time, become
just as tedious as the current solution, and it is
certain to complicate the code a great deal. It doesn't
immediately jump out at me as the "right thing to do".
In this case, I don't see a clear way forward. I wonder
if anyone else has a good idea?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: cgwindow and output file name [message #80774 is a reply to message #80773] |
Wed, 11 July 2012 05:09  |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den onsdagen den 11:e juli 2012 kl. 13:53:39 UTC+2 skrev Mats Löfdahl:
> When you use the "Save Window As" functionality in a cgwindow, the default file name is cgwindow.EXT in the current directory, where EXT depends on the format you want.
>
> If you want another file name you can select an existing file name or type in a new name in the popup dialogue. This becomes a bit tedious (and error prone) if you have to do it a lot. I've been looking for a way to specify the file name when creating the window but I can't find anything.
>
> Is there a way to do it?
I am aware of the output keyword to the cg plot commands, but they output directly. This is not what I'm looking for, I just want the default file name to be the one you specify, when you choose to use save your graphics (consisting of several commands) to a file.
|
|
|