Action for CustomWindow - Forum

Forum Navigation
You need to log in to create posts and topics.

Action for CustomWindow

Query: How do I auto-execute an action AFTER a CustomWindow action without the CustomWindow being non-exclusive?

In other words... How do I open a CustomWindow, THEN check if a folder has files in it (using FileList), then give an AlertBox if the folder is empty. _OnOpen doesn't work here. In this case I may as well have my script right before the CustomWindow action.

I need the window open before the alert box and I need the alert box before any user interaction.

@pauljonestindall

How do I open a CustomWindow, THEN check if a folder has files in it (using FileList), then give an AlertBox if the folder is empty. _OnOpen doesn't work here. In this case I may as well have my script right before the CustomWindow action.

I need the window open before the alert box and I need the alert box before any user interaction.

_OnOpen is triggered BEFORE the CustomWindow is rendered; too bad there isn't another subroutine that is triggered AFTER the Custom Window is rendered.

One option would be to ...

- check the folder in the _OnOpen subroutine
- if none exist, start a Timer ('stop after one execution' checked) with the AlertBox in its Action section

... a bit tricky to find the exact TimerInterval that is not too early nor too late.

From your post, it seems that you want to alert the user but not prevent him/her from continuing with the interactions with the contents of the Custom Window ... if this true, you might consider another option ... i.e. simulate an AlertBox (of sorts) visual ... i.e. have another Container within the Custom Window (that covers the entire surface of the CustomWindow (and with ObjectToFront property), perhaps with a transparent background, and containing some Text and an OK Button; then ...

- check the folder in the _OnOpen subroutine
- if files exist, HideObject the Container masquerading as an AlertBox
- else, wait for the user to click the OK Button inside the masquerading AlertBox Container (have the button's click action do the HideObject thingy)

I have not tried this design but it just might work for you; let us know if you run into obstacles.

@Gaev

The idea here is to alert the user that a certain file type (i.e. *.dat) does not exist in a particular folder so that they're better informed of what to do while in the CustomWindow. In this case the CustomWindow needs to be exclusive.

Yeah, a bit tricky and not really practical with the timer because this will be used on multiple computers. But I do like the HideObject AlertBox suggestion. I can make that work.

Thanks.

@pauljonestindall

You can programmatically find out whether the CustomWindow window is open or not, using the plugin:
zmFunctions 1.0b (Peter Pavlov) = zmIsCustomWindow
Determine the state of the external NeoBook window (visibility, minimized, maximized, etc.).

@vadim

Thanks for the suggestion. Do you or does anybody happen to have an .loc file for zmFunctions?

Quote from Vadim on March 9, 2020, 8:40 pm

You can programmatically find out whether the CustomWindow window is open or not

Плагин здесь не нужен. Есть переменная .WinHandle.

The plugin is not needed here. There is a variable .WinHandle.

Gaev correctly said about the timer.

Subprograms

:Container1_OnOpen
TimerStart "Timer1" "100"
Return
:Container1_OnClose
TimerStop "Timer1"
Return

Timer

If "[Container1.WinHandle]" "<>" ""
Here we perform the necessary actions...
TimerStop "Timer1"
EndIf