GP SoftwareTwitter
Opus FAQsManualCommandsObjects

WOL on target which can't be reached


#29

In the next update we’ll add a way for a script to indicate that OnDoubleClick should only be called with the item’s path rather than a full Item object, which hopefully will avoid querying the item.


#32

Hello Leo,

There is a slight problem:
If it is the first time that I click on a network folder that is not accessible then it behaves as it should it initiate the my program of WOL.
If it is the second time that I click on a folder it displays the “Busy Circle” after some time (now not immediately) it initiate the WOL but then I get an error in the script error dialog box Object doesn’t support this property or method: ‘path.skipfull’ (0x800a01b6).
I write this line of code Path.skipfull = true after the line WOL.exe in the script.
It seems that there is a possible bug that after the first time of OnDoubleClick it does not behave as in the first time of calling this function.

Thanks


#33

Can we see the whole script?


#34

skipfull is a property of the OnDoubleClickData object, not the Path object.


#35

Jon,

I just replaced the OnDoubleClickData to Path in the function header declaration. like this:
Function OnDoubleClick(Path) instead of OnDoubleClick(OnDoubleClickData) should it introduce problems if I intend to use the function only once?


#36

This is the OnDoubleClick function:

Function OnDoubleClick(Path)

   Dim Result
   Result  = InStr(Path.Path.LongPath,"lib://")
   if(Result = 0) then
      Path.skipfull = true
      OnDoubleClick = False
      Exit Function   
   End If
   
   Dim NASPCName
   NASPCName = "NAS-PC"
   Dim Execute
   set Execute = DOpus.NewCommand
   Execute.RunCommand("@sync:D:\Software\Scripts\FileFolderCopyMove\Bin\Client\WOLComputerMustBeCompiledInx64Bits.exe " & """" & NASPCName & """")
   Path.skipfull = true

   if(Path.is_dir = FALSE) then
      Exit Function
   End If
    
End Function

#37

It also fired the WOL twice so it seems to me that the OnDoubleClick function is fired twice. After the error it is fired again. That how it looks to me I didn’t debug it fully to be certain regarding this behavior.


#38

Shouldn’t you be checking for a specific drive letter or UNC path? At the moment it will run the WOL program for anything other than a library path.


#40

The library path is a collections of Network Shared folders. I need only to trigger the OnDoubleClick event handler on the Libraries.

Thanks

Just to be clear. It is working properly the first time I double click on a Library folder. The second time introduces again the delay and the error that I have mentioned. If I exit Opus and run it again it is again working properly only during the first time.


#41

It works consistently here when I try your script. Try this minimal version. Turn on the Script Log (Help -> Logs -> Script Log) to see the output.

Function OnDoubleClick(Path)

   Dim Result
   Result  = InStr(Path.Path.LongPath,"lib://")
   if(Result = 0) then
      Path.skipfull = true
      OnDoubleClick = False
	  DOpus.Output "No WOL"
      Exit Function   
   End If
   
	DOpus.Output "WOL"
	Path.skipfull = true
    
End Function

#42

I used your minimal version and:

  1. If I use it on a Lib that is available then there are no problems. You need to test it by double clicking on a network folder that is not available and you will see that it introduces the delay of 30 seconds.
  2. I think that the error that is introduced is because that the script executed an external program (because that is the missing link between my script function and between your minimal version). To debug that there is a need to first correct the behavior of the delay that shouldn’t be introduced thanks to the modifications that you have made to the program.

Please check it on a network folder that is not available and let me know.


#43

None of the scripts above tell Opus not to read the folder, so they would not have any effect on the delay. You’d need to return true from the OnDoubleClick function if you want to tell Opus not to read the folder.

Running WOL.exe and then allowing Opus to read the folder immediately afterwards probably won’t solve things, unless your WOL.exe doesn’t just wake the server but waits until it has booted.


#45

WOL is waiting until the folder is completely available. Don’t you think that it should be enough?
The problem is that when I double click on a folder that is not available the first time it is working correctly. The second time if I again try it on a folder that is not accessible IT INTRODUCES THE DELAY AND IT DOES NOT INITIATE THE WOL. The WOL is initiated after the 30 seconds delay and also there is the error that I described above. Now I think that you understand what I was trying to say.

This is exactly what I was doing:

  1. Double click on a folder that is not available. It initiate the WOL immediately.
  2. Now the server is available because WOL was initiated in step 1
  3. Make the server unavailable (put it into sleep state)
  4. Double click on a folder that belong to this server. It will introduce the delay and the WOL is initiated only after the delay and it introduces the error

#47

In that case it should be fine.

So you’re not double-clicking a library? Your script only runs WOL.exe for libraries.


#48

I am double clicking on a library. All my libraries contain folders from network shares. So I do double click on a folder that is belong to a library (that contains network folders).
lib://My FolderA
lib://My FolderB
etc.


#49

Have you tried adding some DOpus.Output lines like in Jon’s script above to see when the script is being called and what it is doing?


#51

The following is the debug version:

Function OnDoubleClick(Path)

DopusOutput "Inside DC"
   Dim Result
   Result  = InStr(Path.Path.LongPath,"lib://")
   if(Result = 0) then
      Path.skipfull = true
      OnDoubleClick = False
      Exit Function
   
   End If

Dopus.Output "Before WOL"   
   Dim NASPCName
   NASPCName = "NAS-PC"
   Dim Execute
   set Execute = DOpus.NewCommand
   Execute.RunCommand("@sync:D:\Software\Scripts\FileFolderCopyMove\Bin\Client\WOLComputerMustBeCompiledInx64Bits.exe " & """" & NASPCName & """")
   Path.skipfull = true

   if(Path.is_dir = FALSE) then
      Exit Function
    End If
    
End Function

It should print to the log “Inside DC” but it does not print it out if I double click the second time like I described above. It print the “Inside DC” only after the delay. Then I get also the “Before WOL”. WOL is initiated and after it returns I get the following error messages:

 14-Apr-18 15:19  Double-Click:  inside
 14-Apr-18 15:19 Double-Click:  before wol
 14-Apr-18 15:19 Double-Click:  Error at line 103, position 4
 14-Apr-18 15:19 Double-Click:  Object doesn't support this property or method: 'path.skipfull' (0x800a01b6)

Line 103 is the line that I coded after the WOL.exe: “Path.skipfull = true”

Please note. It is not the first time that I receive errors with the same type (i.e. the script does not recognize his own argument Object that is being passed to the script function) IN DIFFERENT SCRIPTS EVENTS not only in OnDoubleClick! The same here the function does not know that the skipfull property belong to the OnDoubleClick(OnDoubleClickData) OnDoubleClickData argument.


#53

That script only has 25 lines so we can’t be looking at the same thing that is generating the error message.

There’s no OnInit function here either. Can we see the entire script, please?

I would also avoid using path.longpath as that may cause filesystem access to look up the path (and Opus won’t normally hand you a short path when double-clicking something). Just use the path as-is.


#54

Leo,

The “Path” that is passed to the OnDoubleClick function has a Path object and in this object it has only LongPath and ShortPath properties so what do I need to choose as a path?


#55

Just use the object itself, without specifying a property of it.