Automatic sequence before closing ctl document


asaikk

Recommended Posts

Hi,

In the project I am working on, I have a following requirement under the use conditions of 1) & 2).

<Use conditions>

1)The PCs where DAQFactory are installed are shut down every day after the daily work is finished.

2)A specific sequence (such as calculating the daily total value etc) is required to run before the shut down of the PC.

<Requirement>

Is it possible to run a sequence automatically before closing the ctl document, or maybe present on a screen a dialogbox to ask to run the sequence ?

If possible what would it be the script?

Of course it is possible to make a manual sequence, but automatic sequence is more preferable, as the workers may forget to run the manual sequence.

Thanks in advance.

Link to comment
Share on other sites

There is an OnQuit system event, but its usually better to simply make it so the customer can only quit DAQFactory by using a button you create. To do this:

1) run in full screen mode

2) do System.hideSystemMenu() to make the Windows close buttons disappear

3) create a button for them to quit the program. In it, run your closing script, then finally do System.Quit() to actually quit.

Note that neither of these methods are fool proof. A customer could simply power the machine down, or shut DAQFactory down hard through Task Manager.

Link to comment
Share on other sites

Many thanks for the advice.

I am afraid that the PCs we use can not be run in full screen mode, because programs other than DAQFactory are running on the same PCs.

Of course it is possible to make other programs active even with DAQ under full screen mode, but I do not expect every worker, especially inexperienced one, to handle this.

So would you please give an explanation on the "OnQuit system event" that you mentioned above?

By the way I tried the full screen mode, and was not able to return to the normal mode by F4 key when individual channel is open. How should I do on this case?

Thanks in advane.

Link to comment
Share on other sites

You can still use the hideSystemMenu() function to keep the program from quitting except through your button, though technically it can be shut down through task manager still. I was wrong about OnQuit. It's actually OnShutDown() and its talked about in section 5.28 of the user's guide. Note that any code there needs to be relatively fast and not require user interaction.

Link to comment
Share on other sites

Worked perfectly for me when I loaded your doc, at least once I took it out of full screen mode. The system menu is simply the icon at the top left corner and the three buttons at the top right corner of the DAQFactory window. The top bar that goes along the window is still there with "DAQFactory - testhideSystemMenu.ctl"

Link to comment
Share on other sites

Thank you for checking my doc.

However I still do not see the situation.

Would you please see the uploaded images of my PC screen before and after executing the sequence. It makes no changes at all!

(Since the doc is set to open in full screen mode, I had changed the mode to normal mode and tried the sequence.)

post-8497-0-39706600-1342144318_thumb.jp

post-8497-0-19878600-1342144335_thumb.jp

Link to comment
Share on other sites

In both cases the system menu is already hid. Try alternating between system.hidesystemmenu() and system.showSystemMenu(), or simply restart DF to display the system menu, then run your sequence. If you have your sequence marked auto-start, its never going to show the system menu.

Link to comment
Share on other sites

Many thanks for the advice.

I tried the "system.showSystemMenu()" sequence, and have learned what the system menu

is like.

Actually I was obsessed with the idea that the menu bar disappears too when the

system.hidesystemmenu() is run.

What led me think so is, as long as there is the menu bar on the screen, it would be

very difficult to prevent anyone from closing ctl-doc through file/exit on the menu

bar.

This concern still remains with the system menu hidden.

So the question I have now is, is there any command to hide the menu bar?

Link to comment
Share on other sites

Sure. Just run your app in runtime mode, either with a separate license (probably best) or put a document editing password on the doc to keep someone from opening the app in development mode. The password is set in File - Document Settings.... Or do both.

Link to comment
Share on other sites

>Just run your app in runtime mode, either with a separate license

>(probably best) or put a document editing password on the doc

>to keep someone from opening the app in development mode.

So it seems that there is no way to hide the menu bar for DAQFactory Express.

Is it right?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.