Jump to content

Recommended Posts

Posted

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
Global $sIni = @ScriptDir& "\Monitoring.ini"
Opt("GUIOnEventMode", 1)

$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
;input1 for the max value (critical)
$Input1 = GUICtrlCreateInput("Input1", 128, 48, 137, 21)
GUICtrlSetOnEvent($Input1, "Input1Change")
;input2 for the max value (warning)
$Input2 = GUICtrlCreateInput("Input2", 304, 48, 161, 21)
GUICtrlSetOnEvent($Input2, "Input2Change")
$List1 = GUICtrlCreateList("", 24, 48, 89, 188)
GUICtrlSetData($List1, "C|D|G|X")
GUICtrlSetOnEvent($List1, "List1Click")
$Button1 = GUICtrlCreateButton("Button1", 136, 96, 137, 33)
GUICtrlSetOnEvent($Button1, "Button1Click")
GUISetState(@SW_SHOW)


While 1
    Sleep(100)
WEnd

Func Button1Click()
;IniWrite ( "filename", "section", "key", "value" )
IniWrite($sIni,"Config HDD",GUICtrlRead($List1),GUICtrlRead($Input1)&"|"&GUICtrlRead($Input2))

Local $aArray = IniReadSection($sIni, "Config HDD")

    ; Check if an error occurred.
    If Not @error Then
        ; Enumerate through the array displaying the keys and their respective values.
        For $i = 1 To $aArray[0][0]
    ConsoleWrite(@CR&"Key: " & $aArray[$i][0] & @CRLF & "Value: " & $aArray[$i][1])

            
        Next

    EndIf

EndFunc
Func Form1Close()
Exit
EndFunc 

Hi every one ,

I'm starting with autoIt.

I would like to monitor my hard drives, and generate an alert. 
I have two level alert one for the warning and the other for critical this based on the free space 
and each disk has a different configuration of space to be monitored. 
I use an ini file to save each configuration. 
For each drive ill like to check the free space and generate a warning or critical alert
 
I can not parse my ini file to read the minimum and maximum levels of my disk
 
Could someone help please.
 
 
 
  • Moderators
Posted

eseuk,

You are reading the ini file correctly so what do you mean when you say you are having trouble parsing it? StringSplit will break out the 2 values for you to use. Please explain further. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

Hello M23 thank for you quick answer,

In my ini file I have several lines 
[Config HDD] 
C = 5 | 10 
D = 5 | 20 
X = 2 | 5 
I would like for each line check if the disk space is less than 5 (disk C for example) generate critical alert if it is less than 10 alert warning 
  and therefore do this for all disks that are in the list.
  • Moderators
  • Solution
Posted

eseuk,

Not too difficult. What have you tried so far that has not worked? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

eseuk,

Delighted to hear that you got it working. Please post the code you used so others can learn as well. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
×
×
  • Create New...