Post by GamerG1rl » 12 Oct 2018, 06:51
nnnik wrote:Kannst du mal posten wie einer deiner Versuche aussieht die Variablen im GUI darzustellen.
Am Anfang arbeiten die meisten mit Command Syntax - vielen scheint das einfacher zu fallen.
Jedoch brauchst du für ungefähr 90% von AHK Expressions Syntax - und in den restlichen 10% kannst du diese auch noch aktivieren.
Und da man dann früher oder später aus der Übung kommt was Commands angeht verwendet der Hauptteil der Fortgeschrittenen AHK Benutzer die Expressions Syntax.
Ich würde es halt so machen:
Code: Select all
FileSelectFile, MyFiles, M3, %A_MyDocuments%, Select File
Gui, 7:Add, Edit, x12 y19 w180 h30 vToAdress, Email
Gui, 7:Add, Edit, x12 y69 w180 h30 vMessageSubject, Betreff
Gui, 7:Add, Edit, x12 y119 w180 h60 vMessageBody, Text
Gui, 7:Add, Button, x12 y189 w100 h30 gsenden, Senden
Gui, 7:Add, Button, x122 y189 w100 h30 g7GuiClose, Abbrechen
Gui, 7:Show, x291 y248 h231 w249, New GUI Window
Return
7GuiClose:
ExitApp
senden:
Gui, 7:Submit
SendMail(ToAddress, MessageSubject, MessageBody, AttachmentPath="") {
ol := ComObjCreate("Outlook.Application")
ns := ol.getNamespace("MAPI")
ns.logon("","",true,false) ;get default MAPI profile
newMail := ol.CreateItem(0) ;0 is Outlook constant 'olMailItem' (thanks Sinkfaze)
newMail.Subject := MessageSubject
newMail.Body := MessageBody
If StrLen (AttachmentPath)
{
MessageAttach := newMail.Attachments
Loop, Parse, AttachmentPath, `n, %A_Space%%A_Tab%
{
If A_Index = 1
Root := A_LoopField
Else
MessageAttach.Add(Root . "\" . A_LoopField)
}
}
; validate the recipient, just in case...
myRecipient := ns.CreateRecipient(ToAddress)
myRecipient.Resolve
If Not myRecipient.Resolved
MsgBox, unknown recipient
Else
{
newMail.Recipients.Add(myRecipient)
;newMail.Sender := FromAddress ;this would be the from field but does not work yet
newMail.Display
}
}
Wie gesagt: Bin jetzt nicht brutale Anfängerin, aber halt echt noch Basics...
Verstehe nicht unbedingt so alles, was in der Mailing-Funktion steht... :/
[quote="nnnik"]Kannst du mal posten wie einer deiner Versuche aussieht die Variablen im GUI darzustellen.
Am Anfang arbeiten die meisten mit Command Syntax - vielen scheint das einfacher zu fallen.
Jedoch brauchst du für ungefähr 90% von AHK Expressions Syntax - und in den restlichen 10% kannst du diese auch noch aktivieren.
Und da man dann früher oder später aus der Übung kommt was Commands angeht verwendet der Hauptteil der Fortgeschrittenen AHK Benutzer die Expressions Syntax.[/quote]
Ich würde es halt so machen:
[code]
FileSelectFile, MyFiles, M3, %A_MyDocuments%, Select File
Gui, 7:Add, Edit, x12 y19 w180 h30 vToAdress, Email
Gui, 7:Add, Edit, x12 y69 w180 h30 vMessageSubject, Betreff
Gui, 7:Add, Edit, x12 y119 w180 h60 vMessageBody, Text
Gui, 7:Add, Button, x12 y189 w100 h30 gsenden, Senden
Gui, 7:Add, Button, x122 y189 w100 h30 g7GuiClose, Abbrechen
Gui, 7:Show, x291 y248 h231 w249, New GUI Window
Return
7GuiClose:
ExitApp
senden:
Gui, 7:Submit
SendMail(ToAddress, MessageSubject, MessageBody, AttachmentPath="") {
ol := ComObjCreate("Outlook.Application")
ns := ol.getNamespace("MAPI")
ns.logon("","",true,false) ;get default MAPI profile
newMail := ol.CreateItem(0) ;0 is Outlook constant 'olMailItem' (thanks Sinkfaze)
newMail.Subject := MessageSubject
newMail.Body := MessageBody
If StrLen (AttachmentPath)
{
MessageAttach := newMail.Attachments
Loop, Parse, AttachmentPath, `n, %A_Space%%A_Tab%
{
If A_Index = 1
Root := A_LoopField
Else
MessageAttach.Add(Root . "\" . A_LoopField)
}
}
; validate the recipient, just in case...
myRecipient := ns.CreateRecipient(ToAddress)
myRecipient.Resolve
If Not myRecipient.Resolved
MsgBox, unknown recipient
Else
{
newMail.Recipients.Add(myRecipient)
;newMail.Sender := FromAddress ;this would be the from field but does not work yet
newMail.Display
}
}
[/code]
Wie gesagt: Bin jetzt nicht brutale Anfängerin, aber halt echt noch Basics...
Verstehe nicht unbedingt so alles, was in der Mailing-Funktion steht... :/