Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 08 NOV 2012 01:44:15PM paxton scott wrote:

Greetings!

Last January, I had a discusson where I was wanting to determine the available diskspace on a networked drive.

Using OengineServer, I found that a using a mapped drive letter with DSpace does not work.

Jared kindly showed me some code that takes advantage of MS's WScript (maybe should use CScript)

to accomplish this. At the time, I looked at it and though maybe I'd use php instead and dropped it.

Well, it has come to the forefront now.

I have added the code that Jared suggested to my Basic+ routine, but I get a compile error on the Last Line and I assume there is a syntax error which I can not seem to find. The code Jared shared is shown below. Can someone point me towards the possible error, or typo?

There are methods to map the drive letter so you can call dspace(). Another method is to use VBScript and query the share directly. Here is a BASIC+ code example that uses the Scripting.FileSystemObject control:

WScript=oleCreateInstance("ScriptControl")

OlePutProperty(wscript, "Language", "VBScript")

drvPath=\servername\share name\" ;*Drive or Share Name to check for Freespace

;*Returns the free space of drvPath in bytes.

RetVal=WScript-]Eval('CreateObject("Scripting.FileSystemObject").GetDrive(CreateObject("Scripting.FileSystemObject").GetDriveName("' : drvPath : '")).FreeSpace')

Thanks,

Paxton

Have fun.


At 09 NOV 2012 08:44AM Jared Bratu wrote:

Paxton, It looks like the code example got mangled a little bit. Here is the correct format:


WScript=oleCreateInstance("ScriptControl")

OlePutProperty(wscript, "Language", "VBScript")

drvPath="\\server\share"	;*Drive or Share Name to check for Freespace



;*Returns the free space of drvPath in bytes.

RetVal=WScript->Eval('CreateObject("Scripting.FileSystemObject").GetDrive(CreateObject("Scripting.FileSystemObject").GetDriveName("' : drvPath : '")).FreeSpace')



;*Convert bytes to GB

FreeSpaceGB = RetVal / 1024 / 1024 / 1024


At 09 NOV 2012 08:47AM Jared Bratu wrote:

It looks like the forum site is mangling the code. It appears to strip out double back slashes and replace it with a single back slash.

The variable drvPath should be in the format "<backslash><backslash>ServerName<backslash>ShareName". Replace <backslash> with \ and the code should work.


At 09 NOV 2012 09:29AM paxton scott wrote:

Thanks Jared, it was the → instead of the -]. I should have seen that!

I had the drvPath handled.

Compiles nicely, now. Big help.

Have fun!

Paxton

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/d70c1a86fa6c1fafad806d93c.txt
  • Last modified: 2024/01/04 21:00
  • by 127.0.0.1