Author Topic: Problem with 2 email lips, I need your help, Please - Solved thank you all  (Read 6199 times)

0 Members and 1 Guest are viewing this topic.

janthonylo

  • Guest
 :-)I have  2 lisp from the internet,  (thanks in advance for those who create them)
 
MP is the most importante lisp, I want to keep this as the main lisp.
mp create an email from autocad
mp add the dwg name to the subject line of the email
mp add the name of the person I want to send the email.


MyMail (thanks to ronjonp)
this lisp create the email from autocad and add PDF, Autocad files,  .

It's possible to add the MyMail portion of attached the DWG and PDF to MP Autolips

it is possible for some body to help me or direct me how to do it?, I already try like 20 times and I dont get it. :-( :-( :-( :-(

thanks



« Last Edit: June 12, 2015, 03:07:23 PM by janthonylo »

PKENEWELL

  • Bull Frog
  • Posts: 319
Re: Problem with 2 email lips, I need your help, Please
« Reply #1 on: June 04, 2015, 04:13:20 PM »
Is this the example you are looking for? Just set the variables in the "C:MP" function to what you want - then load and run. Its the same as the arguments in RonJonp's "c: MyMail" example, just storing them in variables before applying them to his (rjp-OutlookMessage) function.

Code - Auto/Visual Lisp: [Select]
  1. (defun C:MP ()
  2.    (setq getemail "tomyself@somewhere.com"
  3.            filepath (getvar "dwgname")
  4.            body "This is a Test"
  5.           attch (list "C:\\File1.txt" "C:\\File2.txt")
  6.    )
  7.    (rjp-OutlookMessage getemail filepath attch body nil)
  8. )
  9.  
  10. ;; by ronjonp
  11. ;;http://www.theswamp.org/index.php?topic=26953.msg3?24794#msg324794
  12. ;;Usage
  13. ;(rjp-OutlookMessage
  14.   ;;email address (multiple separated by semicolon)
  15.   ;"johndoe@nowhere.com;johndoewife@nowhere.com"
  16.   ;;Subject
  17.   ;"Test Email"
  18.   ;;Attachments as a list of strings
  19.   ;'("C:\\test\\file1.txt" "C:\\test\\file2.txt" "C:\\test\\file3.txt")
  20.   ;;Text in body of email
  21.   ;"Nothing to read here :)"
  22.   ;;nil will open email to edit...T will send email in the background
  23.  ; nil
  24. ;)
  25. (defun rjp-OutlookMessage
  26.        (To Subject AttachmentList Body Send / objMail objOL)
  27.   (if (and (setq objOL (vlax-get-or-create-object "Outlook.Application"))
  28.            (setq objMail (vlax-invoke-method objOL 'CreateItem 0))
  29.       )
  30.     (progn
  31.       (vlax-put objMail 'To To)
  32.       (vlax-put objMail 'Subject Subject)
  33.       (vlax-put objMail 'Body Body)
  34.       (foreach file AttachmentList
  35.         (vl-catch-all-apply
  36.           'vlax-invoke
  37.           (list (vlax-get objMail 'Attachments)
  38.                 'Add
  39.                 file
  40.           )
  41.         )
  42.       )
  43.       (if send
  44.         (vlax-invoke objMail 'Send)
  45.         (vlax-invoke objMail 'Display :vlax-true)
  46.       )
  47.       (vlax-release-object objOL)
  48.       (vlax-release-object objMail)
  49.     )
  50.   )
  51.   (princ)
  52. )
  53.  
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

janthonylo

  • Guest
Re: Problem with 2 email lips, I need your help, Please
« Reply #2 on: June 04, 2015, 04:46:53 PM »
really appreciated your effort and your time, I have no way to apprecite it, however it didn't work, your program or autolisp does only:
1. open the email
2. add the subject, same name as the current drawing

it doesn't attached the dwg file and the Autocad file

any other suggestion? please

thank you again

PKENEWELL

  • Bull Frog
  • Posts: 319
Re: Problem with 2 email lips, I need your help, Please
« Reply #3 on: June 04, 2015, 06:36:50 PM »
really appreciated your effort and your time, I have no way to apprecite it, however it didn't work, your program or autolisp does only:
1. open the email
2. add the subject, same name as the current drawing

it doesn't attached the dwg file and the Autocad file

any other suggestion? please

thank you again

janthonylo,

That was meant to be an example only - not a full blown program. I am not writing this thing for you - just trying to point you in the right direction.

That being said try replacing this line:
Code - Auto/Visual Lisp: [Select]
  1. attch (list "C:\\File1.txt" "C:\\File2.txt")
With This Line:
Code - Auto/Visual Lisp: [Select]
  1. attch (list (strcat (getvar "dwgprefix")(getvar "dwgname")))

Cheers - Phil.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

janthonylo

  • Guest
Re: Problem with 2 email lips, I need your help, Please
« Reply #4 on: June 05, 2015, 10:05:05 AM »
uups! now I understand, 1000's thank you  :)
I really appreciate your effort to guide me, I really was going crazy

PKENEWELL

  • Bull Frog
  • Posts: 319
Re: Problem with 2 email lips, I need your help, Please
« Reply #5 on: June 05, 2015, 10:15:34 AM »
uups! now I understand, 1000's thank you  :)
I really appreciate your effort to guide me, I really was going crazy

No problem - glad I was able to Help. Of Course it is RonJonp that we should be thanking. All I did was show you how to incorporate his function into your command.  :-)
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

janthonylo

  • Guest
Re: Problem with 2 email lips, I need your help, Please
« Reply #6 on: June 05, 2015, 10:32:12 AM »
You are right, I really appreciate first RonJonp time and effort to help all of us.
second your time and effort too for help me on putt it together.

I am trying to incorporate this part so I can attached the PDF together with the already dwg file

(defun filelst (/ LST NAME PATH)
  (setq   path (getvar 'DWGPREFIX)
   name (vl-filename-base (getvar 'DWGNAME))
  )
  (foreach x (vl-directory-files path nil 1)
    (if   (and (wcmatch (vl-filename-base x) name)
        (not (wcmatch (vl-filename-extension x) ".bak,.dwl2,.dwl"))
   )
      (setq lst (cons (strcat path x) lst))
    )
  )
  lst
)

any idea?  :)

janthonylo

  • Guest
Re: Problem with 2 email lips, I need your help, Please
« Reply #7 on: June 05, 2015, 10:38:37 AM »
1. I add this to the attch line: attch (list (strcat (getvar "dwgprefix")(getvar "dwgname")(filelst)))

2. and this part to the bottom of the Autolisp.
(defun filelst (/ LST NAME PATH)
  (setq   path (getvar 'DWGPREFIX)
   name (vl-filename-base (getvar 'DWGNAME))
  )
  (foreach x (vl-directory-files path nil 1)
    (if   (and (wcmatch (vl-filename-base x) name)
        (not (wcmatch (vl-filename-extension x) ".bak,.dwl2,.dwl"))
   )
      (setq lst (cons (strcat path x) lst))
    )
  )
  lst





it should work but I get this error messge:
; error: bad argument type: stringp ("S:\\AutoCAD\\Anthony\\Vintage\\South Mountain Area\\2.5IN ARCO 27 FLOWLINE SILVERTHREAD LOCATION C CROSSING\\2.5IN ARCO 27 FLOWLINE SILVERTHREAD LOCATION C CROSSING.pdf" "S:\\AutoCAD\\Anthony\\Vintage\\South Mountain Area\\2.5IN ARCO 27 FLOWLINE SILVERTHREAD LOCATION C CROSSING\\2.5IN ARCO 27 FLOWLINE SILVERTHREAD LOCATION C CROSSING.dwg")
Command:

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Problem with 2 email lips, I need your help, Please
« Reply #8 on: June 05, 2015, 03:35:43 PM »
I would suggest something like:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:mp ( / dir )
  2.     (if (zerop (getvar 'dwgtitled))
  3.         (princ "\nCurrent drawing is unsaved.")
  4.         (rjp-outlookmessage
  5.             "tomyself@somewhere.com" ;; Destination
  6.             (getvar 'dwgname) ;; Subject
  7.             (strcat ;; Body
  8.                 "Emailing content of "
  9.                 (setq dir (vl-string-right-trim "\\" (getvar 'dwgprefix)))
  10.                 " folder."
  11.             )
  12.             (vl-remove-if
  13.                '(lambda ( x )
  14.                     (wcmatch (vl-filename-extension x) ".bak,.dwl2,.dwl")
  15.                 )
  16.                 (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir nil 1))
  17.             )
  18.             nil
  19.         )
  20.     )
  21.     (princ)
  22. )
  23.        
  24. ;; Outlook Message  -  ronjonp (modified slightly by Lee Mac :-)
  25. ;; rcp - [str] Email address (separate multiple with semi-colon)
  26. ;; sub - [str] Subject
  27. ;; bdy - [str] Body of email
  28. ;; att - [lst] List of filenames to attach
  29. ;; snd - [bol] T=Send email; nil=Open email to edit
  30.  
  31. (defun rjp-outlookmessage ( rcp sub bdy att snd / atm msg out rtn )
  32.     (if (setq out (vlax-get-or-create-object "outlook.application"))
  33.         (progn
  34.             (setq rtn
  35.                 (vl-catch-all-apply
  36.                    '(lambda nil
  37.                         (setq msg (vlax-invoke-method out 'createitem 0)
  38.                               atm (vlax-get msg 'attachments)
  39.                         )
  40.                         (vlax-put msg 'to rcp)
  41.                         (vlax-put msg 'subject sub)
  42.                         (vlax-put msg 'body bdy)
  43.                         (foreach fnm att
  44.                             (if (setq fnm (findfile fnm))
  45.                                 (vlax-invoke atm 'add fnm)
  46.                             )
  47.                         )
  48.                         (if snd
  49.                             (vlax-invoke msg 'send)
  50.                             (vlax-invoke msg 'display :vlax-true)
  51.                         )
  52.                         t
  53.                     )
  54.                 )
  55.             )
  56.             (foreach obj (list atm msg out)
  57.                 (if (= 'vla-object (type obj))
  58.                     (vlax-release-object obj)
  59.                 )
  60.             )
  61.             (if (vl-catch-all-error-p rtn)
  62.                 (prompt (vl-catch-all-error-message rtn))
  63.                 rtn
  64.             )
  65.         )
  66.     )
  67. )
  68.  

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Problem with 2 email lips, I need your help, Please
« Reply #9 on: June 05, 2015, 03:39:54 PM »
Why not just use Etransmit?
Be your Best


Michael Farrell
http://primeservicesglobal.com/

janthonylo

  • Guest
Re: Problem with 2 email lips, I need your help, Please
« Reply #10 on: June 05, 2015, 05:00:43 PM »
Lee mac,
Thank you very, very, very, very much Lee Mac, all of you are great people,
I been trying my self-making slow progress,  thank you again,
one question: it work perfect except doesn’t show up my outlook signature when it open the outlook email
what do you think would fix it?



mjfarrel:
I do like to keep my brain working all the time, if I have an idea then I put my brain at work.

PKENEWELL

  • Bull Frog
  • Posts: 319
Re: Problem with 2 email lips, I need your help, Please
« Reply #11 on: June 05, 2015, 05:23:54 PM »
Nice Lee! Sorry I didn't get back to the OP - was busy doin my day job!  :-D

Your code of course is more elegant than what I would've done.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

janthonylo

  • Guest
Re: Problem with 2 email lips, I need your help, Please
« Reply #12 on: June 05, 2015, 05:31:38 PM »
Indee, Thank you very, very, very, very much Lee Mac and Pkenewell and ronjonp, all of you are great people,

all I need now is to make my signature show up on the outlook window that pop up,   then go back to my normal life, until I find another idea and start burning
 my brain again.  :)

if I use shell command it show up,
(command "_.start" (strcat "mailto:
but how to incorporate it to the autolips? :-)
« Last Edit: June 05, 2015, 05:35:13 PM by janthonylo »

Peter2

  • Swamp Rat
  • Posts: 653
Re: Problem with 2 email lips, I need your help, Please
« Reply #13 on: June 05, 2015, 05:40:55 PM »
...
but how to incorporate it to the autolips? :-)
If you asking for the basics - like what is a lisp, how to start it, how to use it? - then take a look at the tutorials, like
http://lee-mac.com/tutorials.html#lisptutorials
http://www.afralisp.net/index.php
and some others.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

janthonylo

  • Guest
Re: Problem with 2 email lips, I need your help, Please
« Reply #14 on: June 05, 2015, 05:43:56 PM »
Thanks Peter2, for sure I will look into this link you provide, I appreciate it :)