CADsite forum

AutoCAD => Autolisp => Topic gestart door: WebRacer op zo 26 06 2005, 22:28:54

Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op zo 26 06 2005, 22:28:54
:shock: hoi, ik heb hier een probleem, even kijken of er mensen zijn die dit weten....
ik wil vanuit visual lisp een email sturen maar dit schijnt niet goed te lukken weet er iemand hoe dit op te lossen,
ik had dit geschreven maar dit lukt echt niet...

;met wat hulp van David M. Stein
;probeerde ik dit
;CdLspOlivier = de tekst die ik wil verzenden
(defun sendmail (/ cdoMail)
(cond
   (
    (setq cdoMail (vlax-create-object "CONDTS.NewMail"))
    (vlax-put-property cdoMail 'From "xxx")
    (vlax-put-property cdoMail 'To "Olivier.Hautekeete@telenet.be")
    (vlax-put-property cdoMail 'Subject "Registratie Code Lisp")
    (vlax-put-property cdoMail 'Body CdLspOlivier)
    (vlax-put-property cdoMail 'Importance 1)
    (vlax-invoke-method cdoMail 'Send)
    (vlax-release-object cdoMail)
    (setq cdoMail nil)
   )
 )
 (princ)
)
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 10:47:08
Dag webracer,

Vanwaar wil jij uw email versturen? Vanuit autocad zelf of een ander programma?
Want dit is mogelijk met de Autocad 2002 versie.


CiteerStandard toolbar:

File Menu: eTransmit

Command line: etransmit

Creates a transmittal set of a drawing and related files.

The Create Transmittal dialog box includes the following tabs:

General
Files
Report
General Tab (Create Transmittal Dialog Box)
Creates a transmittal set of a specific type.

Notes
Provides a space where you can enter notes related to a transmittal set. The notes are included in the transmittal report. You can specify a template of default notes to be included with all your transmittal sets by creating an ASCII text file called etransmit.txt. This file must be saved to a location specified by the Support File Search Path option on the Files tab of the Options dialog box. See Report Tab (Create Transmittal Dialog Box), Files Tab (Options Dialog Box).

Type
Specifies the type of transmittal set created.

Folder

Creates a transmittal set of uncompressed files in a new or existing folder.

Self-extracting Executable

Creates a transmittal set of files as a compressed, self-extracting executable file. Double-clicking the resulting EXE file decompresses the transmittal set and restores the files.

Zip

Creates a transmittal set of files as a compressed zip file. To restore the files, you need a decompression utility such as the shareware application PKZIP or WinZip.

Password
Opens the Password dialog box, in which you can specify a password for your transmittal set.

Location
Specifies the location in which the transmittal set is created. Location lists the last ten locations in which transmittal sets were created. To specify a new location, choose Browse and navigate to the location you want.

Browse
Opens a standard file selection dialog box, in which you can navigate to a location where you create the transmittal set.

Convert Drawings To
Specifies the file format of all drawings included in a transmittal set. When this option is selected, you can select an AutoCAD drawing format from the drop-down list.

Preserve Directory Structure
Preserves the directory structure of all files in the transmittal set, facilitating ease of installation on another system. If this option is cleared, all files are installed to the target directory when the transmittal set is installed. This option is not available if you're saving a transmittal set to an Internet location.

Remove Paths from Xrefs and Images
Removes paths from any cross-referenced drawings or images in the transmittal set.

Send E-mail with Transmittal
Launches the default system email application when the transmittal set is created so that you can send an email notifying others of the new transmittal set.

Make Web Page Files
Generates a Web page that includes a link to the transmittal set.


Indien het met etransmit is kan ik er achter zoeken.

MVG

Kenny
Titel: Re: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 11:31:13
Citaat van: WebRacer
;met wat hulp van David M. Stein
;probeerde ik dit
;CdLspOlivier = de tekst die ik wil verzenden
(defun sendmail (/ cdoMail)
(cond
   (
    (setq cdoMail (vlax-create-object "CONDTS.NewMail"))

Hier loopt hij bij mij al vast.

Command: sendmail
; error: no function definition: VLAX-CREATE-OBJECT


    (vlax-put-property cdoMail 'From "xxx")
    (vlax-put-property cdoMail 'To "Olivier.Hautekeete@telenet.be")
    (vlax-put-property cdoMail 'Subject "Registratie Code Lisp")
    (vlax-put-property cdoMail 'Body CdLspOlivier)
    (vlax-put-property cdoMail 'Importance 1)
    (vlax-invoke-method cdoMail 'Send)
    (vlax-release-object cdoMail)
    (setq cdoMail nil)
   )
 )
 (princ)
)
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 11:35:06
Nu heb ik wat verder gezocht.

Citeer(vlax-create-object "Excel.Application")

Moet gij ook eerst uw programma niet laten starten?

Citeer(setq cdoMail (vlax-create-object "outlook.Application"))
Titel: Re: Email zenden vanuit Visual lisp
Bericht door: HofCAD op ma 27 06 2005, 11:40:56
Citaat van: Kenny H
;met wat hulp van David M. Stein
;probeerde ik dit
;CdLspOlivier = de tekst die ik wil verzenden
(defun sendmail (/ cdoMail)
(cond
   (
    (setq cdoMail (vlax-create-object "CONDTS.NewMail"))

Hier loopt hij bij mij al vast.

Command: sendmail
; error: no function definition: VLAX-CREATE-OBJECT
Beste Kenny,

Ik heb het probleem van WebRacer niet opgelost, maar jij moet
eerst :
(vl-load-com)
of
(if (car (atoms-family 1 '("vl-load-com")))
   (vl-load-com)
 )
gebruiken, om Visual lisp te laden.

Groetjes HofCAD CSI
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 11:44:00
Oké ik zal het eens uitproberen.

Bedankt HofCAD
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 11:55:11
Weet er iemand hoe je outlook ed kunt opstarten via lisp?

Voor Word is het

Citeer(vl-load-com)
    (setq cdoMail (vlax-create-object "word.Application"))
    (vla-put-visible cdoMail :vlax-true)

Maar voor outlook is het dit NIET :!:

Citeer(vl-load-com)
    (setq cdoMail (vlax-create-object "outlook.Application"))
    (vla-put-visible cdoMail :vlax-true)
Titel: Email zenden vanuit Visual lisp
Bericht door: HofCAD op ma 27 06 2005, 11:59:55
Beste Kenny,

Kijk eens naar
http://discussion.autodesk.com/thread.jspa?threadID=277206

Groetjes HofCAD  CSI
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 12:06:17
Beste HofCAD

Ik heb mijn antwoord gevonden op Autodesk.
Nogmaals bedankt.
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 12:09:46
(defun C:MAILTO ( / shell)
(setq shell
(vla-GetInterfaceObject
(vlax-get-acad-object)
"Shell.Application"
)
)
(vlax-invoke-method
Shell
'Open
"mailto:kenny.habils@skynet.com"
)
(vlax-release-object shell)
(PRIN1)
)
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op ma 27 06 2005, 12:11:15
Ik zal straks verder zoeken om dit

(vlax-put-property cdoMail 'To "Olivier.Hautekeete@telenet.be")
(vlax-put-property cdoMail 'Subject "Registratie Code Lisp")
(vlax-put-property cdoMail 'Body CdLspOlivier)
(vlax-put-property cdoMail 'Importance 1)

er in te krijgen.
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op ma 27 06 2005, 15:34:23
Schitterend, dit is echt wel prachtig hoe iedereen zo ter hulp snelt...
Thx gasten :shock:  :shock:
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op ma 27 06 2005, 17:32:36
Met jullie hulp kwam ik reeds tot hier...
Nu zou enkel nog de mail moeten verzonden worden zonder dat de
gebruiker dit nog hoeft te doen... Als dat mogelijk is tenminste,
Maar ik Weet Dat Alles Mogelijk Is...
Door jullie zit ik al zover..

;met wat hulp van David M. Stein
;probeerde ik dit
;CdLspOlivier = de tekst die ik wil verzenden
(defun sendmail (/ Mail)
(cond
 (
  (setq mail (strcat "mailto:Olivier.Hautekeete@telenet.be"
          "?Subject=Dit is het onderwerp."
          "&body=" CdLspOlivier
         )
  )
  (setq IShell (vlax-create-object "Shell.Application.1"))
  (setq imail (vlax-invoke-method IShell "ShellExecute" mail))
  (vlax-release-object IShell)
 )
)
(princ)
)
Titel: Email zenden vanuit Visual lisp
Bericht door: julien op ma 27 06 2005, 18:17:47
Citaat van: WebRacerNu zou enkel nog de mail moeten verzonden worden zonder dat de
gebruiker dit nog hoeft te doen... Als dat mogelijk is tenminste,
Ik ken de oplossing niet, maar ik denk wel dat je tegen een firewall gaat aanlopen.
Titel: Email zenden vanuit Visual lisp
Bericht door: HofCAD op di 28 06 2005, 13:50:54
Citaat van: WebRacerMet jullie hulp kwam ik reeds tot hier...
Nu zou enkel nog de mail moeten verzonden worden zonder dat de
gebruiker dit nog hoeft te doen... Als dat mogelijk is tenminste,
Maar ik Weet Dat Alles Mogelijk Is...
Door jullie zit ik al zover..

;met wat hulp van David M. Stein
;probeerde ik dit
;CdLspOlivier = de tekst die ik wil verzenden
(defun sendmail (/ Mail)
(cond
 (
  (setq mail (strcat "mailto:Olivier.Hautekeete@telenet.be"
          "?Subject=Dit is het onderwerp."
          "&body=" CdLspOlivier
         )
  )
  (setq IShell (vlax-create-object "Shell.Application.1"))
  (setq imail (vlax-invoke-method IShell "ShellExecute" mail))
  (vlax-release-object IShell)
 )
)
(princ)
)

Beste Lezers,

Weet een van U wat  ik bij "Microsoft Windows NT Version 4.0 (x86)" moet veranderen in de regel:
  (setq IShell (vlax-create-object "Shell.Application.1"))
Bij voorbaat mijn dank.

Groetjes HofCAD CSI

PS1 Ik heb een leuke Lisp gevonden om Google met zoektermen
     op te starten.


(defun C:Google(/ term termlist)
(defun plusify (str / n)
(while (setq n (vl-string-search " " str))
(setq str (vl-string-subst "+" " " str n)))
str)
;;usage: (google '("unwind skipped on exception"))
(defun GoogleSub (TermList / UrlStr)
(setq UrlStr
(strcat "http://groups.google.com/groups?q="
"group%3Aautodesk.autocad.customization"))
(foreach term termlist
(setq UrlStr
(strcat UrlStr "+%22" (plusify term) "%22")))
(setq UrlStr (strcat UrlStr "&ie=UTF-8&oe=UTF-8&hl=en"))
(command "BROWSER" UrlStr))
(while
(not(= "" (setq term(getstring"\nEnter search term or to finalize
"))) )
(setq termlist(cons term termlist))
)
(GoogleSub termlist)
)

PS2 Door het gebruik van deze Lisp, heb ik al heel wat gevonden over
het verzenden van een Email met AutoCAD.
Maar door het bovenstaande probleem en ook dat ik niet werk met
MS Outlook(maar met webmail), heb ik nog niets werkend gekregen.
Op http://www.autocadforum.nl kun je zien wat ik verzameld heb.

http://www.autocadforum.nl/forum/viewtopic.php?p=2458#2458
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op di 28 06 2005, 16:03:18
tja, HofCad, ik zou het niet weten nee....
ik denk dat je daarvoor meer bij windows moet zijn...

:?:
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op di 28 06 2005, 16:13:21
Citaat van: WebRacerMet jullie hulp kwam ik reeds tot hier...
Nu zou enkel nog de mail moeten verzonden worden zonder dat de
gebruiker dit nog hoeft te doen... Als dat mogelijk is tenminste,
Maar ik Weet Dat Alles Mogelijk Is...
Door jullie zit ik al zover..

;met wat hulp van David M. Stein
;probeerde ik dit
;CdLspOlivier = de tekst die ik wil verzenden
(defun sendmail (/ Mail)
(cond
 (
  (setq mail (strcat "mailto:Olivier.Hautekeete@telenet.be"
          "?Subject=Dit is het onderwerp."
          "&body=" CdLspOlivier
         )
  )
  (setq IShell (vlax-create-object "Shell.Application.1"))
  (setq imail (vlax-invoke-method IShell "ShellExecute" mail))
  (vlax-release-object IShell)
 )
)
(princ)
)

Als ik u programma laat lopen krijg ik een error

Command: sendmail
; error: bad argument type: stringp nil


Citeer(defun c:sendmail (/ Mail)
 (cond
   (
    (setq mail   (strcat "mailto:Olivier.Hautekeete@telenet.be"
;;;"?Subject=Dit is het onderwerp."
;;;"&body=" CdLspOlivier
)
    )
(setq IShell (vlax-create-object "Shell.Application.1"))    
(setq IShell (vlax-create-object "Shell.Application"))  
    (setq imail (vlax-invoke-method IShell "ShellExecute" mail))
    (vlax-release-object IShell)
   )
 )
 (princ)
)

Dan gaat dit wel. Als ik die

;;;"?Subject=Dit is het onderwerp."
;;;"&body=" CdLspOlivier

in commentaar leg start mijn outlook wel op.

Nu nog een andere vraag.

Shell.Application.1

waarvoor dient die 1?

Zowel met de orange als de blauwe regel heb ik geen problemen.
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op di 28 06 2005, 16:32:44
Het programma van WebRacer klopte bijna. Er stond nog 1 klein foutje in.
Via animate wist ik dat de fout in het blokje setq mail lag. En dan is het maar uitproberen tot het lukt. :lol:

Citeer(defun c:sendmail (/ Mail)
 (cond
   (
    (setq mail   (strcat   "mailto:Olivier.Hautekeete@telenet.be"
         "?Subject=Dit is het onderwerp."
         "&body=CdLspOlivier"
;;;Error
;;; "&body=" CdLspOlivier
;;; de haakje stonden niet correct
      )
    )
    (setq IShell (vlax-create-object "Shell.Application.1"))
;;;     of
;;; (setq IShell (vlax-create-object "Shell.Application"))    
    (setq imail (vlax-invoke-method IShell "ShellExecute" mail))
    (vlax-release-object IShell)
   )
 )
 (princ)
)
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op di 28 06 2005, 16:35:09
Beste HofCAD

Ik zou bij God niet weten waar het verschil zou liggen.
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op di 28 06 2005, 16:38:37
kenny, bij mij werkte het... de CdLspOlivier  was waar de tekst in zat...sorry voor de verwarring
;met wat hulp van David M. Stein
;probeerde ik dit
;CdLspOlivier = de tekst die ik wil verzenden
en de Shell.Application.1 weet ik niet vanwaar de 1 komt, oplossing zo gegeven... mss te maken met welke soort mail-programma dient opgeroepen te worden?
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op di 28 06 2005, 16:45:43
Ah oké

Ik had het anders begrepen, mijn excuus daarom. Ik dacht dat ge de TEKST CdLspOlivier  wou verzenden.

u schreef:
CdLspOlivier = de tekst die ik wil verzenden.

Als we elkaar begrijpen ist in orde hé.
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op di 28 06 2005, 16:49:09
ja das duidelijk....in CdLspOlivier zit een code die opgevraagd word, vervormt word, en tenslotte naar mij moet worden gemaild...

dus de code zit in CdLspOlivier. (is voor beveiliging van Lisp-routines)

hoi even gezocht naar Shell.Application.1 en Shell.Application, beiden zijn hetzelfde, nl. Shell Automatiseringsservice voor windows (register-actie).
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op di 28 06 2005, 16:54:57
Nu mss een domme vraag maar waar vindt ge die info over Shell.Application.1  enz.
Is dat in de help van Lisp of VBA, van autocad?

MVG

Kenny
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op di 28 06 2005, 17:07:00
opgelet, alles wat met het register te maken heeft is gevaarlijk en  te toegankelijk voor onbekenden op dat gebied!!:

1 opzoeken in het register van windows,
2 opzoeken op i-net naar register applicaties - shell.application
3 boeken over windows
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op di 28 06 2005, 17:12:31
Wat is shell-toegang?
Onder shell-toegang of shell access verstaat men de mogelijkheid om op een computersysteem van op afstand commando's uit te voeren. Om dit te verwezenlijken dient men gebruik te maken van een protocol zoals Telnet of SSH en bijhorende programmatuur.

http://support.one2web.be/?0021a#0006
Titel: Email zenden vanuit Visual lisp
Bericht door: Kenny H op di 28 06 2005, 17:16:02
Bedankt voor deze uitleg.


Groeten

Kenny
Titel: Email zenden vanuit Visual lisp
Bericht door: HofCAD op di 28 06 2005, 19:31:44
Citaat van: WebRacerWat is shell-toegang?
Onder shell-toegang of shell access verstaat men de mogelijkheid om op een computersysteem van op afstand commando's uit te voeren. Om dit te verwezenlijken dient men gebruik te maken van een protocol zoals Telnet of SSH en bijhorende programmatuur.

http://support.one2web.be/?0021a#0006



Beste WebRacer en Kenny H,

Windows NT help geeft:


Shell

Specifies the name and location of an alternate command interpreter you want Windows NT to use for the MS-DOS subsystem.
shell=[[drive:]path] filename [parameters]

Parameters

[[drive:]path] filename
Specifies the location and name of the command interpreter you want Windows NT to use.
parameters
Specifies any command-line parameters or switches that can be used with the specified command interpreter.


Shell--Notes

Default setting

By default, the MS-DOS subsystem uses a special version of COMMAND.COM that works seamlessly with the other Windows NT subsystems (including piping and redirection between subsystems); the shell command is unnecessary.
Although it is not recommended, you can use the shell command to specify your own 16-bit command interpreter.

Using switches with a command interpreter

The shell command itself does not accept any switches, but if the command interpreter does, you can include them on the shell command line.



Shell--Examples

Suppose the file NEWSHELL.COM is in a directory named BIN on your startup drive, and suppose you want to use NEWSHELL.COM as your command interpreter. To do this, add the following command to your CONFIG.NT file:
shell=\bin\newshell.com


Volgens mij lijkt dat iets anders, maar is dat ook zo?


Verder geeft:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/objectmap.asp

Scriptable Shell Objects  
The Microsoft Windows Shell provides a powerful set of automation objects that enable you to program the Shell with Microsoft Visual Basic and scripting languages such as Microsoft JScript (compatible with ECMA 262 language specification) and Visual Basic Scripting Edition (VBScript). You can use these objects to access many of the Shell's features and dialog boxes. For example, you can access the file system, launch programs, and change system settings.

This section introduces the scriptable Shell objects.

Shell Versions

Many of the Shell objects became available in version 4.71 of the Shell. Others are available in version 5.00 and later. This means that on computers running Windows 95 or Microsoft Windows NT 4.0, the Shell objects are available only if the integrated desktop is installed. Version 4.71 of the Shell is on all Windows 98 computers, and version 5.00 is on all Windows 2000 computers. The following table lists each Shell object under the version of the Shell in which the object became available.


Dit kan weleens mijn probleem zijn.

Groetjes HofCAD CSI
Titel: Email zenden vanuit Visual lisp
Bericht door: WebRacer op di 28 06 2005, 21:12:00
<SCRIPT LANGUAGE="JavaScript">
<!--
 function fnGetMyPathJ()
 {      
   var oShell = new ActiveXObject("Shell.Application");
            
   var oFolder = new Object;               
   oFolder = oShell.BrowseForFolder(0, "Choose a folder", 0);
                     
   var oFolderItem = new Object;      
   oFolderItem = oFolder.Items().Item();                        
   
   document.all.item("myPath").innerText = oFolderItem.Path;
 }    
-->
</SCRIPT>

Idd HofCAD, zal er alle2 wel mee te maken hebben denk ik...
shell dient in ieder geval om een applicatie aan te spreken via script,
dat kunnen we nu wel stellen...