This is just to demonstrate the latest feature of V3.3.9.4+ Beta (V3.3.9.3 had a problem so it's not recommended to use this.)
ConsoleWrite('Number of lines: ' & _FileCountLinesEx(@ScriptFullPath) & @CRLF)
; Works only with V3.3.9.4 and above. This is a different approach to _FileCountLines using the new feature StringSplit('Text, Text', ',')[1].
Func _FileCountLinesEx($sFilePath)
Local $sData = StringStripWS(FileRead($sFilePath), 2)
If StringInStr($sData, @LF) Then
Return StringSplit(StringStripCR($sData), @LF)[0]
ElseIf StringInStr($sData, @CR) Then
Return StringSplit($sData, @CR)[0]
Else
If StringLen($sFilePath) Then
Return 1
Else
Return SetError(1, 0, 0)
EndIf
EndIf
EndFunc ;==>_FileCountLinesEx