Results 1 to 4 of 4

Thread: incorporate one autolisp routine to existing

  1. #1
    Member
    Join Date
    2008-10
    Posts
    10
    Login to Give a bone
    0

    Default incorporate one autolisp routine to existing

    i have one lips routine that add the open the new email, add the subject with the same name of the drawing
    I have another the open an email and add the dwg file to the email

    I would like to know if anybody can tell me how to add both of them so I have,
    1. dwg file add to email
    2. pdf file add to email
    and 3 subject of the email to be the same name as the drawing

    here is my main autolisp

    Code:
    defun c:mp ()
     (setq getemail "Jeremiah.Parsons@applusrtd.com");input email of helper
     (setq filepath (strcat "" (getvar "dwgname") ""))
      
    ;;Conversion Table
     (while (vl-string-position 32 filepath)
     (setq filepath (vl-string-subst "%20" " " filepath))
     );end while
     (while (vl-string-position 60 filepath)
     (setq filepath (vl-string-subst "%3C" "<" filepath))
     );end while
     (while (vl-string-position 62 filepath)
     (setq filepath (vl-string-subst "%3E" ">" filepath))
     );end while
     (while (vl-string-position 92 filepath)
     (setq filepath (vl-string-subst "%5C" "\\" filepath))
     );end while
     
    (command "_.start" (strcat "mailto:" getemail "?Subject=" filepath))
     );end defun
    and here is the autolisp that add the dwg.

    Code:
    (vl-load-com)
     (defun c:Edata (/ OUTLOOK MAIL-ITEM RECIPIANTS LOG-FILE ATTACHMENTS)
     (if
     (setq outlook (vlax-get-or-create-object "Outlook.Application"))
     (progn
     (setq mail-item (vlax-invoke-method outlook 'CreateItem 0))
     ;(vlax-invoke-method mail-item 'Save)
     (vlax-invoke-method mail-item 'Display)
     (ADD-RECIPIANTS MAIL-ITEM)
     (vlax-put-property mail-item 'Subject "SUBJECT HERE")
     (ATTACH-LOG-FILE MAIL-ITEM)
     )
     (princ "\nUnable to start Outlook...")
     )
     )
     
    (setq dn1 (vl-filename-base (getvar "dwgname")))
     (setq pn1 (vl-Filename-Base (vl-Filename-Directory (getvar "Dwgprefix"))))
     (SETQ fn1 (STRCAT dn1 ".pdf"))
     
    (defun ATTACH-LOG-FILE (MAIL-ITEM / ATTACHMENTS LOG-FILE)
     
    ;(setq sourcePath (getvar "dwgprefix"))
     ; (if (setq LOG-FILE (vl-directory-files sourcePath "*.dwg" 1))
     ; (foreach file LOG-FILE
     
    (if (setq LOG-FILE (findfile fn1))
     (progn
     (setq ATTACHMENTS (vlax-get-property mail-item 'Attachments))
     (vlax-invoke-method attachments 'Add LOG-FILE 1 1)
     )
     )
     )
     
    (defun ADD-RECIPIANTS (MAIL-ITEM / RECIPIANTS)
     (setq recipiants (vlax-get-property mail-item 'Recipients))
     (vlax-invoke-method
     recipiants
     'Add
     "YOUR EMAIL HERE"
     )
     ;(vlax-invoke-method
     ; recipiants
     ; 'ADD
     ; "email@email.com"
    
     
    ;(vlax-invoke mail-item 'Send)
     )
     
    
    (princ)
    thanks in advance
    Last edited by rkmcswain; 2015-06-02 at 04:00 PM. Reason: added [CODE] tags

  2. #2
    Member
    Join Date
    2008-10
    Posts
    10
    Login to Give a bone
    0

    Default Re: incorporate one autolisp routine to existing

    I did managed to do this task with an amazing help from another forum. thanks you all happy father's day

  3. #3
    Member
    Join Date
    2008-10
    Posts
    10
    Login to Give a bone
    0

    Default Re: incorporate one autolisp routine to existing

    Here is.

    Code:
    (defun c:mp ( / dir )
        (if (zerop (getvar 'dwgtitled))
            (princ "\nCurrent drawing is unsaved.")
            (rjp-outlookmessage
                "Jeremiah.Parsons@applusrtd.com"
                (getvar 'dwgname)
                (strcat  
                    (setq dir (vl-string-right-trim "\\" (getvar 'dwgprefix)))
                    
                )
                (vl-remove-if
                   '(lambda ( x )
                        (wcmatch (vl-filename-extension x) ".log,.bak,.dwl2,.dwl")
                    )
                    (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir nil 1))
                )
                nil
            )
        )
        (princ)
    )
    
    ;; Outlook Message  -  ronjonp (modified slightly by Lee Mac 
    ;; rcp - [str] Email address (separate multiple with semi-colon)
    ;; sub - [str] Subject
    ;; bdy - [str] Body of email
    ;; att - [lst] List of filenames to attach
    ;; snd - [bol] T=Send email; nil=Open email to edit
    . 
    
    (defun rjp-outlookmessage ( rcp sub bdy att snd / atm msg out rtn )
        (if (setq out (vlax-get-or-create-object "outlook.application"))
            (progn
                (setq rtn
                    (vl-catch-all-apply
                       '(lambda nil
                            (setq msg (vlax-invoke-method out 'createitem 0)
                                  atm (vlax-get msg 'attachments)
                            )
                            (vlax-put msg 'to rcp)
                            (vlax-put msg 'subject sub)
                            (foreach fnm att
                                (if (setq fnm (findfile fnm))
                                    (vlax-invoke atm 'add fnm)
                                )
                            )
                            (if snd
                                (vlax-invoke msg 'send)
                                (vlax-invoke msg 'display :vlax-true)
                            )
                            t
                        )
                    )
                )
                (foreach obj (list atm msg out)
                    (if (= 'vla-object (type obj))
                        (vlax-release-object obj)
                    )
                )
                (if (vl-catch-all-error-p rtn)
                    (prompt (vl-catch-all-error-message rtn))
                    rtn
                )
            )
        )
    )
     
    (vl-load-com) (princ)
    Last edited by Jmurphy; 2015-06-19 at 10:41 PM.

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: incorporate one autolisp routine to existing

    Quote Originally Posted by janthonylo View Post
    I did managed to do this task with an amazing help from another forum. thanks you all happy father's day
    You should include a link even though it was a different forum to give credit to those amazing folk who helped you.

Similar Threads

  1. Stationing Autolisp routine
    By aaronic_abacus in forum AutoLISP
    Replies: 32
    Last Post: 2020-03-06, 11:50 AM
  2. Replies: 0
    Last Post: 2007-02-16, 04:51 PM
  3. Select Similar Autolisp routine
    By VBOYAJI in forum AutoLISP
    Replies: 9
    Last Post: 2006-06-28, 05:31 PM
  4. Please help with Autolisp routine about Printing
    By Matt Mercer in forum AutoLISP
    Replies: 9
    Last Post: 2006-03-09, 03:27 PM
  5. HELP: need to run 2 Autolisp routine at a time
    By bradipos in forum AutoLISP
    Replies: 0
    Last Post: 2004-09-28, 01:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •