Question
Douglas Ruisaard · Dec 8, 2020

open an interactive window from within a running jobbed Cache routine

I like to be able to call an "autohotkey" executable message box from within a running Cache routine executing as a jobbed routine. The autohotkey executable displays a small pop-up window with a message and an "OK" button .. and will time out in 10 seconds if the user does not press the OK button.

Although $ZF(-1,cmd) executes (where "cmd" contains a simple batch command e.g. @c:\autohotkey\warning.exe), no interactive window appears and, once the autohotkey routine times out, the calling cache routine simply continues.

I am not a very sophisticated Cache developer and I'd very much appreciate as simple an approach as possible... or even know if this can be done at all or not

Thanks in advance
Doug

$ZV: Cache for Windows (x86-64) 2011.1 (Build 532.0_SU) Fri Jul 22 2011 02:36:28 EDT
0
0 148
Discussion (5)0
Log in or sign up to continue

The issue not in Caché, it’s in Windows, which just not allows any interaction from services. You can enable it by editing service.

But in your case I would look into other ways for interaction. Server means, that in 99% of time it works alone with no people sitting behind the screen, even it should not have a screen at all. So, in normal case it’s very small chance that anybody will see your message and press ok.

If you need a suggestion on how would it better, please describe what’s exactly you are trying to achieve.

Thanks, Dmitriy ... the whole process leading up to needing the display of a user-interactive pop up window is rather complicated... but suffice it to say that I need a Cache routine, running in the background, to trigger an interactive window on the user's desktop.  The user is actively using the Windows Server desktop to interact with an application maintenance routine.

I think I've got a solution... I can build a task for the Windows Task scheduler from within the running Cache routine and the task will run the popup.  Seems to work in principle...

Thanks for the help.  If you or anyone else thinks of an alternative, I'd love to hear it!

Cheers ... Doug

There are two points,

the first (catchwords: server, interaction) was already answered by Dmitriy Maslennikov 

the second is your 10 second popup button.

In my over 40 years of IT-experience, there is one thing (along with others) I have learnd, is: every timeout is wrong, but messages with timeouts are evil! Whatever time you use, it's either too short or too long.

Imagine, the phone is ringing abd the user has a hot 20 minute discussion on the phone, in the meantime, your popups comes and goes! Unseen! Sometimes several times!

The only resonable solutions are,

- if the message is (just) informative and the message text never changes, then put it into a logfile and show nothing.  If the message text is a variable text ("Data is saved" vs. "Can't save: No disk space available") then do the popup with one button (or textinput), see below, but DO NOT use timeouts! 

- if the situation allows the user to choose between multiple answers, then let the popup window with those OK, YES, NO, CANCEL, etc. buttons stay there, as long as the user chooses one of them, or as an alternative (application dependent), offer an ordinary text input and at sometime the user types the answer and pushes the enter key.

Messages with (possible with short) timeouts requires a user all the time gazing on the display - which you can't expect.

justmy2cents

Thank you, Julius, for your reply.  The timeout mentioned is a bit of a red herring in that I used a timeout in my testing to avoid having the attempted call out from the Cache routine hang and having to kill the process manually.  Of course I understand about timeouts and match your 40 years experience in development, user interfaces, instrument interfaces, consulting and coding.

My experience show that needing to depend on USERS to "do the right thing" .. e.g look at a log file or even read an email is NOT a realistic expectation and far from reliable.  However, each to their own.

The main topic, which has NOT been addressed although "hinted at" from Dmitriy, is how to produce a user-interactive window on the server's desktop for which the content and trigger for appearing comes from a Cache routine running in the background.. i.e. jobbed.

I'm going to try creating a Task Scheduler entry (using a "schtask" call which will, in turn, call an executable which produces the interactive window) from within the Cache routine and have the task scheduler generate the popup.  Seems to work in principle ... we'll see if it works in practice.  ANY other suggestions are very welcome.

I'd appreciate it if replies centered on how to produce the interactive window, if possible.... but all other discussions are welcome.

Cheers!   Doug

To make things clear, the mentioned popup message should be seen by someone, who is (most of the time) working on the servers console. Is it so? Or you want to popup this message on an arbitrary desktop, where a user works?

If I need to send a message to a user, either I send an email or I activate a popup message in my client (I have a very special client-UI).

By the way, you wrote, I quote "an email is NOT a realistic expectation and far from reliable". Today, (almost) everybody has a smartphone and I think, if somebody does not read an email, he/she won't read thos popup messages either. Of course, you should send short plain text messages and not those fancy bloated colorful emails.

So, a way to a solution... you could write a  small program (C++, VB, Delphi, etc.) which is started after user login.  The program should listen on a TCP port for messages from an arbitrary Cache/Iris (possibly background) application. If such a message arrives, this helper program changes to foreground, displays the message with or without an OK button. That's it.