Jump to content

Convert DWGPREFIX to link in E-Mail body


Manuel_Kunde

Recommended Posts

Hi all, this is a snippet of a lisp that generates an email. How can I insert the DWGPREFIX as a link in the "Body"? It only comes out as pure text.

 

(vlax-put-property objMail 'Body (getvar "DWGPREFIX"))

 

Link to comment
Share on other sites

Ok I got it, you need to add "file:///" to the path.

 

(vlax-put-property objMail 'Body (stract "file:///" (getvar "DWGPREFIX")))

 

Edited by Manuel_Kunde
forget bracket
Link to comment
Share on other sites

(vlax-put-property objMail 'Body (strcat "file:///" (getvar "DWGPREFIX")))

returns: ; error: bad argument type: VLA-OBJECT nil

 

What's the rest of that lisp look like?

 

Few related links: 

http://www.theswamp.org/index.php?topic=26953.msg324794#msg324794

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-e-mail-content-to-helpdesk/td-p/9077327

https://www.theswamp.org/index.php?topic=55486.0

Edited by tombu
Added links
Link to comment
Share on other sites

1 hour ago, tombu said:

What's the rest of that lisp look like?

 

Load and try.

 

(defun c:outlook ()

  (vl-load-com)
  
  (setq subject "This e-mail has no sense.")
  (setq to "email@example.com")
  (setq cc "emailtwo@example.com") ;carbon copy
  (setq name (getvar "loginname")) ;your loginname on the server
  (setq path (strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))) ;path to your folder
  (setq body (strcat "You won't find anything in this folder." "\n" "\n" ;first line with text
                       "file:///" Path "\n" "\n" ;second line with hyperlink
                       "kind regards," "\n" Name)) ;last two ones with your signature

  (setq olApp (vlax-get-or-create-object "Outlook.Application")) ;Vendor.Component.Version
  (setq objMail (vlax-invoke olApp 'CreateItem 0))
  	(vlax-put-property objMail 'Subject subject)
  	(vlax-put-property objMail 'To to)
  	(vlax-put-property objMail 'cc cc)
  	(vlax-put-property objMail 'Body body)
  
;----- request
  
	(setq request (acet-ui-message (strcat "Send e-mail "  "to " to "?") "Request before sending" 1))
  
  		(if (= request 1) ;ok
			;then
          	(progn (vlax-invoke objMail 'Send)) ;finally sended
			;else:
			(vl-exit-with-error (alert "Sending failed.")) ; end lisp
		)
  
;-----
  
)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...