Habs korrigiert. Vielleicht hat jemand ja einen besseren SMTP Mailer, mit dem es funktioniert.
Beiträge von Helveticus
-
-
Das funktioniert nicht. Das Skript wird dann zwar mit Administratorrechten ausgeführt, ich muss es aber im Administratoraccount ausführen.
-
Hallo
Ich habe folgendes Problem. Ich möchte eine reg-Datei eintragen. Dazu rufe ich eine xxx.cmd auf und diese übernimmt dann alles. Das Problem ist, dass das Programm im Administratoraccount ausgeführt werden muss. Wenn ich sie im Benutzeraccount ausführe funktioniert es zwar, aber die Werte werden nicht richtig gesetzt bzw. an der falschen Stelle, auch wenn ich sie mit Administratorrechten im Benutzeraccount ausführe.
Seht ihr da eine Lösung?
Das Einzige was ich sehe, ist dass ich in den Administratoraccount wechsle, aber wie mache ich das mit AutoIt?
-
Im Anhang noch die 2 Files. Vielleicht kann es ja jemand testen.
-
Vielen Dank.
Ich habe die Windows-Firewall ausgeschaltet und es funktioniert immer noch nicht. Komischerweise funktioniert es auf einem anderen PC prima, dort habe ich die Kaspersky Firewall drauf und der wollte es blockieren, habe es aber erlaubt und dann hat es geklappt. Aber beim anderen PC habe ich ja auch die Windowos-Firewall deaktiviert.
EDIT: Auf dem PC funktionieren Meldungen per SMTP von Avast und Acronis True Image super, bekomme eine E-Mail. Nur bei der Exe von AutoIt funktioniert es nicht.
EDIT2: Ich habe die Exe jetzt auch noch auf einer virtual machine ausprobiert, auf dem ein sauberes originales XP Prof installiert ist und dort funktioniert es auch nicht, es muss also an AutoIt liegen. Auf dem PC, auf dem es funktioniert, ist AutoIt installiert, auf den anderen PCs nicht. Kann es daran liegen?
ZitatUnd was ich dir noch empfehlen möchte: Über dem Editor ist ein Button mit der Aufschrift SP und mit dem AutoIt logo. EInfach mal deinen Quelltext Makieren, dann einmal den AutoIt button drücken, danach einmal den SPButton drücken
Wo finde ich diese Buttons?
-
Wie meinst du via Dateianhang?
Das Test.au3 ist das eigentliche Skript, halt ein Testscript.
-
Hier das Skript
Zuerst die SMTP Mailer.au3
Spoiler anzeigen
[autoit]#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.3.4.0
[/autoit] [autoit][/autoit] [autoit]
Author: Jos (http://www.autoitscript.com/forum/index.php?showtopic=23860)
Version: 1.0.0
Date: 24.02.2010Script Function:
[/autoit] [autoit][/autoit] [autoit]
Template AutoIt script.#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]#include-once
[/autoit] [autoit][/autoit] [autoit]
#Include<file.au3>Global $oMyRet[2]
[/autoit] [autoit][/autoit] [autoit]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
[/autoit]
Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
If FileExists($S_Files2Attach[$x]) Then
$objEmail.AddAttachment ($S_Files2Attach[$x])
Else
ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
SetError(1)
Return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
If Number($IPPort) = 0 then $IPPort = 25
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
If $ssl Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Set Email Importance
Switch $s_Importance
Case "High"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
Case "Normal"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
Case "Low"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
EndSwitch
$objEmail.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet[1]
EndIf
$objEmail=""
EndFunc ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number,
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>MyErrFuncUnd jetzt mein Skript Test.au3
Spoiler anzeigen
[autoit]#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.3.4.0
[/autoit] [autoit][/autoit] [autoit]
Author: xxx
Version: 1.0.1
Date: 24.02.2010Script Function:
[/autoit] [autoit][/autoit] [autoit]
Template AutoIt script.#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]#include "C:\Programmieren\AutoIt\SMTP Mailer.au3"
[/autoit] [autoit][/autoit] [autoit]BlockInput(1)
[/autoit] [autoit][/autoit] [autoit]$SmtpServer = "asmtp.mail.xxx.ch" ; address for the smtp-server to use - REQUIRED
[/autoit] [autoit][/autoit] [autoit]
$FromName = "xxx" ; name from who the email was sent
$FromAddress = "xxx@xxx.net" ; address from where the mail should come
$ToAddress = "xxx@xxx.net" ; destination address of the email - REQUIRED
$Subject = "Test" ; subject from the email - can be anything you want it to be
$Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = "" ; the file you want to attach- leave blank if not needed
$CcAddress = "" ; address for cc - leave blank if not needed
$BccAddress = "" ; address for bcc - leave blank if not needed
$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
$Username = "xxx@xxx.net" ; username for the account used from where the mail gets sent - REQUIRED
$Password = "xxx" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 25 ; port used for sending the mail
$ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465 ; GMAIL port used for sending the mail
;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS$Body = "Test"
[/autoit] [autoit][/autoit] [autoit]
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)BlockInput(0)
[/autoit] [autoit][/autoit] [autoit]Exit
[/autoit] -
Anscheinend nicht. Also wenn ich in Scite auf Run klicke, dann funktioniert es. Wenn das Skript aber compiliert wird, funktioniert es nicht.
-
Warum funktionierts dann nicht?
-
Hallo
Ich habe ein Skritp geschrieben in welchem u.a. auch eine E-Mail versandt wird und zwar mit folgender Zeile
$Body = "This is a test"
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)Die Parameter wurden vorher alle richtig definiert. Am Anfang des Skripts habe ich auch #include "C:\Programmieren\AutoIt\SMTP Mailer.au3".
Wenn ich das Skript nun mit Run ausführe dann funktioniert alles wunderbar. Wenn ich das Skript aber mit Compile in eine exe umwandle dann funktioniert alles ausser die E-Mail wird nicht verschickt.
Warum? Muss ich die SMTP Mailer.au3 auch noch compilieren?
-
Es scheint doch nicht zu funktionieren. Kann jemand helfen?
-
Habs rausgefunden. Einfach "C:\Programme\K10Stat v0.91\K10STAT.exe -loadprofile:1 -nowindow".
-
Hallo
Ich wurde gerne RunAs mit Parameter ausführen, also dem Programm sollen noch Parameter übergeben werden. Konkret ist es folgender Pfad:
C:\Programme\K10Stat v0.91\K10STAT.exe -loadprofile:1 -nowindow
Wie geht das?
-
Ich danke dir.
-
Hallo
Wenn ich eine neue Version von Scite und AutoIt installieren möchte, muss ich dann die alten Versionen deinstallieren oder kann ich die neuen Version einfach drüber installieren?
-
Dann halt
if (@hour > 14) or (@hour = 13 and @min >= 15) then..
-
if (@hour > 13) or (@hour = 13 and @min >= 15) then..
Das ist jetzt also doch falsch?
-
-
Ich meinte ein Programm beenden und nicht das Skript.

Ich werde es mit WinClose machen.
Muss ich für @Hour und @Min noch irgendwas includen?
-
Habe doch noch eine kleine Frage. Muss ich um @Hour und @Min benutzen zu können etwas includen?
Und wie kann man ein Programm korrekt beenden? Also ohne controlclick. Starten kann man ja mit Run oder RunAs, aber zum beenden habe ich nichts gefunden ausser den Prozess zu killen, aber das ist ja dann nicht sehr sauber.