TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: alanjt on March 16, 2018, 01:59:04 PM

Title: Error handling with style
Post by: alanjt on March 16, 2018, 01:59:04 PM
Code: [Select]
(defun *error* (msg)
  (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
    (progn (vl-bt)
           (command-s "_.browser" (strcat "https://www.google.com/search?q=\"" msg "\""))
           (princ (strcat "\nError: " msg))
    )
  )
)
Title: Re: Error handling with style
Post by: CAB on March 16, 2018, 02:00:32 PM
I like it. :)
Title: Re: Error handling with style
Post by: Grrr1337 on March 16, 2018, 02:36:29 PM
Certainly with style!  :-D

BTW got me thinking is there alternative to open a url with scripting objects instead of:
Code: [Select]
  (command-s "_.browser" (strcat "https://www.google.com/search?q=\"" msg "\""))
Title: Re: Error handling with style
Post by: MP on March 16, 2018, 02:36:53 PM
Fixed.

Code: [Select]
(defun *error* ( msg )

    (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
        (progn
            (vl-bt)
            (command-s "_.browser"
                (strcat
                    "https://www.google.com/search?q=site:theswamp.org \""
                    msg
                    "\""
                )
            )
            (princ (strcat "\nError: " msg))
        )
    )
   
    (princ)
   
)

 :-D
Title: Re: Error handling with style
Post by: alanjt on March 16, 2018, 02:43:39 PM
That's about the truth.

Fixed.

Code: [Select]
(defun *error* ( msg )

    (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
        (progn
            (vl-bt)
            (command-s "_.browser"
                (strcat
                    "https://www.google.com/search?q=site:theswamp.org \""
                    msg
                    "\""
                )
            )
            (princ (strcat "\nError: " msg))
        )
    )
   
    (princ)
   
)

 :-D