If statement not running

wondering if someone could help me. My if statement is not running (and i get no errors):

set lastRunD to do shell script ("ls -al /var/log/daily.out | awk '{print $7}'") 
display dialog (lastRunD) -- prints 4

set myDay to (current date)
set nToday to the day of myDay 
display dialog (nToday) -- prints 4

on cleanupFunc(whichScript)
--some code
end cleanupFunc

if lastRunD = nToday then
	display dialog ("if ran") -- never runs
	cleanupFunc("daily") -- never runs
end if

any help would be wonderful thanks alot,

Hi b,

Your variable lastRunD is text while the variable nToday is integer. The ‘display dialog’ coerces the integer to string for display. You need to do the same when camparing the two variables.


thanks alot I knew it was going to be something stupid like that.