comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: wait loop
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: wait loop [message #26645] Thu, 20 September 2001 06:03 Go to next message
Dominik[1] is currently offline  Dominik[1]
Messages: 46
Registered: April 2001
Member
Hi,

thanks, that was what I was looking for, perhaps I didnt express my self
very good.


"ronn kling" <ronn@rlkling.com> schrieb im Newsbeitrag
news:B7CF5DD5.330B%ronn@rlkling.com...
> in article 9ocd41$mis$1@n.ruf.uni-freiburg.de, Dominik Paul at
> dpaul@ukl.uni-freiburg.de wrote on 9/20/01 5:28 AM:
>
>> we would like to check a directory, if there is a file every 10 oder 20
>> minutes in an IDL programm For this we would like to use a waitung
funktion,
>> in a loop, which doesnt cost to much processor time.
>>
> Dom,
>
> What you want to use is a timer event for widgets. This doesn't use any
cpu
> time until the event fires off. If you don't have any widgets as part of
> your program you can still create a simple base and keep map=0 so that it
> never becomes visible.
>
> -Ronn
>
>
> --
> Ronn Kling
> KRS, inc.
> email: ronn@rlkling.com
> "Application Development with IDL" programming book updated for IDL5.4!
> "Calling C from IDL, Using DLM's to extend your IDL code" NEW BOOK!
> http://www.rlkling.com/
>
>
Re: wait loop [message #26646 is a reply to message #26645] Thu, 20 September 2001 06:53 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning (david@dfanning.com) writes:

> Here it is. Note no error
> checking!

Uh, well, or any cleanup. Here is a slightly
better version. Next time, I'm going to wait
a year until I post. :-(

Cheers,

David

******************************************
PRO TestForFile_Event, event
Widget_Control, event.top, Get_UValue=filename
dummy = Findfile(filename, Count=count)
IF count EQ 0 THEN BEGIN
Widget_Control, event.top, Timer=5
Print, 'Still looking...
ENDIF ELSE BEGIN
Widget_Control, event.top, /Destroy
Print, 'Found File: ', filename
ENDELSE
END


PRO TestForFile, filename
tlb = Widget_Base(Map=0)
Widget_Control, tlb, /Realize, Set_UValue=filename
Widget_Control, tlb, Timer=5
XManager, 'testforfile', tlb, /No_Block
END
******************************************

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: wait loop [message #26647 is a reply to message #26645] Thu, 20 September 2001 06:51 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ronn Kling (ronn@rlkling.com) writes:

> What you want to use is a timer event for widgets. This doesn't use any cpu
> time until the event fires off. If you don't have any widgets as part of
> your program you can still create a simple base and keep map=0 so that it
> never becomes visible.

Because I wasn't sure if an unmapped widget could
actually receive a timer event, I just coded a file-
seeking program up. Here it is. Note no error
checking!

************************************************
PRO TestForFile_Event, event
Widget_Control, event.top, Get_UValue=filename
dummy = Findfile(filename, Count=count)
IF count EQ 0 THEN BEGIN
Widget_Control, event.top, Timer=5
Print, 'Still looking...
ENDIF ELSE Print, 'Found File: ', filename
END


PRO TestForFile, filename
tlb = Widget_Base(Map=0)
Widget_Control, tlb, /Realize, Set_UValue=filename
Widget_Control, tlb, Timer=5
XManager, 'testforfile', tlb, /No_Block
END
**************************************************

I ran it like this:

IDL> TestForFile, 'butter.pro'

Here is my output. Note, I had to save a file
named "butter.pro" to get the think stopped. :-)

Still looking...
Still looking...
Still looking...
Still looking...
Found File: butter.pro

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: wait loop [message #26649 is a reply to message #26645] Thu, 20 September 2001 06:17 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Dominik Paul wrote:
>
> I think, this kind of loop needs to much processor power. We would like to
> have somethink you nearly dont notice, that there is a IDL task running in
> the back.



Yes, I know, I missed the wait command.

WHILE time_now LT ask_time DO begin
time_now = string2js(/now)
wait,0.5 ; saves CPU time
endwhile


Ronn's answer is the best solution if you like doing this by idl.

Reimar


>
> Dom
> "Reimar Bauer" <r.bauer@fz-juelich.de> schrieb im Newsbeitrag
> news:3BA9D5EC.504C0EB3@fz-juelich.de...
>> Dominik Paul wrote:
>>>
>>> hi there,
>>>
>>> we would like to check a directory, if there is a file every 10 oder 20
>>> minutes in an IDL programm For this we would like to use a waitung
> funktion,
>>> in a loop, which doesnt cost to much processor time.
>>>
>>> Does somebody know a waiting function for this problem, because I coulnd
>>> find anything suitable in the IDL help files.
>>>
>>> Thanks
>>>
>>> Dom
>>
>>
>> Dear Dom,
>>
>> are you looking for something like:
>>
>>
>> FUNCTION wait_until_daytime,day_time
>>
>> ask_time = string2js(day_time)
>> time_now = string2js(/now)
>>
>> IF ask_time lt time_now THEN return,0
>>
>> WHILE time_now LT ask_time DO time_now = string2js(/now)
>>
>> RETURN,1
>> END
>>
>>
>> result=wait_until_daytime('2001-09-20 13:35:00 000')
>>
>>
> http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/downl
> oad/string2js.tar.gz
>>
>>
>> regards
>> Reimar
>>
>> --
>> Reimar Bauer
>>
>> Institut fuer Stratosphaerische Chemie (ICG-1)
>> Forschungszentrum Juelich
>> email: R.Bauer@fz-juelich.de
>> http://www.fz-juelich.de/icg/icg1/
>> ============================================================ ======
>> a IDL library at ForschungsZentrum Juelich
>> http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
>>
>> http://www.fz-juelich.de/zb/text/publikation/juel3786.html
>> ============================================================ ======
>>
>> read something about linux / windows
>> http://www.suse.de/de/news/hotnews/MS.html

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
Re: wait loop [message #26650 is a reply to message #26645] Thu, 20 September 2001 05:52 Go to previous message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
in article 9ocd41$mis$1@n.ruf.uni-freiburg.de, Dominik Paul at
dpaul@ukl.uni-freiburg.de wrote on 9/20/01 5:28 AM:

> we would like to check a directory, if there is a file every 10 oder 20
> minutes in an IDL programm For this we would like to use a waitung funktion,
> in a loop, which doesnt cost to much processor time.
>
Dom,

What you want to use is a timer event for widgets. This doesn't use any cpu
time until the event fires off. If you don't have any widgets as part of
your program you can still create a simple base and keep map=0 so that it
never becomes visible.

-Ronn


--
Ronn Kling
KRS, inc.
email: ronn@rlkling.com
"Application Development with IDL"� programming book updated for IDL5.4!
"Calling C from IDL, Using DLM's to extend your IDL code" NEW BOOK!
http://www.rlkling.com/
Re: wait loop [message #26651 is a reply to message #26650] Thu, 20 September 2001 04:41 Go to previous message
Dominik[1] is currently offline  Dominik[1]
Messages: 46
Registered: April 2001
Member
I think, this kind of loop needs to much processor power. We would like to
have somethink you nearly dont notice, that there is a IDL task running in
the back.

Dom
"Reimar Bauer" <r.bauer@fz-juelich.de> schrieb im Newsbeitrag
news:3BA9D5EC.504C0EB3@fz-juelich.de...
> Dominik Paul wrote:
>>
>> hi there,
>>
>> we would like to check a directory, if there is a file every 10 oder 20
>> minutes in an IDL programm For this we would like to use a waitung
funktion,
>> in a loop, which doesnt cost to much processor time.
>>
>> Does somebody know a waiting function for this problem, because I coulnd
>> find anything suitable in the IDL help files.
>>
>> Thanks
>>
>> Dom
>
>
> Dear Dom,
>
> are you looking for something like:
>
>
> FUNCTION wait_until_daytime,day_time
>
> ask_time = string2js(day_time)
> time_now = string2js(/now)
>
> IF ask_time lt time_now THEN return,0
>
> WHILE time_now LT ask_time DO time_now = string2js(/now)
>
> RETURN,1
> END
>
>
> result=wait_until_daytime('2001-09-20 13:35:00 000')
>
>
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/downl
oad/string2js.tar.gz
>
>
> regards
> Reimar
>
> --
> Reimar Bauer
>
> Institut fuer Stratosphaerische Chemie (ICG-1)
> Forschungszentrum Juelich
> email: R.Bauer@fz-juelich.de
> http://www.fz-juelich.de/icg/icg1/
> ============================================================ ======
> a IDL library at ForschungsZentrum Juelich
> http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
>
> http://www.fz-juelich.de/zb/text/publikation/juel3786.html
> ============================================================ ======
>
> read something about linux / windows
> http://www.suse.de/de/news/hotnews/MS.html
Re: wait loop [message #26652 is a reply to message #26651] Thu, 20 September 2001 05:28 Go to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
Reimar Bauer wrote:
> Dominik Paul wrote:
>
>> hi there,
>>
>> we would like to check a directory, if there is a file every 10 oder 20
>> minutes in an IDL programm For this we would like to use a waitung funktion,
>> in a loop, which doesnt cost to much processor time.
>>
>> Does somebody know a waiting function for this problem, because I coulnd
>> find anything suitable in the IDL help files.
>>
>> Thanks
>>
>> Dom
>>
>
>
> Dear Dom,
>
> are you looking for something like:
>
>
> FUNCTION wait_until_daytime,day_time
>
> ask_time = string2js(day_time)
> time_now = string2js(/now)
>
> IF ask_time lt time_now THEN return,0
>
> WHILE time_now LT ask_time DO time_now = string2js(/now)
>
> RETURN,1
> END
>
>
> result=wait_until_daytime('2001-09-20 13:35:00 000')
>
> http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/string2js.tar.gz
>
>
> regards
> Reimar
>
>

I can't actually test this procedure as I don't have string2js, but it
looks to me as though it would use around 100% of the CPU while it's
waiting.

That's not very friendly if it's a multiuser system.


--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
Re: wait loop [message #26653 is a reply to message #26651] Thu, 20 September 2001 05:25 Go to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
Dominik Paul wrote:
> hi there,
>
> we would like to check a directory, if there is a file every 10 oder 20
> minutes in an IDL programm For this we would like to use a waitung funktion,
> in a loop, which doesnt cost to much processor time.
>
> Does somebody know a waiting function for this problem, because I coulnd
> find anything suitable in the IDL help files.
>
> Thanks
>
> Dom
>
>
>

Well, there's a WAIT procedure. Won't that do?

Does it have to be a function? ;-)

--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
Re: wait loop [message #26654 is a reply to message #26651] Thu, 20 September 2001 05:20 Go to previous message
pit is currently offline  pit
Messages: 92
Registered: January 1996
Member
Reimar Bauer <r.bauer@fz-juelich.de> writes:
> Dominik Paul wrote:

>> we would like to check a directory, if there is a file every 10
>> oder 20 minutes in an IDL programm For this we would like to use a
>> waitung funktion, in a loop, which doesnt cost to much processor
>> time.

> WHILE time_now LT ask_time DO time_now = string2js(/now)

Hmm, I think he was looking for something that doesn't consume too
much processor time....

What's about a simple wait, seconds

Pit

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Dr. Peter "Pit" Suetterlin http://www.astro.uu.nl/~suetter
Sterrenkundig Instituut Utrecht
Tel.: +31 (0)30 253 5225 P.Suetterlin@astro.uu.nl
____________________________________________________________ ______________
Re: wait loop [message #26655 is a reply to message #26651] Thu, 20 September 2001 04:41 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Dominik Paul wrote:
>
> hi there,
>
> we would like to check a directory, if there is a file every 10 oder 20
> minutes in an IDL programm For this we would like to use a waitung funktion,
> in a loop, which doesnt cost to much processor time.
>
> Does somebody know a waiting function for this problem, because I coulnd
> find anything suitable in the IDL help files.
>
> Thanks
>
> Dom


Dear Dom,

are you looking for something like:


FUNCTION wait_until_daytime,day_time

ask_time = string2js(day_time)
time_now = string2js(/now)

IF ask_time lt time_now THEN return,0

WHILE time_now LT ask_time DO time_now = string2js(/now)

RETURN,1
END


result=wait_until_daytime('2001-09-20 13:35:00 000')

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/string2js.tar.gz


regards
Reimar

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Way to determine big/little endian?
Next Topic: Re: Free-hand ROIs using DRAW_WIDGET

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:46:23 PDT 2025

Total time taken to generate the page: 0.00847 seconds