Jump to content
Sign in to follow this  
creeping

Enum not working

Recommended Posts

creeping

Ok, this code fails on the line:

Return StringSplit($aTemp[$E_LAST_EMAIL_TIME][1], $cDateDelim)

It tells me $E_LAST_EMAIL_TIME is not decleared in the function GetLastEmailTime(), but I use the variable in the function

WriteEmailTime() without an error before GetLastEmailTime() is called.

So.. Is this allowed: Enum $E_LAST_EMAIL_TIME = 1 ?

I pasted my .ini file below.

Am I missing something stupid here?

Thanks.

#include <Array.au3>

Const $sIniConfig = 'config.ini', $sIniSecEmail = 'email', $sIniSecEventlogs = 'eventlogs', $sIniSecLog = 'log'
Const $cTimeDelim = ':', $cDateDelim = '/'

Dim $aIniSecEmail = IniReadSection($sIniConfig, $sIniSecEmail)
Dim $aIniSecEventLogs = IniReadSection($sIniConfig, $sIniSecEventlogs)
Dim $aIniSeclog = IniReadSection($sIniConfig, $sIniSecLog)

Dim $iSendEmailHour = 0, $iSendEmailMin = 0
Dim $aLstEmailTime = GetLastEmailTime()
Dim $aTemp = 0

Enum $E_TIME = 1, $E_SMTP_SERVER, $E_FROM_NAME ,$E_FROM_ADDRESS, $E_SUBJECT
Enum $E_APPLICATION = 1, $_SECURITY, $E_SYSTEM
Enum $E_LAST_EMAIL_TIME = 1
Enum $E_DAY_OF_MONTH = 1, $E_MONTH, $E_YEAR


$aTemp = StringSplit($aIniSecEmail[$E_TIME][1], $cTimeDelim)
$iSendEmailHour = $aTemp[1]
$iSendEmailMin = $aTemp[2]


WriteEmailTime()
GetLastEmailTime()

Func WriteEmailTime()   
    $aTemp = IniReadSection($sIniConfig, $sIniSecLog) 
    $aTemp[$E_LAST_EMAIL_TIME][1] = @MDAY & $cDateDelim & @MON & $cDateDelim & @YEAR 
    IniWriteSection($sIniConfig, $sIniSecLog, $aTemp) 
EndFunc

Func GetLastEmailTime() 
    $aTemp = IniReadSection($sIniConfig, $sIniSecLog)
    
    MsgBox(0, '', $aTemp[0][0])
    MsgBox(0, '', $aTemp[1][0])
    MsgBox(0, '', $aTemp[1][1])
    
    Return StringSplit($aTemp[$E_LAST_EMAIL_TIME][1], $cDateDelim)
EndFunc

Sample config.ini

time=17:00

smtpServer=smtp.xtra.co.nz

fromName=EventRobo

fromAddress=EventRobo@jit.co.nz

subject=webco - @hostname

[eventlogs]

application=1;1;0

security=1;1;0

system=1;1;0

[log]

lastSendTime=17/04/2007

Edited by creeping

Share this post


Link to post
Share on other sites
MHz

You are calling GetLastEmailTime() before you declare $E_LAST_EMAIL_TIME in your script. Move your $E_LAST_EMAIL_TIME declaration before calling GetLastEmailTime(), and the error should not show.

:shocked:

Share this post


Link to post
Share on other sites
creeping

You are calling GetLastEmailTime() before you declare $E_LAST_EMAIL_TIME in your script. Move your $E_LAST_EMAIL_TIME declaration before calling GetLastEmailTime(), and the error should not show.

:shocked:

:"> How stupid do I feel...

Thanks

Share this post


Link to post
Share on other sites
BrettF

:"> How stupid do I feel...

Thanks

Hehehe. Don't feel stupid. We all learn from our mistakes. Heck! Once upon a time I tried to put ':' into a file name..... I have been stupider :shocked:

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  

×