Re: Viewing a plot under bash? [message #62771] |
Tue, 07 October 2008 22:57  |
eyuchen
Messages: 8 Registered: February 2008
|
Junior Member |
|
|
Hi guys,
After some thinking, I think EOF was indeed sent into IDL.
<<eof initiates a here document, which acts as a normal document.
Since normal documents ends with EOF, so should the here document.
I think that's why people conventionally use <<eof to start the
here document.
Besides, I want to share a small utility called "point" here.
This procedure call print out the location of your mouse cursor
when you left-click, and returns to previous level when you
click your right button.
;start of point
pro point
xsave=!values.d_nan
ysave=!values.d_nan
while(1) do begin
cursor,x,y
if(!mouse.button eq 1 and ((x-xsave) ne 0 or (y-ysave) ne 0)) then
print,'(x,y)=',x,y
xsave=x
ysave=y
if !mouse.button eq 4 then break
endwhile
END
;end of point
The procedure is not as naive as I first thought. Turns out that each
of our mouse click
is actually composed of many clicks. So without the "if" statement,
one will get hundreds of repetitive printouts.
Hope this is useful to you guys. :)
On Oct 6, 10:14 am, eyuc...@gmail.com wrote:
> Hi guys,
>
> All suggestions are working! Thank you all!
>
> One issue to point out: Russell, you might want to use the
> oneliner
> "while(!mouse.button ne 4) do cursor, xp, yp"
> instead of the full-fledged while loop.
> If you use the full-fledged loop, the program never returns.
> (I don't know why, maybe the folks in itt just forgot to define IDL's
> behavior in this circumstance)
>
> And while this all works great, my questions remained:
> the "cursor" statement waits the user to click, so the script stopped
> to wait my click before it ends, right?
> then what's wrong with "stop"? shouldn't it be waiting the user to
> type in .cont? I suppose "eof" was not sent
> into idl?!
>
> I also tried things like the "pause" function (which I grabbed from
> the internet) and read, junk. None of them
> worked either.
>
> The response to "read, junk" is "% READ: End of file encountered.
> Unit: 0, File: <stdin>"
>
> On Oct 6, 2:27 am, RussellGrew <russell.g...@gmail.com> wrote:
>
>> Could you be sneaky and put in a click grabber after your plot?
>
>> In this case, right click on the plot to continue...
>
>> while(!mouse.button ne 4) do begin
>> cursor, xp, yp, /data, /down
>> endwhile
>
>> [assuming this does the trick you could obviously alter it to act on a
>> key press]
|
|
|