WOL on target which can't be reached


When a older or a tab have items which can't be reached it is normally a USB drive or a shared network folders or a network drive. It takes very long time for DOpus to give up maybe 30 seconds, but I have and idea how to solve it in my situation and maybe others will like this too?
Would it be possible to get an event trigger whenever you are trying to navigate to a folder or a tab but the destination is not reachable? Getting this event maybe after 5 seconds sounds reasonable. By hooking to this event I can write a script that will issue a "Wake On Lan" command. If I can get in the event what was the target then I will know which server to wake up.
If it is feasible at your side, I would appreciate your collaboration.


You might be able to use the existing OnBeforeFolderChange event, and just sent the Wake-On-LAN for the server whether it is up or not, since there's no harm asking a server to wake when it's already awake.

I don't know if this would avoid the delay, though. I'm not sure if Windows sends multiple requests when attempting to connect to a network resource, or if it just sends one request and then waits for a response or timeout.

Newer versions of Opus have some improvements to let you navigate away from an unavailable network share before the timeout (letting the timeout happen on a background thread), but there may still be places where it does block things, as it's very difficult to avoid all of them.

Thank you I will try it, but where is the scripts wizard the "Create new script" dialog box that I see on the help section. I just can't find it.

Hello Leo,
I would need your help if I may.
I tried to use this event what I did is the following:

Function OnSourceDestChange(sourceDestChangeData)
dim abc
abc = 1
dopus.output abc
End Function
But this event is not triggered because I don't get the DOPus.Output. Can you please try this simple function and let me know if you can get this event?


I don't think OnSourceDestChange would be the event you want. Try the one I suggested above.

Hello Leo,

I apologize for bothering you but I don't have a lot of experience writing DOpus scripts.
This is what I did
Function OnBeforeFolderChange(beforeFolderChangeData)

OnBeforeFolderChange TRUE

End Function

I wanted to test if it would not navigate to the folder because the function returned TRUE
but I got an error saying Error at line 37, position 5 this is this line OnBeforeFolderChange TRUE
and after that I receive another error Out of stack space: 'OnBeforeFolderChange' (0x800a001c)
I would appreciate any help.


You may need to brush up on your VBScript :slight_smile:

Try this function; it will look for a path beginning with X: and run a program (in the example, "wakeonlan.exe") if the path matches.

If you want to stop the path being read, add a line with OnBeforeFolderChange = True.

' Called before a new folder is read in a tab
Function OnBeforeFolderChange(beforeFolderChangeData)

	' example: assume X: is the drive we need to wake
	If StrComp( Left(beforeFolderChangeData.path, 2), "X:", vbTextCompare ) = 0 Then
		' issue the command to wake the drive (put your own command here)
		DOpus.Create.Command.RunCommand "wakeonlan.exe X:"

	End If
End Function

I am sorry but the OnBeforeFolderChange event is fired after OnDoubleClick, so I used the OnDoubleClick event but it is not working. If I double click on a folder that is not accessible DOpus is showing the "Busy Circle" of trying to navigate to this folder. Only after about 30 seconds it is released and then the OnDoubleClick event is fired. Is it possible that you add an event that is fired prior to OnDoubleClick?

Thank you

There are questions that being asked by the DOPus software before triggering the event hook to the script. What I am trying is to avoid those questions and get the OnDoubleClick or another new event that will trigger the event to the script while "No questions asked" by the DOpus software.

There probably are, yes, like "is this a file or a folder that's being double-clicked?" which involves getting the file attributes.

This may be a better approach:

If you tell Windows not to wait 30 seconds for a reply before deciding a network resource is not available, it will speed things up, if you can't avoid having unavailable network resources. 30 seconds is quite excessive these days, even for a network share on the other side of the world, but has remained the default in Windows since the days of networking over tin cans and pieces of string.

I have tried all the registry modifications per your suggestion but none of them worked. It is still at least 30 Seconds to wait for a network share that is not available. Would it be possible that you will add a new event that is completely RAW, (i.e. it does not ask for an attribute or existence) it will just fire the event on a double click of an item in a tab (a folder or a file). By using this it is very easy to determine if a file or a folder exist and it does not take 30 seconds to do it, I will really appreciate if you will be able to add it to the list of supported scripts events in your software. Also I don't understand why you have to wait so long to understand that you can't figure out if it is a file or a folder before giving up. If you can't or will not add the event that I am referring to will you be able to expose a variable that holds the waiting time, this way it will be possible to reduce it using the Settings->Preferences->Advanced.

Thank you

How do you intend to determine if the file or folder exists?

I normally write programs in C++ but for this project (the WOL) I am using Autohotkey programming language which is very simple to code. I am writing a small script that will accept the Tab.Path as an argument. It will be called in the DOpus VBS OnDoubleClick Script. I only need to ask ifexist(Path) and I get immediately the attribute, if the attribute is equal to "" then it can't find it and therefore I understand that it is a path that is not accessible. If it is not accessible I issue a WOL command. Again just to be clear getting the result of an existence of a path is immediate in AutoHotKey.


Just another note. It takes about 30 seconds for DOpus to give up, but after that the OnDoubleClick event is fired. Although the path does not exist I do get the real path in the doubleClickData.tab.Path , so actually the path as a string does exist in your software (you know exactly what has been double clicked, it does not matter if this path exist or not) you can immediately pass it to the OnDoubleClick function without even knowing if it is really exist or not. There is no need, at least from my point of view, to check if a path is a folder or a file before firing the OnDoubleClick event function.

That is not going to work. It will take 30 seconds for ifexists(Path) to return. This is the same problem Opus has, and that anything else on Windows trying to inspect the path will have.

Windows may respond more quickly if something has just triggered the 30 second timeout, but the first thing to attempt to access the path in any way -- including just checking if it exists -- is going to trigger the timeout. All you will be doing is moving the timeout from one thing to another.

The only way to speed this kind of thing up is to constantly check the path in the background, just in case it is needed, and cache the results. Then, when something needs it for real, reply with the most recent result.

You are right the result of existence is cached in Windows and after the OnDoubleClick event is fired I can get the results immediately. Now I am back to your suggestion of reducing the timeout that windows is waiting for a response. It doesn't seem that the registry modifications do work. Maybe it wasn't the right ones to change. Maybe you have the right constant in the registry that changes the timeout.

Thanks for your help.

The command netsh interface tcp set global initialRto=300 is probably the right command to change the session waiting timeout. I can now use Autohotkey and it takes about 5 seconds to get a result if a folder does not exist. But by using your software to double click on a file/folder it still takes 30 seconds. If you will be able to add an event on double click (but don't ask if it exist) I can now issue a WOL after 5 seconds.

I apologize but I got confused. Actually I don't need the IfExist function to determine if a folder exist or not. I can just use the ping command to check if the server exist. It takes a few milli seconds doing it. If you can add an event ObDoubleClick without asking anything at all just fire the event I can easily issue a WOL command after a mouse click in a few milli seconds.

You can change what double-click does using the Filetypes system.

I have tried that also but it is the same waiting time of 30 seconds. I still don't understand why you need to check for file/folder attribute prior to passing the OnDoubleClick event to the script. In the script the user can always check if it is a file or a folder using the IS_Dir. In my point of view (and I don't think it is a narrow one) if you get a mouse click on an item then just pass the item to the script regardless if it is a folder or a file. It is very annoying to wait for such a long time. The whole Lister is just frozen. You can solve this so easily and transparently just fire the event. It doesn't look to me that if you will make this modification it will change anything for the other users who are using the script OnDoubleClick. Why are you so stubborn. You suppose to have a software that is better than Windows file explorer but regarding this matter you are not. Please reconsider.
Looking forward to your positive decision.
Thank you

Maybe this unnecessary check if it is a file or a folder is the reason why others have been complaining that double clicking on a folder is not as responsive as in windows explorer?! And it is definitely less responsive than on Windows explorer. At least let the users of your script to decide what to do when a double click occurred.

I'm not actually sure it is that, or that we do that check. It was just a hypothetical example.

Can I ask why are you double-clicking things that don't exist so often that it matters to this extent?

I am writing this to help our users in my workplace. It is not only for me. The scenario is as follows: 1. A user opens a lister with one of the tabs a network folder that he uses.
2. The server is not always ON. It goes to sleep while not being accessed for a minimum time
3. The user click on the folder but the folder is not accessible. The whole lister is frozen up for at least 30 seconds that could be avoided if you just fire the double click event to the OnDoubleClick function

If it is hypothetical and you are not sure why the delay is happening then please check it in your software. It seems to me that other users of Opus will benefit if you will be able to pass the event without redundant check to the OnDoubleClick function.