Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 3:21 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Free Disk Space
PostPosted: December 18th, 2008, 3:42 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Hi, is there a way to check for free space on a drive within the Opus functionality? I could do this in VB, but cannot find anything relating to Javascript (of course..), I have checked the Opuscript functions and variables to no avail.

I hoping to find a dll I could use, but days of searching have been fruitless, I would prefer if it could put out used and free space for a users disk quota if at all possible...

Many thanks, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 18th, 2008, 7:26 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
I have found a javascript sample which gives me what I'm after, but after reading the OpusScript documentation and these boards, i still can't see how to implement this in OpusScript, I cannot see the filesystem object supported or mentioned. Do I assume this is a more recent implementation of JS?

<script type="text/javascript">
// initialize ActiveXObject and create an object of Scripting.FileSystemObject.
var fso = new ActiveXObject("Scripting.FileSystemObject");
// Drive object reference set to driveObj variable
var driveObj = fso.GetDrive("C");
// get Free Space on specified drive and convert the value in bytes to giga bytes
var freeSpace = (driveObj.FreeSpace) /(1024 * 1024 * 1024);
document.write("<b>Free Space :</b> " + freeSpace + " GB");
</ script>

Regards, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 18th, 2008, 8:37 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
While Opusscript is based on ECMAscript like Javascript, it isn't Javascript.
Try calling a .vbs script that will write what you need to a text file then read that into Opus. Or you could probably find a DLL somewhere that could bring the required data straight into Opus.

Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 18th, 2008, 11:54 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
3B,

I found this thread. But I don't know how to cook anything with it. :cry:

http://msdn.microsoft.com/en-us/library/aa364937(VS.85).aspx

Quote:
GetDiskFreeSpaceEx Function

Retrieves information about the amount of space that is available on a disk volume


...references kernel32.dll

also...w/ VB
http://www.answers.com/topic/getdiskfreespace

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 19th, 2008, 11:01 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Hi guys , thanks for the replies, as has been suggested, I will use a vb script to write a local report and read that in. There are numerous vb scripts out there to enumerate Windows 2003 server disk quotas, so I will modify one to write locally.
I will post the project here when I'm done in case anyone would find it useful.

We wanted our teachers to be able to know their disk usage (they have a very locked down profile.)

Have a good Xmas everyone!

Regards, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 20th, 2008, 12:23 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
a possible alternative.....You can run a batch file from Opus (launch file command) with the 'DIR command and pipe to a text file.... dir >>dir.txt.....will save the DIR command output to a text file 'dir.txt', then you could extract the free space from the text file.

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 15th, 2009, 10:09 am 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Hi all, an update, grabbed some ideas and molded two vbscripts together, to write a file called discquota.txt to the users home drive (n: )

I wrote an Opus app to read in the details and display in a (reasonably) pretty way for the user, the script works outside of the application no problem, but when 'launched' from within the application I get a VBScript permission denied error.

I am a system admin so I shouldn't be seeing this error, but it made me think that more restricted users may see it.

If anyone's interested the vbscript is here:

=======================================
'Get Quota and current space used.
dim oFS, oFolder
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
set oFolder = oFS.GetFolder("N:\")
Set objWMIService = GetObject("winmgmts:")
Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='N:'")
dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
'Create Text File
Set filetxt = filesys.CreateTextFile("n:\discquota.txt", True)
path = filesys.GetAbsolutePathName("n:\discquota.txt")
getname = filesys.GetFileName(path)

'Write text to file
filetxt.WriteLine(int(oFolder.Size /1048576) & "," & Int(objLogicalDisk.Size /1048576) & "," & date & "," & time)
filetxt.Close

======================================

It fails on the createtextfile method under Opus, but not when run outside.
I will keep working on this, as we need a way for our teachers to view their disc quotas.

Regards, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 15th, 2009, 11:01 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Kurt,

Try this.

It accepts the parameters drive and output-file - for example

diskspace.exe c:\ output.txt

It's a simple AutoIT script that's been compiled and should launch okay from Opus publications. It returns space in MB.

Mack


You do not have the required permissions to view the files attached to this post.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 15th, 2009, 12:00 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Hi Mack, thanks for that, I will use that if I get desperate, but because our staff have different quotas, I need to know this as well, so that the readings are relative.

Thanks for your input though!

Regards, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 15th, 2009, 1:02 pm 
Offline

Joined: March 4th, 2007, 7:17 pm
Posts: 132
I see that the band Opus + AutoIt is gaining popularity :)
This is indeed a useful feature.
Maybe this should be to create a separate topic extended list of features Opus received with Autoit?

1. Creating screenshots.
2. Most functionality with database
3. Checking disk space
4. ...

Add, please.

_________________
Opus Pro 5.5
Win XP


For this message Volgar has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 15th, 2009, 1:18 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Kurt,

Adding different features isn't to difficult - although AutoIT is still new to me.

I've changed the file to output a CSV for total space / space available.

Mack


You do not have the required permissions to view the files attached to this post.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 15th, 2009, 1:25 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi V,

Yes, AutoIT is useful but not as practical as a DLL because it cannot return values directly to Opus and has the habit of the false positives for AVs.

If only Opus didn't required DLLs written in C++, or the like, then we might see more custom ones written to support the program.

Opus itself it an amazingly powerful package with both it's range of actions and the delightful OpusScript but with the added ability to launch a range of external functions from scripts, exes and DLLs - the sky truely is the limit.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 15th, 2009, 1:58 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Hi Mack, thanks, that AutoIT looks brilliant. I love the bit where you scroll down after reading the features and it says "You'll probably want to download it now.." - brilliant.

FInally getting somewhere.

Regards, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 15th, 2009, 2:40 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Kurt,

If you're going to use AutoIT itself - here's the code for the very little application I wrote:

$free = DriveSpaceFree( $CmdLine[1])
$avail = DriveSpaceTotal( $CmdLine[1])


$file = FileOpen($CmdLine[2], 2)

; Check if file opened for writing OK
If $file = -1 Then

Exit
EndIf

FileWrite($file, $avail&','&$free)
FileClose($file)

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 15th, 2009, 2:59 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Thanks for sharing that Mack, I will have a look and share my project when its done.

Regards, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 49 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group