link DCL/E-mail/file, e so much help

link DCL/E-mail/file, e so much help

rolisonfelipe
Collaborator Collaborator
1,061 Views
3 Replies
Message 1 of 4

link DCL/E-mail/file, e so much help

rolisonfelipe
Collaborator
Collaborator

I'm creating this lsp to link the contact and their respective email in the dcl, after clicking on the link open the customer's email with the file name, this is possible! ????
happy New Year to everybody!!!

 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST-TEST-T : dialog
{label = "TEST";
:row{


:row{
: boxed_column{ label="[ EMAIL ]";
: text {value= "_________________________________________________________________________________________";width=30;alignment=LEFT;}
: button {label = "[email protected]"; key = "url01";fixed_width=true;width=5;alignment=centered;}
: button {label = "[email protected]"; key = "url02";fixed_width=true;width=5;alignment=centered;}
: button {label = "[email protected]"; key = "url03";fixed_width=true;width=5;alignment=centered;}
: text {value= "_________________________________________________________________________________________";width=30;alignment=LEFT;}
}
}
:row{
: boxed_column{ label="[ CONTACT ]";
: text {value= "_________________________________________________________________________________________";width=30;alignment=LEFT;}
: text {value= "CITY NAME TELEFONE ";width=150;alignment=LEFT;}
: text {value= "_________________________________________________________________________________________";width=30;alignment=LEFT;}
: text {value= "01 CITY NAME TELEFONE ";width=150;alignment=LEFT;}
: text {value= "02 CITY NAME TELEFONE ";width=150;alignment=LEFT;}
: text {value= "03 CITY NAME TELEFONE ";width=150;alignment=LEFT;}
: text {value= "_________________________________________________________________________________________";width=30;alignment=LEFT;}
}
}
}

ok_only;
} ;end dcl

 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

;start lsp
(DEFUN C:SEND ()
(setq ARQ_DCL (load_dialog "STANDARD-MENU") )
(new_dialog "TEST-TEST-T " ARQ_DCL)
(start_dialog)
(princ)
)
;;;;


(DEFUN C:EMAIL()
(setq FLAGOK nil)
(setq NAME_a nil)
(setq NAME_b nil)
(setq NAME_c nil)
(setq dcl_id (load_dialog "TEST-TEST-T "))
(setq FLAGOK1 T)
(setq XFIM1 0)
(while FLAGOK1
(action_tile "URL03" "(setq NAME_a 1)(done_dialog 2)")
(action_tile "URL02" "(setq NAME_a 1)(done_dialog 2)")
(action_tile "URL01" "(setq NAME_b 1)(done_dialog 1)")
(action_tile "BT-SAIR" "(done_dialog 0)")
(setq XFIM1 (start_dialog))
;
(if (= XFIM1 0) (setq FLAGOK1 nil))
(if (= XFIM1 1) (c:NAME_a))
(if (= XFIM1 2) (c:NAME_b))
(if (= XFIM1 2) (c:NAME_C))
)
(princ)
);end lsp


(defun c:NAME_a ()
(startapp "EMAIL" (strcat "/N,/E," (getvar "DWGPREFIX"))
(setq adress ( [email protected]))
(princ));end lsp

(defun c:NAME_a ()
(startapp "EMAIL" (strcat "/N,/E," (getvar "DWGPREFIX"))
(setq adress ( [email protected]))
(princ));end lsp

(defun c:NAME_c ()
(startapp "EMAIL" (strcat "/N,/E," (getvar "DWGPREFIX"))
(setq adress ( [email protected]))
(princ));end lsp

 

 

 

 

0 Likes
Accepted solutions (1)
1,062 Views
3 Replies
Replies (3)
Message 2 of 4

rolisonfelipe
Collaborator
Collaborator

I'm creating this lsp to link the contact and their respective email in the dcl, after clicking on the link open the customer's email with the file name, this is possible! ????
happy New Year to everybody!!!

0 Likes
Message 3 of 4

CodeDing
Mentor
Mentor
Accepted solution

@rolisonfelipe ,

 

I think this is what you are looking for? I was bored today so decided to practice with DCL coding.

 

image.png

 

(defun c:SEND ( / userData fPath dclEmail cnt email)
  (vl-load-com)
  ;Set initial data (Maximum of 5 users, otherwise the dialog box will be very large)
  (setq userData '(
    ("Bob Ross" "[email protected]" "(123) 456-7890" "City 1")
    ("Charlie Brown" "[email protected]" "(123) 456-7890" "City 2")
    ("Dierks Bentley" "[email protected]" "(123) 456-7890" "City 3")
    ;;("Jack Daniels" "[email protected]" "(123) 456-7890" "City 4")
    ;;("Keith Stone" "[email protected]" "(123) 456-7890" "City 5")
  ));list/setq
  (cond
    ((or (not userData) (zerop (length userData))) (Send_ErrMsg "\nNo users found."))
    ((> (length userData) 5) (Send_ErrMsg "\nToo many users in 'userData' list."))
  );cond
  ;Create dialog
  (setq fPath (Send_CreateDialog userData))
  ;Initialize Dialog
  (setq dclEmail (load_dialog fPath))
  (if (not (new_dialog "Email_Main" dclEmail))
    (Send_ErrMsg "\nError loading dialog.")
  );if
  ;Set emails for buttons
  (setq cnt -1)
  (foreach u userData
    (action_tile
      (strcat "user_" (itoa (setq cnt (1+ cnt))))
      (strcat "(progn (setq email \"" (cadr u) "\") (done_dialog))")
    );action_tile
  );foreach
  ;Start Dialog
  (start_dialog)
  ;If user selected email button, start email
  (if email
    (command "_.START" (strcat "mailto:" email "?subject=" (getvar 'DWGNAME)))
  );if
  (unload_dialog dclEmail)
  (princ)
);defun

(defun Send_CreateDialog (ud / fPath cnt str f)
  ;Creates DCL file for users listed in 'userData'
  (setq fPath (vl-filename-mktemp nil nil ".dcl"))
  (setq cnt -1)
  (setq ud
    (mapcar
      '(lambda (u)
        (strcat
          "\n: boxed_column"
          "\n{"
          "\nlabel = \"" (car u) "\";"
          "\n: button { key=\"user_" (itoa (setq cnt (1+ cnt))) "\"; label=\"" (cadr u) "\"; }"
          "\n: text { value=\"" (caddr u) "\"; }"
          "\n: text { value=\"" (car (cdddr u)) "\"; }"
          "\n}"
        );strcat
      );lambda
      ud
    );mapcar
  );setq
  (setq str
    (apply
      'strcat
      (append
        (list
          "Email_Main : dialog"
          "\n{"
          "\n  label = \"Select User\";"
          "\n  width = 50;"
          "\n  : spacer {}"
          "\n  : boxed_column"
          "\n  {"
          "\n    label = \"Users\";"
        );list
        ud
        (list
          "\n  }"
          "\n  : spacer {}"
          "\n  : spacer {}"
          "\n  : spacer {}"
          "\n  : button { key=\"cancel\"; label=\"Cancel\"; fixed_width=true; width=15; alignment=right; is_cancel=true; is_default=true; }"
          "\n  : spacer {}"
          "\n}"
        );list
      );append
    );apply
  );setq
  (setq f (open fPath "w"))
  (write-line str f)
  (close f)
  fPath
);defun

(defun Send_ErrMsg (s / )
  (prompt s)
  (alert s)
  (exit)
);defun

 

Best,

~DD

0 Likes
Message 4 of 4

rolisonfelipe
Collaborator
Collaborator

;;;; dcl

EXECUTAR_EMAIL : dialog
{label = "CONTATO";
:row{

:row {

:row{
: boxed_column{ label="[ BUTTON FOR SEND ONE EMAIL BY NAME]";
: button {label = "@" ; key = "LINK01";fixed_width=true;width=0;height = 1;alignment=centered;}
: button {label = "@" ; key = "LINK02";fixed_width=true;width=0;height = 1;alignment=centered;}
: button {label = "@" ; key = "LINK03";fixed_width=true;width=0;height = 1;alignment=centered;}
}
}

:row{
: boxed_column{ label="[ CONTACT REFERENCE OF LINK - ONLY FOR SEE IN DCL -]";
: text {value= "1 CITY NAME EMAIL PHONE ";width=50;alignment=left;}
: text {value= "2 CITY NAME EMAIL PHONE ";width=50;alignment=left;}
: text {value= "3 CITY NAME EMAIL PHONE ";width=50;alignment=left;}
}
}
}

:column{
: slider {layout = vertical ;key = "myslider" ;max_value = 5;min_value = 0;value = "5";big_increment = 2;alignment = right;}
}
}
cancel_button;
}

 

 

;;;LSP

(DEFUN C:EXECUTAR_EMAIL ()
(setq ARQ_DCL (load_dialog "STANDARD-MENU") )
(new_dialog "EXECUTAR_EMAIL" ARQ_DCL)
(start_dialog)
(princ)
)
;;;;


(DEFUN C:EMAIL()
(defun filelst ( / LST NAME PATH)
(setq path (getvar 'DWGPREFIX)
NAME (vl-filename-base (getvar 'DWGNAME)))
(foreach x (vl-directory-files PATH nil 1)
(if (wcmatch (vl-filename-base x) name)
(setq LST (cons (strcat PATH x) LST)))) LST )
(setq FLAGOK nil)
(setq SEND_a nil)
(setq SEND_b nil)
(setq SEND_c nil)
(setq dcl_id (load_dialog "STANDARD-MENU"))
(setq FLAGOK1 T)
(setq XFIM1 0)
(while FLAGOK1
(new_dialog "EXECUTAR_EMAIL" dcl_id)
(action_tile "LINK03" "(setq SEND_c 1)(done_dialog 3)")
(action_tile "LINK02" "(setq SEND_b 1)(done_dialog 2)")
(action_tile "LINK01" "(setq SEND_a 1)(done_dialog 1)")
(action_tile "BT-SAIR" "(done_dialog 0)")
(setq XFIM1 (start_dialog))
(if (= XFIM1 0) (setq FLAGOK1 nil))
(if (= XFIM1 1) (c:SEND_a))
(if (= XFIM1 1) (c:SEND_b))
(if (= XFIM1 2) (c:SEND_c))) (princ))

(defun c:SEND_a ();TEST 01
(vl-load-com)
(rjp-OutlookMessage "[email protected]" "Testing the email, HELLOW! I SEND THIS FILE FOR YOU " (filelst) ". \n\n ATT. \n\n NAME \n\n FORMATION" nil )
(if (and (setq objOL (vlax-get-or-create-object "email.Application"))
(setq objMail (vlax-invoke-method objOL 'CreateItem 0)))
(progn (vlax-put objMail 'To To)
(vlax-put objMail 'Subject Subject)
(vlax-put objMail 'Body Body)
(foreach file AttachmentList
(vl-catch-all-apply
'vlax-invoke
(list (vlax-get objMail 'Attachments) 'Add file)))
(if send
(vlax-invoke objMail 'Send)
(vlax-invoke objMail 'Display :vlax-true)
(vlax-release-object objOL)
(vlax-release-object objMail)))
(princ)
)
)

(defun c:SEND_b ();TEST 02
(startapp "EMAIL" (strcat "/N,/E," (getvar "DWGPREFIX"))
(setq adress ( [email protected]))
(princ))

(defun c:SEND_c ();TEST 03
(To Subject AttachmentList Body Send / objMail objOL)
(setq file (strcat "HELLOW! I SEND THIS FILR FOR YOU " (getvar 'DWGPREFIX) (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) ". \N\N ATT. \N\N I AM \N\N ENG." ))
(princ))

 

links

Solved: Looking for a LISP to attach current drawing/open drawing to email - Autodesk Community - Au...

Solved: Lisp to e-mail content to helpdesk. - Autodesk Community - AutoCAD

Solved: LISP to attach all files with same name to email - Autodesk Community - AutoCAD

 

;;;try this model, you model is very good. about i need a simple dcl

;;; any email dont load email.exe... i donot job wich Outlook.Application

 

 

rolisonfelipe_0-1610068779246.png

 

0 Likes