TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Patrick_35 on January 17, 2007, 07:42:04 AM
-
Hi
Just for the fun :-)
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke sapi "Speak" "Do you want autocad speak ?" 0)
(vlax-release-object sapi)
@+
-
Hehehe... kinda cool!
-
*lol* Awesome!
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke sapi "Speak" "Would you like to play a game ?" 0)
(vlax-release-object sapi)
-
'Flush the bombers, get the subs in launch mode. We are at DEFCON 1!'
-
(DEFUN c:SAPI ()
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke sapi "Speak" "Would you like to play Global Thermo Nuclear War ?" 0)
(vlax-release-object sapi)
)
-
(DEFUN c:SAPI ()
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke sapi "Speak" "Would you like to play Global Thermo Nuclear War ?" 0)
(vlax-release-object sapi)
)
Cool.
At first it did not work. But then realize that the speakers where turn off. Dooh! :oops:
BTW,
Can a klaxon sound of a Navy sub be incorporated?
Woot. DIVE! Woot. DIVE! Woot. DIVE!
-
Ohhhhheeee ... Ha ha ha ! :lmao:
I couldn't hold my belly due to such a loughing !
But , tell me , what is it based on ?
-
hahahhaha.
awesome fun.
....god I'm a geek.
-
....god I'm a geek.
First step to recovery is admittance.
:-D :-)
-
Very cool Patrick. Thanks for posting.
Now, lets have some fun :)
(defun c:SpeakLayers()
(setq layList (list (cdr (assoc 2 (tblnext "LAYER" T)))))
(while (setq layName (cdr (assoc 2 (tblnext "LAYER"))))
(setq LayList (append LayList (list layname)))
)
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(mapcar '(lambda(x) (vlax-invoke sapi "Speak" x 0)) layList)
(vlax-release-object sapi)
)
But don't try this in a big drawing. Neither Control-C or Esc will halt execution.
-
Very cool Patrick. Thanks for posting.
Now, lets have some fun :)
(defun c:SpeakLayers()
(setq layList (list (cdr (assoc 2 (tblnext "LAYER" T)))))
(while (setq layName (cdr (assoc 2 (tblnext "LAYER"))))
(setq LayList (append LayList (list layname)))
)
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(mapcar '(lambda(x) (vlax-invoke sapi "Speak" x 0)) layList)
(vlax-release-object sapi)
)
But don't try this in a big drawing. Neither Control-C or Esc will halt execution.
The evil side takes over. :evil:
Add the words "Deleting all objects on Layer [what]." Then install it on coworkers computer.
-
That is really funny!
-
Very cool Patrick. Thanks for posting.
Now, lets have some fun :)
(defun c:SpeakLayers()
(setq layList (list (cdr (assoc 2 (tblnext "LAYER" T)))))
(while (setq layName (cdr (assoc 2 (tblnext "LAYER"))))
(setq LayList (append LayList (list layname)))
)
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(mapcar '(lambda(x) (vlax-invoke sapi "Speak" x 0)) layList)
(vlax-release-object sapi)
)
But don't try this in a big drawing. Neither Control-C or Esc will halt execution.
The evil side takes over. :evil:
Add the words "Deleting all objects on Layer [what]." Then install it on coworkers computer.
or
Add a delay between the sayings, and then add the works
"Deleting all objects one layer x unless you yell stop"
Then after the wait say.
"Didn't hear you, proceeding with deletion."
-
Well this thread certainly got the creative juices flowing...
Let's have some fun with the MS Agent as well!
-
Never used MS Agent..What does it do and how do you use it?
-
Matt W !
I'm disappointed because if I type in X=0 and Y=123, he doesn't go to the GCS at the appropriate coordinates :wink:
-
GCS? :? The Glasgow Coma Score??!
-
Im still playing around with the speaking part... *lol*
there's an easter egg in there (that's why its compiled.) *lol*
-
For those that are playing with this utility. If you have trouble understanding the voice, add commas. The voice recognizes commas and will pause. It does help to clarify words. This is pretty cool by the way. I'm setting up a function that will tell me a selected object name and layer.
-
wow.
I'm gonna have some fun tomorrow.
:evil:
-
GCS? :? The Glasgow Coma Score??!
Global Coordinates System ? How do you spell it ? In my country, it is named SCG.
Well I was just saying that it would have been funny to see Merlin going to the real Acad ModelSpace coordinates ;-)
-
If you have a colleague whom you do not love too much ^-^
(defun autocad_qui_parle (texte / sapi)
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke sapi "Speak" texte 0)
(vlax-release-object sapi)
)
(defun autocad_qui_parle_debut (rea cde)
(autocad_qui_parle (strcat "Your command ," (car cde) " will start"))
)
(defun autocad_qui_parle_inconnu (rea cde)
(autocad_qui_parle (strcat "unknown command ," (car cde)))
)
(defun autocad_qui_parle_cancel (rea cde)
(autocad_qui_parle (strcat "The command ," (car cde) " as cancelled"))
)
(defun autocad_qui_parle_failed (rea cde)
(autocad_qui_parle (strcat "The command ," (car cde) " as failed"))
)
(defun autocad_qui_parle_fin (rea cde)
(autocad_qui_parle (strcat "The command ," (car cde) " as ended"))
)
(if (not pourrir_la_vie)
(setq pourrir_la_vie (vlr-command-reactor nil (list (cons :vlr-commandWillStart (function autocad_qui_parle_debut))
(cons :vlr-unknownCommand (function autocad_qui_parle_inconnu))
(cons :vlr-commandCancelled (function autocad_qui_parle_cancel))
(cons :vlr-commandFailed (function autocad_qui_parle_failed))
(cons :vlr-commandEnded (function autocad_qui_parle_fin))
)
)
)
)
(princ)
@+
-
Add a delay between the sayings, and then add the works
"Deleting all objects one layer x unless you yell stop"
Then after the wait say.
"Didn't hear you, proceeding with deletion."
:lmao: :lmao: :evil:
I wish I used Autocad now
-
We've created a monster! Everyone in the office is running this one, and it's driving the boss crazy.
(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
-
If you have a colleague whom you do not love too much ^-^
Ummmm.. is it supposed to actually say the comma? "Your command comma line has started..." Yes I'm smart enough to remove the commas, but I thought it was a pause. Is my computer possessed again? :evil:
-
Yes, the comma is a small pause
My colleague will need his gri-gri :evil:
@+
-
My comma says 'comma' . In fact is says all the symbols including tilde. :?
-
....god I'm a geek.
First step to recovery is admittance.
:-D :-)
Is this the moment...?
http://www.theswamp.org/index.php?topic=14563.0
-
You're not supposed to spell comma, just put one in. :-D
-
You're not supposed to spell comma, just put one in. :-D
Now see a-huyre! :pissed: I mean, let me clarify :angel: : "Your command , line..." Actually says "Your command comma line..." I guess I should point out I'm running it in Map 3D 07 if that makes a difference
-
Lin-Z
don't put a space between command and the comma.
"Your command, line..."
-
Ohhhhhhhh, I guess I should pay closer attention when I copy/paste code. All fixed. :ugly:
-
You are mightily welcome!
-
Thanks Greg. I wouldn't have seen that. Very interesting stuff.
-
OK....so how would one query if the user has the speakers mute set, turn the volume to high, and then return it back to the previous settings?
-
hahaha love this!!!
can it be made to speak every command as its being typed on the keyboard?
-
Guess Who??
(DEFUN c:who ()
(setq who (vlax-create-object "sapi.SpVoice"))
(vlax-invoke who "Speak" "For Centuries, mankind has been trying to unravel the mysteries of the universe" 0)
(vlax-release-object who)
)
can you tell its nearly quitting time on a friday?
-
Here is a function version that makes it easier to use in programming. For my *error* function, I included:
(SayIt "Houston, we have a problem!"). Have you tried numbers yet? It's awesome! You have to type in "inches" and "feet" etc. I haven't tested it while a dialog is active, but I will tomorrow.
(defun SayIt (Phrase$ / Sapi)
(setq Sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke Sapi "Speak" Phrase$ 0)
(vlax-release-object Sapi)
(princ)
);defun SayIt
-
OK....so how would one query if the user has the speakers mute set, turn the volume to high, and then return it back to the previous settings?
Or how about turning the monitor off.
"This file will self destruct in 5 seconds."
Then the monitor goes black
-
Have you tried numbers yet? It's awesome! You have to type in "inches" and "feet" etc.
Try this:
3102880657' 6 7/8"
with a space between the foot mark and the six and another between the six and the three.
-
OK....so how would one query if the user has the speakers mute set, turn the volume to high, and then return it back to the previous settings?
Or how about turning the monitor off.
"This file will self destruct in 5 seconds."
Then the monitor goes black
Yes, or you can do that
(setq sh (vlax-create-object "shell.application")
(vlax-invoke sh 'ShutdownWindows)
@+
-
Dear Patrick_35 and Readers,
Question, can I also change the voice?
Regards,
HofCAD CSI.
(defun C:speakcfg(/ @volume @rate)
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(setq @volume (vlax-get-property sapi 'volume))
(vlax-put-property sapi 'volume 10)
(vlax-invoke sapi "Speak" "Do you want autocad 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)
(print (vlax-get-property (vlax-get-property Sapi 'Voice) 'Id))
(vlax-release-object sapi)
(princ)
)
http://www.microsoft.com/technet/scriptcenter/funzone/games/sapi.mspx
-
Yes, it's possible
An example to change the voice into French and on a female tone.
Sorry but it's in french ^-^
http://www.zebulon.fr/astuces/tip200/Synthese-vocale-Windows-en-francais.html
And this
http://www.developpez.net/forums/archive/index.php/t-62567.html
But you can go to http://www.microsoft.com/reader/downloads/pc.asp
@+
-
oh man I am having fun with this, thanks for the toys!
-
Yes, it's possible
An example to change the voice into French and on a female tone.
Dear Patrick_35 and Readers,
I can change the voice, but is this the right way.
Another question (vlax-invoke sapi "Speak" "Do you want autocad speak with a soft volume" 0)
ends with a zero.
I hear no change when I change it.
Regards,
HofCAD CSI.
(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)
)
-
Haha... I just freaked my co-worker out by making it say "I am a computer. I want to be a real boy. Can't you please help me?"
She honestly thought it was scary. :)
-
Does your cd tray slide out when you tell a lie? :?
-
Does your cd tray slide out when you tell a lie? :?
No, but what an addition to this little routine THAT would be!
"Please Help me! PLEASE..." *Out pops the CD Tray, reaching for assistance.* :lmao:
-
Does your cd tray slide out when you tell a lie? :?
No, but what an addition to this little routine THAT would be!
"Please Help me! PLEASE..." *Out pops the CD Tray, reaching for assistance.* :lmao:
I did something similar to that to a girl (with a nickname of Smurffett) in the office using the office stereo it's remote. I had her going for 10 minutes soild. She thought the thing was possessed. :ugly: :-D
-
I did something similar to that to a girl (with a nickname of Smurffett) in the office using the office stereo it's remote. I had her going for 10 minutes soild. She thought the thing was possessed. :ugly: :-D
"What the Smurf!?! This smurfing thing is smurfed!" :lmao:
-
AutoCAD will speak only if the OS is Windows XP, right?
Is it possible to detect the OS and call the "talking routine" only if it can talk?
-
AutoCAD will speak only if the OS is Windows XP, right?
Is it possible to detect the OS and call the "talking routine" only if it can talk?
(getenv "OS")
Did anyone figure out how to detect if sound is muted on the computer and set it to high?
Ron
-
You can make Win2000 speak also, but only if the proper updates have been installed. The first development of a speaking system I developed for AutoCAD was done on Win2000 and A2k.
The CD tray thingy can be done in VBA .. and you can call it in lisp ...
VBA Part (put in ThisDrawing window)
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Sub OpenCD()
mciSendString "open CDAudio", vbNull, 0&, vbNull
mciSendString "set CDAudio door open", vbNull, 0&, vbNull
End Sub
Lisp Part
(vl-vbarun "ThisDrawing.OpenCD")
Have fun
-
Ohh I can see this now.
code a reactor to some Autocad command to invoke the speaking part
With Something like
"Please don't do that, I don't like that. Your hurt me! So there fore I am going to open the CD tray."
Then open the CD tray.
Then load onto a persons computer
-
lol, this is hilarious. acaddoc.lsp here i come... haha
-
I have been following this thread, and have amazed my coworkers with my talking computer.
Here is another way to really amaze those around you...
http://www.oddcast.com/home/demos/tts/frameset.php?frame1=talk
Gary
-
You can make Win2000 speak also, but only if the proper updates have been installed. The first development of a speaking system I developed for AutoCAD was done on Win2000 and A2k.
Keith back in 2002 this update failed Internet Explorer Navigation Sound Update on my Windows 2000 system
I can not get the speech to work, is there any hope or would I have to reinstall Microsoft Internet Explorer?
My sound does work & i can play movies with sound. Although I have had problems from time to time with some movies.
PS when I use the link Gary supplied, she just looks at me, not even trying to speak. :-(
-
PS when I use the link Gary supplied, she just looks at me, not even trying to speak. :-(
x2
-
I found this info from others trying to get it to work on Windows 2000.
No one has gotten this to work in Windows 2000.
No amount of debuging, kicking or droping the computer on the floor will help.
Here is a section of code that I've included in our AcadDoc.lsp file that we're having fun with here at work.
(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
Here's the SayIt function
(defun SayIt (Phrase$ / Sapi)
(setq Sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke Sapi "Speak" Phrase$ 0)
(vlax-release-object Sapi)
(princ)
);defun SayIt
-
Thanks Terry for the 2K info.
-
Here's a link that you might try to test for other free voices, to see if they will run on your system.
http://www.bytecool.com/voices.htm
-
*bump*
:)
Should have bumped it a few days ago, in preparation for April Fool's.
-
This takes me back. I was doing some HD cleanup the outh day and deleted a bunch of the CV agent chat stuff.
-
Mine wont work,
; error: no function definition: VLAX-CREATE-OBJECT
-
Mine wont work,
; error: no function definition: VLAX-CREATE-OBJECT
Do you have (vl-load-com) issued from anywhere? You have to have this loaded once per session to use the ActiveX calls within lisp.
-
I knew it was something simple
-
I knew it was something simple
Glad it was simple. By the way, you can call (vl-load-com) as many times as you want with no performance loss, but it only needs to be called once.
-
I knew it was something simple
Glad it was simple. By the way, you can call (vl-load-com) as many times as you want with no performance loss, but it only needs to be called once.
Are you sure?
(while t (vl-load-com)) :lmao: :lmao:
-
I knew it was something simple
Glad it was simple. By the way, you can call (vl-load-com) as many times as you want with no performance loss, but it only needs to be called once.
Are you sure?
(while t (vl-load-com)) :lmao: :lmao:
I stand corrected. Good one Daron.
-
How in the heck did I miss this thread???
Great one!
-
(while t (vl-load-com))
seems to lock up my computer, ideas?
-
(while t (vl-load-com))
seems to lock up my computer, ideas?
Because it is always true, so it will keep issuing (vl-load-com). Just do it once, no while loop, at the beginning of the code.
-
It was a joke David. I was just toying with Tim's comment about being able to use (vl-load-com) as much as you want without performance loss. With that while loop, it will never finish executing the vl-load-com. You have performance loss from the get go, because it will eternally load or lock up as you experienced, never getting to the rest of the procedures.
-
OK we can get autocad to speak but what about play tones. I read in the a lisp programming book (not sure which one) that you can get autocad to beep. (or play sounds).
Anyone here know how this is possible. (I cold get the example to work if I remember) I also have beep on error turned off maybe that has something to do with it.
-
It was a joke David. I was just toying with Tim's comment about being able to use (vl-load-com) as much as you want without performance loss. With that while loop, it will never finish executing the vl-load-com. You have performance loss from the get go, because it will eternally load or lock up as you experienced, never getting to the rest of the procedures.
I guess I should have read it a little closer. For that matter, I should use LISP more
-
OK we can get autocad to speak but what about play tones. I read in the a lisp programming book (not sure which one) that you can get autocad to beep. (or play sounds).
Anyone here know how this is possible. (I cold get the example to work if I remember) I also have beep on error turned off maybe that has something to do with it.
you can get it to play any sound file located on your computer.
-
LOL I could just hear it now....
User Clicks on Close....
song starts "I hate everything about you....." :lmao:
error while in CAD, a Jim Carey sound byte "Yes! Yes! Can ya feel that buddy? Huh? Huh?"
-
I have a question about the MSAgents Can the be accessed through lisp? Can I show the characters with lisp?
-
I havn't looked at MsAgents
-
I have been playing around with a couple of things from this thread. I can't seem to get the voice to change. Is it possible?. I also played with the MSagents to no avail. (I don't know enough about accessing dll to get anything to work). Maybe some one can shed some light on this subject, or start a new thread with a little tut. to get me going.
-
You can try this tim, but it never worked for me.
(write-char 7)
-
Well this thread certainly got the creative juices flowing...
Let's have some fun with the MS Agent as well!
Hi How I can runt the MS agent.
I appload it , but I have no way to call or use it.
Thanks in advance
-
Ok, so Just wondering... How do you call a command (still having the command work) and have this be called at the same time or after, even before if possible.. Would you use an IF statement?
I was using the copy command.. but its to obvious because it stops the copy command.
(DEFUN c:C ()
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke sapi "Speak" "Johnny!." 0)
(vlax-invoke sapi "Speak" "What are you doing?." 0)
(vlax-release-object sapi)
)
-
Create a reactor and have it look for the start of a command.
You could modify this one.
http://www.theswamp.org/index.php?topic=22733.msg273953#msg273953
-
:-o Woo!! I will try to modify.. :laugh: Thanks...
-
*BUMP*
:-P
-
haha good timing.
-
For Five Sound Animations or Simulations of the Maltese cross or Geneva mechanism(HofMalt.zip),
and three Parallel mechanism(HofPar.zip) see:
http://forums.augi.com/showthread.php?t=55713&page=4
Regards,
HofCAD CSI
-
:-D funny !
thx Patrick and other people,
I changed the voice with "LH Veronique", it's fine
(vlax-create-object "Sapi.SpVoice")
(vlax-invoke sapi "Speak" "<VOICE REQUIRED=\"NAME=LH Veronique\">Patrick, merci et bonne journée" 0)
:-) Bruno
-
Want to Use SAPI to play wav file ?
(setq objVoice (vlax-create-object "Sapi.SpVoice")
objFile (vlax-create-object "SAPI.SpFileStream.1")
)
(vlax-invoke objFile "Open" "c:\\Windows\\Media\\Ding.wav")
(vlax-invoke objVoice "Speakstream" objFile 0)
(vlax-release-object objVoice)
(vlax-release-object objFile)
-
May want to look to see what voices are available first:
;; Check for available voices in registry
(vl-registry-descendents "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\Tokens\\")
<This is why I couldn't change the voice - I only had one voice installed /slaps forehead)
-
May want to look to see what voices are available first:
;; Check for available voices in registry
(vl-registry-descendents "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\Tokens\\")
<This is why I couldn't change the voice - I only had one voice installed /slaps forehead)
or this...
(setq objVoice (vlax-create-object "Sapi.SpVoice"))
(setq voice (vlax-get objVoice "Voice"))
(vlax-invoke voice 'GetDescription)
(vlax-release-object objVoice)
(vlax-release-object voice)
-
May want to look to see what voices are available first:
;; Check for available voices in registry
(vl-registry-descendents "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\Tokens\\")
<This is why I couldn't change the voice - I only had one voice installed /slaps forehead)
That will give the current voice but not the available voices.....
or this...
(setq objVoice (vlax-create-object "Sapi.SpVoice"))
(setq voice (vlax-get objVoice "Voice"))
(vlax-invoke voice 'GetDescription)
(vlax-release-object objVoice)
(vlax-release-object voice)
-
May want to look to see what voices are available first:
;; Check for available voices in registry
(vl-registry-descendents "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\Tokens\\")
<This is why I couldn't change the voice - I only had one voice installed /slaps forehead)
That will give the current voice but not the available voices.....
or this...
(setq objVoice (vlax-create-object "Sapi.SpVoice"))
(setq voice (vlax-get objVoice "Voice"))
(vlax-invoke voice 'GetDescription)
(vlax-release-object objVoice)
(vlax-release-object voice)
Yes you'r right.....it was only an example..
we need to use (vlax-for ...
maybe ?
-
wow. I so want to try this... but have NO IDEA where to start.
could someone please point me in the right direction?
-
Download this lsp file.
Place a copy of it in your AutoCAD support folder.
(example for AutoCAD MEP 2008)
C:\Documents and Settings\YourUserName\Application Data\Autodesk\ACD-MEP 2008\enu\Support
Open Your AutoCAD, type appload into the command line.
In the dialog box, browse to the folder you copied it to and select sayit.lsp
Click the load button, close the dialog box.
type:
sayit
into the command line.
type what you want AutoCAD to say.
This is an example of AutoCAD using text to speech.
If you wanted to load it with each session of AutoCAD you start you would likely want to either place this code into your acad.mnl file or your acad.lsp, or your acaddoc.lsp file.
(autoload "sayit" '("sayit"))
-
Download this lsp file.
Place a copy of it in your AutoCAD support folder.
(example for AutoCAD MEP 2008)
C:\Documents and Settings\YourUserName\Application Data\Autodesk\ACD-MEP 2008\enu\Support
Open Your AutoCAD, type appload into the command line.
In the dialog box, browse to the folder you copied it to and select sayit.lsp
Click the load button, close the dialog box.
type:
sayit
into the command line.
type what you want AutoCAD to say.
This is an example of AutoCAD using text to speech.
If you wanted to load it with each session of AutoCAD you start you would likely want to either place this code into your acad.mnl file or your acad.lsp, or your acaddoc.lsp file.
(autoload "sayit" '("sayit"))
cool cool. well see, I didn't know it was a lisp routine. I thought it was some sort of VBA code (which is where my weakness is - I guess I still can't recognize the difference between lisp routines and other code languages).
YAY I know what to do with lisps... lol. And why would I have to add the code into my acad.mnl or acad.lsp or acaddoc.lsp? isn't it easier to just add the sayit.lsp to the StartUp Suite?
-
Depends on what sort of deployment you have in place.
I have a bunch of customizations on a network drive and a profile loading it up afor all of my users.
For the most part using start up suite is not good practice in an enterprise environment. :kewl:
-
May want to look to see what voices are available first:
;; Check for available voices in registry
(vl-registry-descendents "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\Tokens\\")
<This is why I couldn't change the voice - I only had one voice installed /slaps forehead)
(defun C:VoiceList(/ i VoiceLst)
(setq Sapi (vlax-create-object "Sapi.SpVoice"))
(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))
)
;(vlax-release-object Sapi)
VoiceLst
)
VoiceList or (C:VoiceList) gives to me:
("Microsoft Mary" "Microsoft Mike" "Microsoft Sam" "Sample TTS Voice")
For sound Animations or Simulations of
five Maltese cross or Geneva mechanism (HofMalt.zip),
three Parallel mechanism(HofPar.zip),
Pulley, Valve, Bench Vice and a Hammer(HofAni1.zip) and for
exploded views of an U-bolt pipe strap and Shaft clamp(HofAni2.zip)
see:
http://forums.augi.com/showthread.php?t=55713&page=4&highlight=animation (http://forums.augi.com/showthread.php?t=55713&page=4&highlight=animation)
Regards,
HofCAD CSI
PS I made some modifications and additions in SpeakCfg.lsp.
For example, adding Wav sound, voice identification and warnings.
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).
-
*bump*
April Fools Day is right around the corner.
-
*bump*
April Fools Day is right around the corner.
That's my birthday! :)
-
*bump*
April Fools Day is right around the corner.
That's my birthday! :)
your mom failed to keep legs crossed till after midnight, huh?
:lmao:
mine succeeded. 8-)
-
*bump*
April Fools Day is right around the corner.
That's my birthday! :)
your mom failed to keep legs crossed till after midnight, huh?
:lmao:
mine succeeded. 8-)
That's the ONLY time your mom kept her legs crossed. *ZING!!*
-
Totally off topic, but are those your feet/shoes, Matt? I've seen those shoes but don't know anyone with them. Do you like them?
-
Totally off topic, but are those your feet/shoes, Matt? I've seen those shoes but don't know anyone with them. Do you like them?
Yes, those are my feet/shoes. I have two pairs and I love 'em. Those are the Vibram KSOs (http://www.vibramfivefingers.com/products/Five-Fingers-KSO-Mens.htm). I do about 25% of my running in them - roads, dreadmill, or in this case muddy trails. :love:
I'm easing back into them after this past winter when I didn't use them at all - I've got start building up the calluses on my feet again.
-
Nice Jokes,
But is it possible to change the voice of Mary in something different,
without using Microsoft Speech SDK 5.1.
(vl-load-com)
(setq Sapi (vlax-create-object "Sapi.SpVoice"))
(setq Voice (vlax-get-property Sapi 'voice))
(vlax-dump-object Voice T)
With Microsoft Speech I only hear the voices of Mary, Mike and Sam.
Regards.
-
Totally off topic, but are those your feet/shoes, Matt? I've seen those shoes but don't know anyone with them. Do you like them?
Yes, those are my feet/shoes. I have two pairs and I love 'em. Those are the Vibram KSOs (http://www.vibramfivefingers.com/products/Five-Fingers-KSO-Mens.htm). I do about 25% of my running in them - roads, dreadmill, or in this case muddy trails. :love:
I'm easing back into them after this past winter when I didn't use them at all - I've got start building up the calluses on my feet again.
Very cool. Is there a difference in those and what they call Camp Shoes?
I've been wanting to get a pair, but the price is a hard pill to swallow. I been working for years at hardening my feet (don't wear shoes unless I have to), but I'm still not brave enough to cruise deep in the woods barefoot.
It'd be a site seeing me come out of the woods during hunting season wearing those. :lol:
I'll eventually get a pair...
-
Totally off topic, but are those your feet/shoes, Matt? I've seen those shoes but don't know anyone with them. Do you like them?
Yes, those are my feet/shoes. I have two pairs and I love 'em. Those are the Vibram KSOs (http://www.vibramfivefingers.com/products/Five-Fingers-KSO-Mens.htm). I do about 25% of my running in them - roads, dreadmill, or in this case muddy trails. :love:
I'm easing back into them after this past winter when I didn't use them at all - I've got start building up the calluses on my feet again.
Very cool. Is there a difference in those and what they call Camp Shoes?
I've been wanting to get a pair, but the price is a hard pill to swallow. I been working for years at hardening my feet (don't wear shoes unless I have to), but I'm still not brave enough to cruise deep in the woods barefoot.
It'd be a site seeing me come out of the woods during hunting season wearing those. :lol:
I'll eventually get a pair...
What are "camp shoes"?
-
Totally off topic, but are those your feet/shoes, Matt? I've seen those shoes but don't know anyone with them. Do you like them?
Yes, those are my feet/shoes. I have two pairs and I love 'em. Those are the Vibram KSOs (http://www.vibramfivefingers.com/products/Five-Fingers-KSO-Mens.htm). I do about 25% of my running in them - roads, dreadmill, or in this case muddy trails. :love:
I'm easing back into them after this past winter when I didn't use them at all - I've got start building up the calluses on my feet again.
Very cool. Is there a difference in those and what they call Camp Shoes?
I've been wanting to get a pair, but the price is a hard pill to swallow. I been working for years at hardening my feet (don't wear shoes unless I have to), but I'm still not brave enough to cruise deep in the woods barefoot.
It'd be a site seeing me come out of the woods during hunting season wearing those. :lol:
I'll eventually get a pair...
What are "camp shoes"?
http://www.amazon.com/Original-MuckBoots-Unisex-Edgewater-Womens/dp/B000WG7NV6/ref=sr_1_1?ie=UTF8&qid=1301320551&sr=8-1
-
Yeah... Vibrams are a LOT different from camp shoes. :-D
-
Yeah... Vibrams are a LOT different from camp shoes. :-D
Minus the toes? I've never seen either in person, so I really was curious.
-
Hi guys... I like this thread so much.
I am trying to make it work but my skills are still quite poor.
I would like to make acad say Kaboom when I explode ...
i did this simple code but it is not really synchronized :)
(defun C:exx () (command "explode")
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-invoke sapi "Speak" "Kaboom" 0)
(vlax-release-object sapi))
I would like to see principle , to have simple function that after it is done says something or even better play a sound. Also I would need to have volume up.
Thanks
Jan
-
Hi jah011 and welcome to theswamp.
try this:
(defun C:exx ()
(command "._explode")
(while (/= 0 (getvar 'cmdactive))
(princ)
)
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-put-property sapi 'volume 2);;;volume
(vlax-put-property sapi 'rate 2);;;speed
(vlax-invoke sapi "Speak" "Kaboom" 0)
(vlax-release-object sapi)
)
-
Hi Andrea!
Thanks for the help!
I changed a routine according to some other comments and it goes like this now
(defun C:kab () (command "explode")
(while (> (getvar 'cmdactive) 0) (command pause))
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-put-property sapi 'volume 100);;;volume
(vlax-put-property sapi 'rate -3);;;speed
(vlax-invoke sapi "Speak" "Kaboom" 0)
(vlax-release-object sapi)
)
Another thing, maybe i am stretching out too far but i was trying to implement your code for playing wav... but no success
(setq objVoice (vlax-create-object "Sapi.SpVoice")
objFile (vlax-create-object "SAPI.SpFileStream.1")
)
(vlax-invoke objFile "Open" "c:\\Windows\\Media\\Ding.wav")
(vlax-invoke objVoice "Speakstream" objFile 0)
(vlax-release-object objVoice)
(vlax-release-object objFile)
-
These (http://forums.augi.com/showthread.php?53823-AutoCAD-Speak&p=1136694&viewfull=1#post1136694) old (http://forums.augi.com/showthread.php?53823-AutoCAD-Speak&p=1136822&viewfull=1#post1136822) posts (http://forums.augi.com/showthread.php?53823-AutoCAD-Speak&p=1154706&viewfull=1#post1154706) may be of use. :-)
Cheers
-
Another thing, maybe i am stretching out too far but i was trying to implement your code for playing wav... but no success
(setq objVoice (vlax-create-object "Sapi.SpVoice")
objFile (vlax-create-object "SAPI.SpFileStream.1")
)
(vlax-invoke objFile "Open" "c:\\Windows\\Media\\Ding.wav")
(vlax-invoke objVoice "Speakstream" objFile 0)
(vlax-release-object objVoice)
(vlax-release-object objFile)
Try this method for wav, mp3, etc...
(Setq wmp (vlax-get-or-Create-Object "MediaPlayer.MediaPlayer.1"))
(vlax-invoke-method wmp 'Open "c:\\Windows\\Media\\Ding.wav")
...
(vlax-invoke-method wmp 'Stop)
(vlax-release-object wmp)
-
How would this be done in a SCR type file outside of AutoCad?
-
How would this be done in a SCR type file outside of AutoCad?
Maybe THIS (http://www.visualbasicscript.com/Making-PC39s-Speak-with-SAPISpVoice-m63061.aspx) ?
-
How would this be done in a SCR type file outside of AutoCad?
Maybe THIS (http://www.visualbasicscript.com/Making-PC39s-Speak-with-SAPISpVoice-m63061.aspx) ?
Couldn't the SAPISpVoice be called through a SCR or a BAT file? I've tried the VBS route but I can't run it since I don't have Visual Studio.
-
You should be able to copy the code into notepad and save the file with a VBS extension. Then just double click on it.
-
You should be able to copy the code into notepad and save the file with a VBS extension. Then just double click on it.
I've tried that, and I don't have any program that will run it. I get the "Windows cannot open this file" dialog box. What am I missing?
-
You probably have to associate the file with MS Windows Script Based Host.
-
You probably have to associate the file with MS Windows Script Based Host.
I just tried associating it with Wscript.exe, and still nothing. It throws an error.
-
Not sure .. maybe a security setting ?
-
Not sure .. maybe a security setting ?
Bah, no big deal. I was just curious and wanted to play around. I've got bigger fish to fry right now, but if I get a solution I'll throw it in here. I appreciate the help though, thanks.
-
Hi,
Bad news, Patrick_35, the author of this popular thread died this year in March.
He was an active member of the French AutoCAD community, particularly on AutoLISP programming.
He was one of my mentors when I started using AutoLISP and encouraged me to follow Visual LISP (ActiveX).
Bye Patrick...
-
I’m very saddened to learn this. Thank you Mr. Chanteau. RIP Patrick.
-
I'm sorry to hear of this sad news, my sincere condolences go out to his family.
Patrick was a valued member of the CAD community and I, too, benefited in my learning from his knowledgeable contributions - he will be sorely missed by all.
-
Sorry to here this.
-
I'm sorry to hear this as well. He will be missed. :-\
-
Hi,
Bad news, Patrick_35, the author of this popular thread died this year in March.
He was an active member of the French AutoCAD community, particularly on AutoLISP programming.
He was one of my mentors when I started using AutoLISP and encouraged me to follow Visual LISP (ActiveX).
Bye Patrick...
:-(
Is that the same guy who started www.acadnetwork.com fourms?
-
Sincere condoglianze a tutta la famiglia.
Marco
-
Hi,
Bad news, Patrick_35, the author of this popular thread died this year in March.
He was an active member of the French AutoCAD community, particularly on AutoLISP programming.
He was one of my mentors when I started using AutoLISP and encouraged me to follow Visual LISP (ActiveX).
Bye Patrick...
:-(
Is that the same guy who started www.acadnetwork.com fourms?
No.
The guy who started acadnetwork is Patrick (Emin) which is now the Autodesk French Community manager (https://forums.autodesk.com/t5/user/viewprofilepage/user-id/528014).
Patrick_35, despite my efforts, never came to .NET programming.