Author Topic: Alarm between route  (Read 1734 times)

0 Members and 1 Guest are viewing this topic.

mohan

  • Newt
  • Posts: 98
Alarm between route
« on: June 22, 2021, 09:40:56 AM »
I want a sound between each route !      :sick:

Code: [Select]
(defun c: run ( / )
  (c:work1)
make sound . . .
  (c:work2)
make sound . . .
  (c:work3)
make sound . . .
(princ))
« Last Edit: June 22, 2021, 09:58:12 AM by mohan »
"Save Energy"

CodeDing

  • Newt
  • Posts: 51
Re: Alarm between route
« Reply #1 on: June 22, 2021, 09:54:42 AM »
Mohan,

Do you have Express Tools installed?
If so, you can use:
Code: [Select]
(acet-sys-beep 16)

https://www.cadsta.com/CADSTA-Tools-(acet-sys-beep).html

Best,
~DD
~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

CodeDing

  • Newt
  • Posts: 51
Re: Alarm between route
« Reply #2 on: June 22, 2021, 09:58:55 AM »
...or if you want to get real fancy, I use this one for jokes sometimes:

Code: [Select]
(defun Speak (txt / sapi)
  ;from user sea.haven @ https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/usb-flash-drive-serial-number/m-p/9631481#M402295
  ;txt - string, of text to have computer speak
  (if (eq (type txt) 'STR)
    (progn
      (setq sapi (vlax-create-object "Sapi.SpVoice"))
      (vlax-put sapi 'SynchronousSpeakTimeout 1)
      (vlax-invoke-method sapi 'WaitUntilDone 0)
      (vlax-invoke sapi "Speak" txt 0)
      (vlax-release-object sapi)
    );progn
  );if
  (princ)
);defun

Use like so:

Code: [Select]
(Speak "Program Complete.")
~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

Lonnie

  • Newt
  • Posts: 175
Re: Alarm between route
« Reply #3 on: June 22, 2021, 12:06:50 PM »
Neat.

I am replacing some of my alerts with speak.  :whistling:

(speak "You have been changed to DCE Standards.\n \nPlease restart Autocad.")

BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: Alarm between route
« Reply #4 on: June 22, 2021, 09:19:31 PM »
You may need 2 lines  or remove the \n's, 2 lines or more will do a pause between lines.

Code: [Select]
(speak "You have been changed to DCE Standards please restart Autocad")
or
(speak "You have been changed to DCE Standards")
(speak "please restart Autocad")


If you dont want the text to voice lisp in your code save to a support path then only need.
Code: [Select]
(if (not speak)(Load "text to voice"))

PS from sea.haven
A man who never made a mistake never made anything

mohan

  • Newt
  • Posts: 98
Re: Alarm between route
« Reply #5 on: June 23, 2021, 04:28:30 AM »
Mohan,

Do you have Express Tools installed?
If so, you can use:
Code: [Select]
(acet-sys-beep 16)

https://www.cadsta.com/CADSTA-Tools-(acet-sys-beep).html

Best,
~DD
Yes, Express Tools is installed, thank you guys
Still speaking sound learning . . .
"Save Energy"

Lonnie

  • Newt
  • Posts: 175
Re: Alarm between route
« Reply #6 on: June 23, 2021, 12:17:42 PM »
That line was directly from my alert. Work well just like that only I had to change AutoCAD to Autocad. It spelled out the cad. In addition the "." caused a pause anyway so the sentences were about perfect anyway. Pure play but I am thinking about adding a LOGINNAME to the sentence so it addresses the person by their last name.
Somthing like
(
(setq lg (getvar 'LOGINNAME))
(speak (strcat "hello mister" lg "You have been upgraded to the DCE Standards. Please restart Autocad. Thank you."))
)

You may need 2 lines  or remove the \n's, 2 lines or more will do a pause between lines.

Code: [Select]
(speak "You have been changed to DCE Standards please restart Autocad")
or
(speak "You have been changed to DCE Standards")
(speak "please restart Autocad")


If you dont want the text to voice lisp in your code save to a support path then only need.
Code: [Select]
(if (not speak)(Load "text to voice"))

PS from sea.haven
« Last Edit: June 23, 2021, 06:45:17 PM by Lonnie »

BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: Alarm between route
« Reply #7 on: June 23, 2021, 09:01:29 PM »
Use a cond and then full name our (getenv "username") was 2 letters and a number.

Code: [Select]
(cond
((= (getvar 'LOGINNAME) "Lg0123")(setq uname "Lonnie"))
((= (getvar 'LOGINNAME) "BR0123")(setq uname "Barney Rubble"))
((= (getvar 'LOGINNAME) "FF0123")(setq uname "Fred Flinstone"))
)
(speak (strcat "hello " uname "You have been upgraded to the DCE Standards. Please restart Autocad. Thank you."))

Good to know about "." = pause.
A man who never made a mistake never made anything

ronjonp

  • Needs a day job
  • Posts: 7528
Re: Alarm between route
« Reply #8 on: June 24, 2021, 12:15:49 PM »
Use a cond and then full name our (getenv "username") was 2 letters and a number.

Code: [Select]
(cond
((= (getvar 'LOGINNAME) "Lg0123")(setq uname "Lonnie"))
((= (getvar 'LOGINNAME) "BR0123")(setq uname "Barney Rubble"))
((= (getvar 'LOGINNAME) "FF0123")(setq uname "Fred Flinstone"))
)
(speak (strcat "hello " uname "You have been upgraded to the DCE Standards. Please restart Autocad. Thank you."))

Good to know about "." = pause.
@Bigal ... no need to set 'uname' for each entry:
Code - Auto/Visual Lisp: [Select]
  1. (setq uname (cond ((= (getvar 'loginname) "Lg0123") "Lonnie")
  2.                   ((= (getvar 'loginname) "BR0123") "Barney Rubble")
  3.                   ((= (getvar 'loginname) "FF0123") "Fred Flinstone")
  4.                   ("unknown user!")
  5.             )
  6. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Alarm between route
« Reply #9 on: June 24, 2021, 12:58:50 PM »
I'd probably opt for an association list for ease of maintenance e.g.:
Code - Auto/Visual Lisp: [Select]
  1. (setq lst
  2.    '(
  3.         ("Lg0123" . "Lonnie")
  4.         ("BR0123" . "Barney Rubble")
  5.         ("FF0123" . "Fred Flinstone")
  6.     )
  7. )
  8. (speak
  9.     (strcat
  10.         "hello "
  11.         (cond ((cdr (assoc (getvar 'loginname) lst)))("unknown user!"))
  12.         "You have been upgraded to the DCE Standards. Please restart Autocad. Thank you."
  13.     )
  14. )
  15.  

BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: Alarm between route
« Reply #10 on: June 24, 2021, 07:45:27 PM »
Lee good idea

The username was used in plot routines we had 4 floors in a building and it would auto send to correct plotter based on name. No up down stairs.

The only question is now do you know who Fred Flinstone is ? Yes or No please, gives away age.
A man who never made a mistake never made anything