Jump to content

DriveSpaceFree different drives


Recommended Posts

i am new to programming.

I got this now:

$iDiskSpace = DriveSpaceFree( "c:\" )

But i want to know how i can choose between different drives.

so not both together or changing the script all the time.

can i replace the C:\ for a variable that i redirect to a config file?

Greetings,

Tom :)

This is the whole script dont look at the commentary (its dutch):

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\Icon\download_drive.ico
#AutoIt3Wrapper_outfile=..\..\..\Desktop\Drivespace checker.exe
#AutoIt3Wrapper_Compression=0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "Drivespace mailer.au3"

$SmtpServer = "mail.dataaccess.nl" ; address for the smtp-server to use - REQUIRED
$FromName = "mailer@dataaccess.nl" ; name from who the email was sent
$FromAddress = "tom.evertzen@dataacces.nl" ; address from where the mail should come
$ToAddress = "tom.evertzen@dataaccess.nl" ; destination address of the email - REQUIRED
$CcAddress = ""
$BccAddress = ""
$Subject = "HDD almost full." ; subject from the email - can be anything you want it to be
$AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed
$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
$Username = "tom.evertzen@dataaccess.nl" ; username for the account used from where the mail gets sent - REQUIRED
$Password = "passwordremoved" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 25 ; port used for sending the mail
$ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS

;~ Naam en adres

$Username = IniRead("config.ini", "settings", "Username", "")
$Password = IniRead("config.ini", "settings", "Password", "")
$ToName2 = IniRead("config.ini", "settings", "ToName", "")
$ToAddress2 = IniRead("config.ini", "settings", "ToAddress", "")

;~ Uitlezen config bestand

$sNotify = IniRead("config.ini", "settings", "Notify", "NotFound")
MsgBox(0, "Result", $sNotify)


;~ Ruimte checken

$iDiskSpace = DriveSpaceFree( "c:\" )
$b=1000
$spaceleft = $iDiskSpace/$b

;~ Ruimte meer dan 10000 mb

If $iDiskSpace > 10000 Then
    MsgBox(0, "Enough free space", "The free space left on C:\ is" & " " & $spaceleft & " GB, There is nothing to worry about.")
EndIf

;~ Mail word verstuurd als er minder dan 10 gigabyte aan ruimte is.

If $sNotify = "yes" And $iDiskSpace < 10000 Then

    MsgBox(0,"HDD is almost full","The free disk space left is " & $spaceleft & " GB. An E-mail has been sent to the administrator of this pc.")

    $Body = 'The C:\ disk of ' & @ComputerName & ' is almost full, there is only ' & $spaceleft & ' GB free space left. You should clean up your pc on time.' & ' E-mail received on:' & ' ' & @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN

    $rcCDO = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
EndIf
Edited by SmOke_N
password removed
Link to comment
Share on other sites

Doesn't matter it's Dutch, I'm also from The Netherlands. :)

Use the result of the .ini and make a variable of it like this:

$sNotify = IniRead("config.ini", "settings", "DriveName", "NotFound")

Then you have to make a If statement like this (I think)

$sNotify = IniRead("config.ini", "settings", "DriveLetter", "NotFound") 
MsgBox(0, "Result", $sNotify)   ;~ Ruimte checken 
If $sNotify = "NotFound" Then
    MsgBox(0, "Info", "The drive is not found, the program will be closed") 
Else
    $iDiskSpace = DriveSpaceFree( $sNotify )
    $b=1000
    $spaceleft = $iDiskSpace/$b
    ;~ Ruimte meer dan 10000 mb
    If $iDiskSpace > 10000 Then
        MsgBox(0, "Enough free space", "The free space left on C:\ is" & " " & $spaceleft & " GB, There is nothing to worry about.")
    EndIf 
EndIf

I think you wanna do it like this, but if not, just reply :)

EDIT: What the..... what's happened to the code???

Is this working??

$sNotify = IniRead("config.ini", "settings", "DriveLetter", "NotFound")
MsgBox(0, "Result", $sNotify)


;~ Ruimte checken
If $sNotify = "NotFound" Then
    MsgBox(0, "Info", "The drive is not found, the program will be closed")
Else
    $iDiskSpace = DriveSpaceFree( $sNotify )
    $b=1000
    $spaceleft = $iDiskSpace/$b

    ;~ Ruimte meer dan 10000 mb

    If $iDiskSpace > 10000 Then
        MsgBox(0, "Enough free space", "The free space left on C:\ is" & " " & $spaceleft & " GB, There is nothing to worry about.")
    EndIf
EndIf
Edited by SmOke_N
fixed autoit tag
PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

I would probably remove your E-Mail from the OP Tom. :)

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I was presuming this was a fake password, but you're right Manadar I shouldn't presume, so thanks for that.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Lol, haven't seen there was also a password in that :)

It also wasn't a very strong password I think

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

It should be on the bottom of your post and left beside the reply button...

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

Is it working now as you want to???

btw alsjeblieft :) (btw please in english :) )

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...