Mine looks like this:
LoadPercentage
17
FreePhysicalMemory=5643716
If the output is different and parsing is the issue, the following amended script may help.
Code: Select all
Let>vRAM_Limit=85
Let>vCPU_Limit=50
Dialog>Dialog1
object Dialog1: TForm
Left = 284
Top = 178
HelpContext = 5000
BorderIcons = [biSystemMenu]
BorderStyle = bsNone
Caption = 'Memory and CPU'
ClientHeight = 53
ClientWidth = 422
Color = 16777200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 0
Width = 96
Height = 16
Caption = 'Total Memory'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label2: TLabel
Left = 120
Top = 0
Width = 104
Height = 16
Caption = 'Memory in Use'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label3: TLabel
Left = 248
Top = 0
Width = 164
Height = 16
Caption = 'CPU Percentage in Use'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label4: TLabel
Left = 8
Top = 24
Width = 323
Height = 16
Caption = 'First run sometimes takes a while. Be patient...'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label5: TLabel
Left = 120
Top = 24
Width = 5
Height = 16
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label6: TLabel
Left = 248
Top = 24
Width = 5
Height = 16
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,OnClose,Quit
Let>WIN_USEHANDLE=1
MoveWindow>Dialog1.Handle,0,0
Let>WIN_USEHANDLE=0
SetDialogObjectFont>Dialog1,Label4,MS Sans Serif,11,1,111111
Show>dialog1
Let>RP_Wait=1
Let>RP_Windowmode=0
//Let>RP_Admin=1
SRT>Quit
Exit>0
END>Quit
RunProgram>cmd /c wmic computersystem get TotalPhysicalMemory > %temp_dir%CPUandMEM.txt
ReadLn>%temp_dir%CPUandMEM.txt,2,vTotalMem
Trim>vTotalMem,vTotalMem
Let>vTotalMem={(round((%vTotalMem%/1024^3)*100)/100)}
SetDialogObjectFont>Dialog1,Label4,MS Sans Serif,11,1,0
SetDialogProperty>Dialog1,Label4,Caption,vTotalMem
Label>Start
GetDate>today
GetTime>now
RunProgram>cmd /c wmic cpu get loadpercentage > %temp_dir%CPUandMEM.txt
RunProgram>cmd /c wmic OS get FreePhysicalMemory /Value >> %temp_dir%CPUandMEM.txt
ReadLn>%temp_dir%CPUandMEM.txt,2,vCPUres
Trim>vCPUres,vCPUres
If>{%vCPUres%>%vCPU_Limit%}
SetDialogObjectFont>Dialog1,Label6,MS Sans Serif,11,1,255
Else
SetDialogObjectFont>Dialog1,Label6,MS Sans Serif,11,1,0
EndIf
ReadFile>%temp_dir%CPUandMEM.txt,vData
Separate>vData,FreePhysicalMemory=,VItem
StringReplace>vItem_2,crlf,,vMEMres
Trim>vMEMres,vMEMres
StringReplace>vMEMres,,,vMEMres
Let>vMEMres={%vTotalMem%-(round((%vMEMres%/1024^2)*100)/100)}
SetDialogProperty>Dialog1,,Caption,Memory and CPU %today% %now%
SetDialogProperty>Dialog1,Label6,Caption,vCPUres
If>{((%vMEMres%/%vTotalMem%)*100)>%vRAM_Limit%}
SetDialogObjectFont>Dialog1,Label5,MS Sans Serif,11,1,255
Else
SetDialogObjectFont>Dialog1,Label5,MS Sans Serif,11,1,0
EndIf
SetDialogProperty>Dialog1,Label5,Caption,vMEMres
SetDialogObjectFont>Dialog1,Label4,MS Sans Serif,11,1,0
SetDialogProperty>Dialog1,Label4,Caption,vTotalMem
Let>WIN_USEHANDLE=1
GetWindowPos>Dialog1.Handle,DiaX,DiaY
MoveWindow>Dialog1.Handle,DiaX,DiaY
Let>WIN_USEHANDLE=0
Wait>0.01
Goto>Start