Long line police!

Couple of things..
Like the idea of your post..

However, you don't post anything on how to use your function.. You don't define $inifilepath either.

The following should read cleaner.
Code:

FUNCTION CheckPst
$regkey='HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\MS Exchange Settings'
$index = 0
$keyname = EnumKey($regkey, $index)
WHILE @error=0
$displayname = ReadValue($regkey+'\'+$keyname,'001e6700')
IF @error=0
$fso = CreateObject('Scripting.FileSystemObject')
$objfile = $fso.getfile($displayname)
$filesize=$objfile.size
IF $filesize>1500000000 ;>1.5GB
$dev=ReadProfileString($inifilepath,'PstID',$displayname)
IF $dev=''
WriteProfileString($inifilepath,'PstID',$displayname,$filesize)
$message=$message+'The pst file '+$displayname
' is over size, Please notify user. The current size is : '
+($filesize / 1024 /1024 ) +"MB;"
ELSE
IF $filesize-$dev>100000000
SendError('Warning!Warning!Warning!'+' The pst file '+$displayname+
' will over maximum size ,
Must Be Attention!. The current size is : '
+($filesize / 1024 /1024 ) +'MB')
ENDIF
ENDIF
ENDIF
ENDIF
$index = $index + 1
$keyname = EnumKey($regkey, $index)
LOOP
IF $message<>''
SendError($message)
ENDIF
ENDFUNCTION



Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's