Author Topic: LM_PopUp.lsp  (Read 1245 times)

0 Members and 1 Guest are viewing this topic.

ROBBO

  • Bull Frog
  • Posts: 217
LM_PopUp.lsp
« on: October 07, 2014, 09:38:06 AM »
Code - Auto/Visual Lisp: [Select]
  1. ;;-------------------------=={ Popup }==----------------------;;
  2. ;;                                                            ;;
  3. ;;  Displays a pop-up message box prompting the user.         ;;
  4. ;;------------------------------------------------------------;;
  5. ;;  Author: Lee Mac, Copyright 2012 - www.lee-mac.com       ;;
  6. ;;------------------------------------------------------------;;
  7. ;;  Arguments:                                                ;;
  8. ;;  title - Text to be displayed in the pop-up title bar      ;;
  9. ;;  msg   - Text content of the pop-up message box            ;;
  10. ;;  flags - Integer indicating icon & button appearance       ;;
  11. ;;          Reference: http://lee-mac.com/popup.html          ;;
  12. ;;------------------------------------------------------------;;
  13. ;;  Returns:  Integer indicating the button pressed to exit   ;;
  14. ;;------------------------------------------------------------;;
  15.  
  16. (defun LM:Popup ( title msg flags / wsh res )
  17.     (if (setq wsh (vlax-create-object "wscript.shell"))
  18.         (progn
  19.             (setq res (vl-catch-all-apply 'vlax-invoke-method (list wsh 'popup msg 0 title flags)))
  20.             (vlax-release-object wsh)
  21.             (if (null (vl-catch-all-error-p res))
  22.                 res
  23.             )
  24.         )
  25.     )
  26. )
  27. (defun IWillOnlyRunOnceADay nil
  28.  
  29. (LM:Popup "PopUp Information" "This is a PopUp Message" (+ 0 64 4096))
  30. )
  31.  
  32.  
  33. (setq date (getenv "LMAC_OnceADay"))
  34. (= (fix (getvar 'DATE)) (atoi date))
  35. )
  36. )
  37. (IWillOnlyRunOnceADay)
  38. (setenv "LMAC_OnceADay" (itoa (fix (getvar 'DATE))))
  39. )
  40. )

I have used this very useful Sub-function for some time and have found it extremely useful. In there example above it is set to alert on AutoCAD start-up once-a-day. Can be adapted to suit one every week, month, etc.

The one thing I need a little help with is: How can this be adapted to appear only once for a user until sentenv is reset to 0?

Kind regards, Robbo.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

roy_043

  • Water Moccasin
  • Posts: 1747
  • BricsCAD 18
Re: LM_PopUp.lsp
« Reply #1 on: October 07, 2014, 09:51:53 AM »
Code: [Select]
(if (/= (getenv "AlertOnceDone") "1")
  (progn
    ...
    (setenv "AlertOnceDone" "1")
  )
)

ROBBO

  • Bull Frog
  • Posts: 217
Re: LM_PopUp.lsp
« Reply #2 on: October 07, 2014, 10:05:57 AM »
Thank you roy_043.

I am learning fast. Again thanks for the prompt reply. Works a treat!

All the best, Robbo.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

JAY

  • Newt
  • Posts: 105
Re: LM_PopUp.lsp
« Reply #3 on: October 07, 2014, 10:27:23 AM »
Thank you roy_043.

I am learning fast. Again thanks for the prompt reply. Works a treat!

All the best, Robbo.

I would like to see a sample .  :lol:

ROBBO

  • Bull Frog
  • Posts: 217
Re: LM_PopUp.lsp
« Reply #4 on: October 07, 2014, 10:57:06 AM »
Thank you roy_043.

I am learning fast. Again thanks for the prompt reply. Works a treat!

All the best, Robbo.

I would like to see a sample .  :lol:


77077,

Example lisp attached. Either drag and drop / load in to AutoCAD of add to your start-up lisp and pop as per attached should appear only once. If loaded again pop-up will not display until you reset with: (setenv "AlertOnceDone_EXAMPLE" "0").

Hope this helps.

Br, Robbo.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

JAY

  • Newt
  • Posts: 105
Re: LM_PopUp.lsp
« Reply #5 on: October 07, 2014, 11:10:40 AM »
Thank you roy_043.

I am learning fast. Again thanks for the prompt reply. Works a treat!

All the best, Robbo.

I would like to see a sample .  :lol:


77077,

Example lisp attached. Either drag and drop / load in to AutoCAD of add to your start-up lisp and pop as per attached should appear only once. If loaded again pop-up will not display until you reset with: (setenv "AlertOnceDone_EXAMPLE" "0").

Hope this helps.

Br, Robbo.

Thank you robbo!

ROBBO

  • Bull Frog
  • Posts: 217
Re: LM_PopUp.lsp
« Reply #6 on: October 07, 2014, 11:47:37 AM »
Your're Welcome.

May be worth having a look at this link too: http://lee-mac.com/popup.html
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)