;------------------------------------------------------------------------------- ; Program Name: SayIt.lsp ; Created By: Terry Miller ; Date Created: 1-20-07 ; Function: Says Phrase$ through computer speakers ; Note: This will only work on systems after Windows 2000. ;------------------------------------------------------------------------------- ; Revision History ; Rev By Date Description ;------------------------------------------------------------------------------- ; 1 TM 1-20-07 Initial version ;------------------------------------------------------------------------------- ; c:SayIt - Says Phrase$ through computer speakers ;------------------------------------------------------------------------------- (defun c:SayIt (/ Phrase$ Sapi) (if (setq Phrase$ (getstring "\nEnter phrase: " t)) (progn (setq Sapi (vlax-create-object "Sapi.SpVoice")) (vlax-invoke Sapi "Speak" Phrase$ 0) (vlax-release-object Sapi) );progn );if (princ) );defun c:SayIt ;------------------------------------------------------------------------------- ; SayIt - Says Phrase$ through computer speakers ; Arguments: 1 ; Phrase$ = Phrase to say ; Returns: Says Phrase$ through computer speakers ;------------------------------------------------------------------------------- (defun SayIt (Phrase$ / Sapi) (setq Sapi (vlax-create-object "Sapi.SpVoice")) (vlax-invoke Sapi "Speak" Phrase$ 0) (vlax-release-object Sapi) (princ) );defun SayIt ;------------------------------------------------------------------------------- ; Here is an example that can be included in your AcadDoc.lsp file after loading ; (load "SayIt"). ;------------------------------------------------------------------------------- ;(if (= (getvar "dwgname") "Drawing1.dwg");Run one time per new AutoCAD session ; (progn ; ;Create an association list of Login names and Called names ; (setq LoginNames@ (list ;Type Login names in all capitals ; (cons "JDOE" "John") ; (cons "RCAMPOS" "Ricky");Add names per your AutoCAD department ; ));setq ; (if (not (setq Name$ (cdr (assoc (strcase (getvar "LOGINNAME")) LoginNames@)))) ; (setq Name$ "") ; );if ; (setq Hour# (atoi (substr (rtos (getvar "cdate") 2 2) 10))) ; (cond ; ((> Hour# 18) (SayIt (strcat "Good evening " Name$))) ; ((> Hour# 12) (SayIt (strcat "Good afternoon " Name$))) ; (t (SayIt (strcat "Good morning " Name$))) ; );cond ; );progn ;);if ;------------------------------------------------------------------------------- (princ);End of SayIt.lsp