real time [message #63929] |
Mon, 24 November 2008 06:37  |
mauroasi
Messages: 3 Registered: November 2008
|
Junior Member |
|
|
Hi,
someone knows if exists some way to monitor a folder with Idl? I would
like automatically execute a procedure when a file occurs in a
determinate folder, I mean is it possible elaborate data in real time?
I have to download data in a folder and need to elaborate them
immediately.
Thanks
Mauro
|
|
|
Re: real time [message #64015 is a reply to message #63929] |
Mon, 24 November 2008 09:41  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Write an application that uses a timer event loop to check the directory
of interest at a frequency that is appropriate. While timers are part
of the widget framework, you don't have to write a full blown GUI app.
Simply create a widget base with MAP=0. Here's a simple example:
pro timer_test_event, ev
; get our nReps data
Widget_Control, ev.id, GET_UVALUE=nReps
; increment our counter
++nReps[0]
; print a message
print, 'Hello!'
if (nReps[0] LE nReps[1]) then begin
; set another timer event if we're not done
WIDGET_CONTROL, ev.top, TIMER=1
; update the nReps data
WIDGET_CONTROL, ev.id, SET_UVALUE=nReps
endif else begin
print, 'Done'
WIDGET_CONTROL, ev.top, /DESTROY
endelse
end
pro timer_test
; define a variable to store the total number of reps
; and the current repitition
nReps = [1, 10]
; create a widget base, set map=0 so we never see it
timerBase = WIDGET_BASE(MAP=0)
WIDGET_CONTROL, timerBase, /REALIZE
; store our nReps value in the user value of the widget
WIDGET_CONTROL, timerBase, SET_UVALUE=nReps
; set the timer for a 1 second delay
WIDGET_CONTROL, timerBase, TIMER=1
; start xmanager to handle our events
XMANAGER, 'timer_test', timerBase, /NO_BLOCK
end
-Rick
mauroasi@iol.it wrote:
> Hi,
> someone knows if exists some way to monitor a folder with Idl? I would
> like automatically execute a procedure when a file occurs in a
> determinate folder, I mean is it possible elaborate data in real time?
> I have to download data in a folder and need to elaborate them
> immediately.
>
> Thanks
> Mauro
|
|
|