See the top rated post in this thread. Click here

Page 5 of 8 FirstFirst 12345678 LastLast
Results 41 to 50 of 74

Thread: AutoCAD Speak

  1. #41
    100 Club Father-of-Ten's Avatar
    Join Date
    2004-09
    Location
    Idaho Falls, Idaho
    Posts
    167
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    I have enjoyed playing around with this code. Even if it is playing, I am learning more about LISP!!!

    I hope that everybody has a wonderful weekend!!

  2. #42
    Active Member
    Join Date
    2005-09
    Posts
    88
    Login to Give a bone
    0

    Talking Re: AutoCAD Speak

    So, the way I see it, I now have until April 1, or maybe March 30, to master enough Lisp, and Reactors to get this built into a few functions that fire off with specific commands....

    this is going to be fun!

  3. #43
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Quote Originally Posted by c.prettyman
    So, the way I see it, I now have until April 1, or maybe March 30, to master enough Lisp, and Reactors to get this built into a few functions that fire off with specific commands....

    this is going to be fun!
    ...mmm piece of cake

    : ) Happy Computing !

    kennet

  4. #44
    I could stop if I wanted to
    Join Date
    2006-04
    Posts
    466
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Does SAYIT.LSP work in modern autocad?
    I don't have access to new versions for testing.

  5. #45
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Quote Originally Posted by aaronic_abacus View Post
    Does SAYIT.LSP work in modern autocad?
    I don't have access to new versions for testing.
    it worked in 09, havent had much time yet to try it in 10, I'm just trying to get VLISP to work properly.

  6. #46
    I could stop if I wanted to
    Join Date
    2007-05
    Location
    Brookfield WI
    Posts
    331
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Oh this could be fun, say you send a modified routine to one user only. Each time they ESC out of said routine, it says "error their name prior settings restored" the first time you heard this you would freak

    Does anyone know how to turn on the speakers of users computers and adjust the volume via lisp?
    Last edited by d_m_hopper; 2009-07-16 at 01:58 PM.

  7. #47
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Quote Originally Posted by Terry Cadd View Post
    Hi ccowgill,
    I installed AutoCAD 2010 today and noticed right away that VBA was not included. I have no idea why Autodesk would leave it out, because it takes several extra steps to get everything re-configured. Here’s this link for the VBA download.
    http://www.autodesk.com/vba-download
    VBA has nothing to do with my issues. My vlisp issues are caused by Eagle Point not functioning/refusing to provide support in 64 bit AutoCAD.

    I am able to run this program in 2010 without VBA.

  8. #48
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Quote Originally Posted by d_m_hopper View Post
    Does anyone know how to turn on the speakers of users computers and adjust the volume via lisp?
    Code:
    (defun C:SpeakCfg(/ Sapi ~voice ~volume ~rate Voice VoiceMary VoiceMike
                        VoiceSam VoiceLst NumVoices @PlayWav @NoPath
                        @VoiceList @member+ @Voice&TextInput)
    
    ;**********************SubPrograms************************************************
    (defun @PlayWav (Sapi WavFile / WavPath @@FindFile ObjFile)
    (defun @@FindFile(WavFile / WinDir Path i DirLst)
    (setq WinDir (getenv "Windir"))
    (setq Path nil i 0 DirLst 
    (list "" "c:\\" (strcat WinDir "\\")
    (strcat WinDir "\\media\\")
    (strcat WinDir "\\System\\")
    (strcat WinDir "\\System32\\")
    (strcat WinDir "\\System64\\")
    (strcat WinDir "\\System32\\drivers\\")))
    (while (and (< i (length DirLst))
    (= (setq Path (findfile (strcat (nth i DirLst) WavFile))) nil))
    (setq i (1+ i)))
    Path
    )
    (setq WavPath (@@FindFile WavFile))
    (if (and WavPath Sapi)
    (progn
    (setq ObjFile (vlax-create-object "SAPI.SpFileStream.1"))
    (vlax-invoke ObjFile "Open" WavPath)
    (vlax-invoke Sapi "Speakstream" ObjFile 0)
    (vlax-release-object ObjFile)
    ))
    )
    (defun @NoPath(s / cnt ct name)
    (setq name (strcase s T))
    (if (= (substr name 2 1) ":")
    (setq name (substr name 3)))
    (setq cnt 1 ct 0)
    (repeat (strlen name)
    (if (= (substr name cnt 1) "\\")
    (setq ct cnt)
    )
    (setq cnt (1+ cnt))
    )
    (setq name (substr name (+ 1 ct) cnt))
    )
    (defun @VoiceList(Sapi / i VoiceLst Voices)
    (setq Voices (vlax-invoke Sapi 'GetVoices))
    (setq i 0 VoiceLst '())
    (repeat (vla-get-count Voices)
    (setq VoiceLst (append VoiceLst 
    (list (vlax-invoke (vla-item Voices i) 'GetDescription))))
    (setq i (1+ i))
    )
    VoiceLst
    )
    (defun @member+ (x lst /)
    (if (vl-member-if '(lambda (y) (wcmatch x y)) lst) x)
    )
    (defun @Voice&TextInput(voice text / SpeekContent)
    (setq SpeekContent (strcat "<VOICE REQUIRED='NAME=" voice "'>" text "</VOICE>"))
    )
    
    ;**********************Main Program***********************************************
    (vl-load-com)
    (setq Sapi (vlax-create-object "Sapi.SpVoice"))
    (if (not Sapi)(progn 
    (load "AI_UTILS")(princ "\nWarning: For sound, first install Microsoft Speech SDK 5.1")
    (ai_abort "Sapi.SpVoice" (strcat "Warning: No Speech Application Programming Interface"
    " with Microsoft Speech" "\n or with the speech module in MS Office."
    "\n Suggestion: Install Microsoft Speech SDK 5.1 from http://www.microsoft.com/downloads/"))
    ))
    (setq ~voice (@NoPath (vlax-get-property (vlax-get-property Sapi 'voice) 'Id)))
    (cond
    ((= ~voice "msmary") (setq Voice "Microsoft Mary"))
    ((= ~voice "msmike") (setq Voice "Microsoft Mike"))
    ((= ~voice "mssam") (setq Voice "Microsoft Sam"))
    (t (setq Voice ~voice))
    )
    ;The voice is normally in Microsoft Speech "Microsoft Mary",
    ;but in the speech module in MS Office it is "Microsoft Sam".
    (setq ~volume (vlax-get-property Sapi 'Volume))
    (vlax-put-property Sapi 'Volume 100)
    (@playwav Sapi "notify.wav")
    (vlax-invoke Sapi "Speak" (strcat "This is " Voice " speaking in AutoCAD with Sapi.     "
    "Sapi is short for Speech Application Programming Interface.     "
    "You can also use Sapi for playing Wave soundfiles in AutoCAD.") 0)
    (@playwav Sapi "Ringin.wav")
    (vlax-put-property Sapi 'Volume 10)
    (vlax-invoke Sapi "Speak" "Do you want AutoCAD to speak with a soft volume?" 0)
    (vlax-put-property Sapi 'Volume 50)
    (vlax-invoke Sapi "Speak" "Do you want AutoCAD to speak with a medium volume?" 0)
    (vlax-put-property Sapi 'Volume 100)
    (vlax-invoke Sapi "Speak" "Do you want AutoCAD to speak with a loud volume?" 0)
    ;(vlax-put-property Sapi 'Volume ~volume)
    (setq ~rate (vlax-get-property Sapi 'Rate))
    (vlax-put-property Sapi 'Rate -8)
    (vlax-invoke Sapi "Speak" "Do you want AutoCAD to speak with a slow rate?" 0)
    (vlax-put-property Sapi 'Rate 5)
    (vlax-invoke Sapi "Speak" "Do you want AutoCAD to speak with a fast rate?" 0)
    (vlax-put-property Sapi 'Rate 0)
    (vlax-invoke Sapi "Speak" "Do you want AutoCAD to speak with a normal rate?" 0)
    ;(vlax-put-property Sapi 'Rate ~rate)
    (vlax-invoke Sapi "Speak" "Question,         Can I also change the voice?" 0)
    (setq VoiceLst (@VoiceList Sapi))
    ;Gives normally with Microsoft Speech:("Microsoft Mary" "Microsoft Mike" "Microsoft Sam" "Sample TTS Voice")
    ;The voice "Sample TTS Voice" is not usable in a Sapi object, it is for use in TTSapp.exe and TTSappVB.exe
    ;Gives normally with Microsoft Office speech module:("Microsoft Sam")
    (setq NumVoices(length VoiceLst))
    (if (@member+ "Sample TTS Voice" VoiceLst) (setq NumVoices (1- NumVoices)))
    (if (> NumVoices 1)
    (vlax-invoke Sapi "Speak" (strcat "Yes. We can do this, because there are "
    (itoa NumVoices) " usable voices on this system.") 0)
    (progn
    (vlax-invoke Sapi "Speak" (strcat "No. We can't do this, because there is only one voice on this system.  "
    "  Probably, only the speech module of Microsoft Office is installed.") 0)
    (princ (strcat "\nWarning: For more voices, first install Microsoft Speech SDK 5.1"
    "\nfrom http://www.microsoft.com/downloads/"))))
    (if (@member+ "Microsoft Mary" VoiceLst) (setq VoiceMary "Microsoft Mary"))
    (if (@member+ "Microsoft Mike" VoiceLst) (setq VoiceMike "Microsoft Mike"))
    (if (@member+ "Microsoft Sam" VoiceLst) (setq VoiceSam "Microsoft Sam"))
    (if (and VoiceMary VoiceMike VoiceSam)
    (progn
    (vlax-invoke Sapi "Speak" (@Voice&TextInput VoiceMike
    "My name is Microsoft Mike, and I have a question for Sam.") 0)
    (vlax-invoke Sapi "Speak" (@Voice&TextInput VoiceMike
    "Sam, could you say something about Mary?") 0)
    (vlax-invoke Sapi "Speak" (@Voice&TextInput VoiceSam
    "My name is Microsoft Sam, and I can say that Mary has a little lamb.") 0)
    (vlax-invoke Sapi "Speak" (@Voice&TextInput VoiceMary
    "Hi, this is Microsoft Mary and I think that Sam is joking like Mister Thomas Edison.") 0)
    (vlax-invoke Sapi "Speak" (@Voice&TextInput VoiceMike
    "This information is very interesting, and I would like to thank you all.") 0)
    )
    (progn
    (vlax-invoke Sapi "Speak" "Warning      " 0)
    (if (not VoiceMary) (vlax-invoke Sapi "Speak" "There is no Microsoft Mary." 0))
    (if (not VoiceMike) (vlax-invoke Sapi "Speak" "There is no Microsoft Mike." 0))
    (if (not VoiceSam) (vlax-invoke Sapi "Speak" "There is no Microsoft Sam." 0))
    ))
    (@playwav Sapi "tada.wav")
    (vlax-release-object sapi)
    (princ)
    )
    (princ "SpeakCfg.lsp Loaded. \nRun with SPEAKCFG.")
    The program SpeakCfg is Using the Speech Application Programming Interface
    from Microsoft Speech SDK 5.1 (http://www.microsoft.com/downloads/") or the
    speech module from Microsoft Office (network versions????).

    For Sound Animations or Simulations see:
    http://forums.augi.com/showthread.php?t=55713&page=4

    23/09-2009 VBA version of SpeakCfg for using SAPI (Sound and Speech).

    Regards,
    HofCAD CSI
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by hofcad; 2009-10-23 at 12:15 PM.

  9. #49
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: AutoCAD Speak


    I made some modifications and additions in the above SpeakCfg.lsp.
    For example, adding Wav sound, voice identification and warnings.

    PS The program SpeakCfg is Using the Speech Application Programming Interface
    from Microsoft Speech SDK 5.1 (http://www.microsoft.com/downloads/") or the
    speech module from Microsoft Office (network versions????).

    Regards,
    HofCAD CSI
    Last edited by hofcad; 2009-09-07 at 12:07 PM.

  10. #50
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Quote Originally Posted by d_m_hopper View Post
    Does anyone know how to turn on the speakers of users computers and adjust the volume via lisp?


    Is this the way?
    Code:
    (defun SendKeysN(Keys n / Wscript) 
    (vl-load-com)
      (if (setq Wscript (vlax-create-object "WScript.Shell"))
        (progn (repeat n
           (vlax-invoke-method Wscript 'SendKeys Keys))
           (vlax-release-object Wscript)
        )
      )  
    (princ) 
    )
    (defun c:MaxVolume() ;For raise the volume
    (SendKeysN  (chr 175) 50)
    )
    PS The program SpeakCfg is Using the Speech Application Programming Interface
    from Microsoft Speech SDK 5.1 (http://www.microsoft.com/downloads/") or the
    speech module from Microsoft Office (Microsoft Word 2002, or Microsoft Excel 2002?).

    For Sound Animations or Simulations see:
    http://forums.augi.com/showthread.php?t=55713&page=4

    Regards, HofCAD CSI.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by hofcad; 2009-10-16 at 10:44 AM.

Page 5 of 8 FirstFirst 12345678 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 2015-08-07, 04:03 PM
  2. Speak 4 cad
    By maa in forum Software
    Replies: 9
    Last Post: 2006-06-30, 12:13 PM
  3. speak to autocad
    By jaberwok in forum Software
    Replies: 9
    Last Post: 2005-11-09, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •