When I run the script below in my application … I cannot complete the first “if” statement. The text field value gets set to 0. If I remove the “else if”, the script places the proper answer in the text field. It’s almost like my “if then else” statement is broken … any clues?
set restartCompletedCycles to SearchFileWithString(somePOSIXFile, "cycling") set sleepCompletedCycles to SearchFileWithString(somePOSIXFile, "sleep cycle") if restartCompletedCycles > 0 then set contents of text field "numOfCompCycle" of window "mainWindow" to restartCompletedCycles set testType to "restart" else if sleepCompletedCycles > 0 then set contents of text field "numOfCompCycle" of window "mainWindow" to sleepCompletedCycles set testType to "sleep" end if on SearchFileWithString(fileAsPOSIX, theString) return (do shell script "/usr/bin/grep -w -c" & space & quoted form of theString & space & quoted form of fileAsPOSIX & space & "; echo") end SearchFileWithString