Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

SRP_Com() with SRP Editor v2.9.1

Using SRP_Com(), I was having trouble getting the ShareName property of a Drive object. This should be a string value but I was getting a number, as if an SRP_Com() object is being returned. The ERROR service wasn't returning any error.

Here's a simplified version of the code:
Call SRP_Com( oFS,'CREATE', 'Scripting.FileSystemObject')
oDrive = SRP_Com( oFS, 'CALL', 'GetDrive', "F")
shareName = SRP_Com( oDrive, 'GET', 'ShareName')
error = SRP_Com( '', 'ERROR')

Through some rigorous trial and error, it appears that it only behaves this way if I have or had the SRP Editor open in the session at some time - !?. Without having opened SRP Editor first, this code would return a UNC path, as expected.
This is with SRP Editor v2.9.1, with SRP Util v4.0.6.4 . However, it doesn't occur with SRP Editor v2.7.1 (and still with SRP Util v4.0.6.4).

Bizarre! Can you replicate that?

Comments

  • Hmmm...I used your code verbatim other than changing the drive letter to one that I have mapped to a NAS and it works as expected. So, not sure why this is giving you problems.

    While this does not answer the mystery you are dealing with, you might have better results in getting the ShareName if you use SRP_Path:
    shareName = SRP_Path('PathToUnc', 'F:')
  • Thanks Don - SRP_Path() does the trick without issue. Very curious, I wonder what the difference is.
    Cheers, M@
Sign In or Register to comment.