Did you type this into the keyboard:
sys_timer_z_ =: (echo 'hello')
hello
? If so, you had a clue: why did the system type 'hello'?
That should make you wonder what the definition of sys_timer_z_ really
is. Ask the JE:
sys_timer_z_
?? NOTHING?? Is it a verb?
4!:0 <'sys_timer_z_'
0
No, it's a noun. What is its shape?
$ sys_timer_z_
0 0
Oh. It's the type of empty value that prints 0 lines. But how did it
get that value?
I'll leave it to you to think about that.
Henry Rich
On 1/2/2021 6:53 PM, cilz wrote:
As a first attempt here what I did :
sys_timer_z_ =: (echo 'hello')
wd 'timer 5000'
but I get only one "hello" and nothing more.
And it didn't work at all with my own function!
Did I do anything wrong ?
Best, Eric
Le 03/01/2021 à 00:16, Raul Miller a écrit :
Ah, yes... the systimer event handler is the only way to go here.
Basically,
1) you implement the body of your loop as a monadic verb which ignores
its y argument. Let's call that verb xyzzy.
2a) You define sys_timer_z_=: xyzzy
2b) You decide on a polling interval -- lets say 1234 milliseconds,
and you set it to running using the wd timer mechanism: wd 'timer
1234' (You'll want to use a shorter interval once you're confident
that things work right. But it's probably good to start slow.)
https://code.jsoftware.com/wiki/Guides/Window_Driver/Event_Handling
https://code.jsoftware.com/wiki/Guides/Window_Driver/Command_Reference
Note that debugging this can be interesting, because of how errors
will interfere with what you are trying to do to debug it. So the
first time you run into a problem you'll probably have to shut down J
(make sure your work is saved in scripts), and then after that you'll
probably want to start working with techniques for regaining control
and/or extracting useful information to isolate the errors. (Not
complicated / still needs experience and understanding.)
But this should at least get you started.
Good luck,
-- Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm