Have you run this code through, step-by-step? Most likely, the AutoLISP commands that you are using contain the "C:" prefix as shown in your original post. Your list does not include that prefix.
Regarding the AutoCAD version, a simple CONDitional statement should suffice. I am not exactly sure how how you want the output to appear, but I have it as an external function, allowing you to edit the string as desired and reuse in other routines.
Code:
(defun lispWillStart (cmdData lstCallbacks /
dscFile strLogFile strCommandName
lstCommands strDate
strDay strDayText strLogin
strMonth strOutput strTime
strVersion strYear
)
(setq lstCommands '("C:EXP" "C:LYR" "C:PROBE" "C:LYRUP" "C:SPR")
strLogFile "C:/Lisp-Count.csv"
strCommandName (strcase
(substr
(car lstCallbacks)
2
(1- (if (vl-string-search " " (car lstCallbacks))
(vl-string-search " " (car lstCallbacks))
(vl-string-search ")" (car lstCallbacks))
)
)
)
)
)
(if (and (member strCommandName lstCommands)
(findfile strLogFile)
)
(progn
(setq strVersion (getAcadVersion)
strDayText (menucmd "M=$(edtime, $(getvar,date),DDDD)")
strTime (menucmd "M=$(edtime, $(getvar,date),hh:mm:ss)")
strMonth (menucmd "M=$(edtime, $(getvar,date),MOnth)")
strDay (menucmd "M=$(edtime, $(getvar,date),DD)")
strYear (menucmd "M=$(edtime, $(getvar,date),yyyy)")
strDate (strcat strDayText ", " strMonth
" " strDay ", " strYear
" " strTime
)
strLogin (getvar "loginname")
strOutput (strcat "\"" (car lstCallbacks)
"\"\t\""
strLogin
"\"\t\""
strDate
"\"\t\""
strVersion
"\""
)
)
(setq dscFile (open strLogFile "a"))
(write-line strOutput dscFile)
(close dscFile)
)
)
)
Code:
(defun getAcadVersion (/ sngVersion )
(setq sngVersion (atof (getvar 'AcadVer)))
(cond ((= sngVersion 16.0)
"AutoCAD 2004"
)
((= sngVersion 16.1)
"AutoCAD 2005"
)
((= sngVersion 16.2)
"AutoCAD 2006"
)
((= sngVersion 17.0)
"AutoCAD 2007"
)
((= sngVersion 17.1)
"AutoCAD 2008"
)
((= sngVersion 17.2)
"AutoCAD 2009"
)
((= sngVersion 18.0)
"AutoCAD 2010"
)
)
)