Sign in to follow this  
Followers 0
Donkeytom

DriveSpaceFree different drives

13 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

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


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Maybe removing password is a good idea too, Tom. Also you have to change the password now and never reuse it again, anywhere. Edited by Manadar

Share this post


Link to post
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.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

someone already warned me.

im lucky that the password isnt the good one :)

but i cant edit the post :) and the emailadress is real.

but the edit button is gone?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Users with less than 10 posts can not edit their posts. I've asked a moderator to remove the login details from your post.

Share this post


Link to post
Share on other sites

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

i know i already edited it before, but now its gone.

btw dankje voor je hulp :)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Password removed


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Is it working now as you want to???

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

yes thank you very much, works great now. :)

everything works how i wanted it to work

Share this post


Link to post
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
Sign in to follow this  
Followers 0