Author Topic: How to avoid exiting while an error occurs?  (Read 1636 times)

0 Members and 1 Guest are viewing this topic.

litss

  • Guest
How to avoid exiting while an error occurs?
« on: November 17, 2009, 10:37:37 AM »
I am trying some code from others. But there is one line that just can't run properly in my thinkpad laptop. here is it
(vlax-create-object "Scripting.FileSystemObject")

I don't want the routine stop at that point, then I put an error checking for this line, but it fails.
(vl-catch-all-error-p (vlax-create-object "Scripting.FileSystemObject"))

Needs help. How can I write this error-check?

thx!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to avoid exiting while an error occurs?
« Reply #1 on: November 17, 2009, 10:48:44 AM »
Try this:
Code: [Select]
(vl-catch-all-apply 'vlax-create-object (list "Scripting.FileSystemObject"))
or this:
Code: [Select]
(setq err (vl-catch-all-apply 'vlax-create-object (list "Scripting.FileSystemObject")) )
(if (vl-catch-all-error-p err)
  (alert "Failed")
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

litss

  • Guest
Re: How to avoid exiting while an error occurs?
« Reply #2 on: November 18, 2009, 10:29:33 AM »
thx! CAB

It works:)

I've just read the help file, it seems that the vl-catch-all-apply and vl-catch-all-error-p should be used together, right?