Damien_Inferno
19th January 2004 11:10 UTC
NSIS System Plugin
Hi there,
I need some help on a probably simple issue. I am using the NSIS system plugin to get info about the users disk space.
In the example system.nsi i found a function that displays the users diskspace in a pop-up window. I want that information to be put in a .txt-file.
this is code for the popup window:
System::Call '${sysMessageBox}($HWNDPARENT, s, "System Example 2", ${MB_OKCANCEL})' "$7"
I have read the helpfile from the system plugin, but i can't follow it. can someone enlighten me?
Thanks
Yathosho
19th January 2004 12:56 UTC
i guess $7 is the variable storing the disk space info. you can use the file instructions to put that in a .txt file (there's an example either with nsis or in the archive)
Damien_Inferno
19th January 2004 13:07 UTC
Thanks,
yes, i figured that out too... the only thing is that "$7" contains more data than i need. i just want to know the free space on c:\
"$7" contains a string which is designed to fit into a "scheme", therefore it is "polluted" with lots of spaces.
Is there a string-command to remove spaces?
blayde
19th January 2004 13:18 UTC
Using StrCpy to trim the string might be a start. you might also find the function StrStr usefull, for searching for one string within another.
both are in the NSIS Documentation
Damien_Inferno
19th January 2004 14:06 UTC
thanx guys, you helped me out
brainsucker
19th January 2004 22:24 UTC
look between ;------ lines
; Memory for paths
System::Alloc 1024
Pop $1
; Get drives
System::Call '${sysGetLogicalDriveStrings}(1024, r1)'
enumok:
; One more drive?
System::Call '${syslstrlen}(i r1) .r2'
IntCmp $2 0 enumex
; Is it DRIVE_FIXED?
System::Call '${sysGetDriveType} (i r1) .r3'
StrCmp $3 ${DRIVE_FIXED} 0 enumnext
; Drive space
System::Call '${sysGetDiskFreeSpaceEx}(i r1, .r3, .r4, .r5)'
; Get pretty drive path string
System::Call '*$1(&t1024 .r6)'
; -------------------------------------------
; here $6 - drive path,
; $3 - full disk space in bytes
; $4 - free disk space in bytes
; -------------------------------------------
enumnext:
; Next drive path
IntOp $1 $1 + $2
IntOp $1 $1 + 1
goto enumok
enumex: ; End of drives or user cancel
; Free memory for paths
System::Free $1