Jump to content

Kkweit

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by Kkweit

  1. Hi, I'm sorry but your script don't works ! When i run it I got an error message with the code 53 Is there anybody who knows what it means ? I'm writing a script and i need to send an email through a smtp server with authentification I tried your script with no change but my credential and it don't works ! Heard something about a function for internal usage if it's the problem is there a way to make it works for all usage ?
  2. Updated version of Smtp ? Could you be more specific because i don't know what you mean !
  3. @mickeytown2: I'm using your script and i did add somethings to do what i need to and... it's working ! but i got the following error message: Line 195 (file "...\_INetSmtpMail.Au3"): _Smtpsend($v_Socket, $as_End[$i_Count], $f_trace) _SmtpSend($v_Socket, ^ ERROR Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. here is the _INetSmtpMail-example.Au3 where did the modification #include "_INetSmtpMail.Au3" #include <Constants.au3> #include "_Base64.Au3" Opt("TrayIconDebug", 1) ;EXAMPLE CODE $yyyymd = @MDAY & "/" & @MON & "/" & @YEAR $PingPasserelle = Ping(GetLanGW(), 1200) $PingGoogle = Ping("www.google.fr", 1200) If ($PingPasserelle > 0) Then $pingmsg = "OK" Else $pingmsg = "Echec" EndIf If ($PingGoogle > 0) Then $pingmsg2 = "OK" Else $pingmsg2 = "Echec" EndIf ;FILL THIS IN START $s_FromName = "Netoptima Diagnostic" $s_FromAddress = "diag@netoptima.fr" $s_ToAddress = "support@netoptima.fr" $s_Subject = "My Diag Test" Dim $as_Body[6] $as_Body[0] = "Date : " & $yyyymd & @CRLF $as_Body[1] = "Adresse IP de la machine : " & @IPAddress1 & @CRLF $as_Body[2] = "Adresse IP de la passerelle : " & GetLanGW() & @CRLF $as_Body[3] = "Adresse IP du serveur DNS : " & GetLanDNS() & @CRLF $as_Body[4] = "Resultat du ping de la passerelle (si different de 0 = OK) : " & $pingmsg & @CRLF $as_Body[5] = "Resultat du ping de googgle.fr (si different de 0 = OK) : " & $pingmsg2 & @CRLF $s_Subject = "Rapport diagnotic de la machine de " & @UserName & " a " & @ComputerName ;FILL THIS IN END $b_trace = True ;false no trace window, true trace window displayed $s_helo = @ComputerName ;sometimes WAN IP, localhost or 127.0.0.1 $s_first = "" ;@CRLF ;this is pointless with my UDF, since it will automaticly do it, if need be $s_UserName = "diag@netoptima.fr" ;just declearing it, no need to fill in $s_Password = "75diag95" ;just declearing it, no need to fill in $temp = StringSplit($s_FromAddress, "@") MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine", _ "Date : " & $yyyymd & @CRLF & _ "Adresse IP de la machine : " & @IPAddress1 & @CRLF & _ "Adresse IP de la passerelle : " & GetLanGW() & @CRLF & _ "Adresse IP du serveur DNS : " & GetLanDNS() & @CRLF & _ "Resultat du ping de la passerelle : " & $pingmsg & @CRLF & _ "Resultat du ping de google.fr : " & $pingmsg2 & @CRLF & _ "Cliquez sur Ok pour valider ce rapport" & @CRLF) If MsgBox(4, "SMTP", "Souaitez envoyez ce rapport, par mail, a votre administrateur reseau ?" & @CRLF & "Click no to send from your computer directly to the mx server (may not work!)") = 6 Then $s_Server = "smtp.netoptima.fr" $s_UserName = _Base64Encode ("diag@netoptima.fr") If $s_UserName Then $s_Password = _Base64Encode ("75diag95") EndIf Else $s_Server = "" ;domain lookup $IP = _INetGetSource ("http://dynupdate.no-ip.com/ip.php") If @error Or $IP = "" Then $IP = "127.0.0.1" EndIf $RunPID = Run(@ComSpec & " /c nslookup " & $IP, "", @SW_HIDE, $STDOUT_CHILD) $name = StringSplit(StdoutRead($RunPID), "Name:", 1) If $name[0] > 1 Then $name = StringSplit($name[2], "Address:", 1) $name = StringStripWS($name[1], 8) Else $name = "No Internet Connection" EndIf $domain = StringSplit($name, ".") If $domain[0] > 1 Then $domain = $domain[$domain[0] - 1] & "." & $domain[$domain[0]] Else $domain = $domain[$domain[0]] EndIf If $domain <> $temp[$temp[0]] Then If MsgBox(4, "MX Servers", "Some MX servers will not accept emails if they don't come from your domain" & @CRLF _ & "Would you like to change this " & @CRLF & $s_FromAddress & " to this " & @CRLF & $temp[1] & "@" & $domain) = 6 Then $s_FromAddress = $temp[1] & "@" & $domain EndIf EndIf EndIf ;call udf If _INetSmtpMail ($s_FromName, $s_FromAddress, $s_ToAddress, $s_Server, $s_Subject, $as_Body, $s_helo, $s_UserName, $s_Password, $b_trace) <> 1 Then MsgBox(0, "Error!", "Mail failed with error code " & @error) Else MsgBox(0, "Success!", "Rapport envoye ! Cliquez sur OK pour lancer l'outil de prise en main a distance") EndIf $csn = Run("C:\Program Files\TeamViewer\Version4\TeamViewer.exe") Func GetLanGW() Local $colItems = "" Local $strComputer = "localhost" Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems If (StringLen($objItem.IPAddress(0)) > 3) And (StringLen($objItem.DefaultIPGateway(0)) > 3) Then If @IPAddress1 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress2 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress3 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress4 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) EndIf Next Else Return @IPAddress1 ; if you dont have Gateway EndIf EndFunc ;==>GetLanGW Func GetLanDNS() Local $colItems = "" Local $strComputer = "localhost" Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems If (StringLen($objItem.IPAddress(0)) > 3) And (StringLen($objItem.DNSServerSearchOrder(0)) > 3) Then If @IPAddress1 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress2 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress3 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress4 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) EndIf Next Else Return @IPAddress1 ; if you dont have DNS EndIf EndFunc ;==>GetLanDNS ;=============================================================================== ; ; Function Name: _INetGetSource() ; Description: Gets the source from an URL without writing a temp file. ; Parameter(s): $s_URL = The URL of the site. ; Requirement(s): DllCall/Struct & WinInet.dll ; Return Value(s): On Success - Returns the source code. ; On Failure - 0 and sets @ERROR = 1 ; Author(s): Wouter van Kesteren. ; ;=============================================================================== Func _INetGetSource($s_URL, $s_Header = '') If StringLeft($s_URL, 7) <> 'http://' And StringLeft($s_URL, 8) <> 'https://' Then $s_URL = 'http://' & $s_URL Local $h_DLL = DllOpen("wininet.dll") Local $ai_IRF, $s_Buf = '' Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0) If @error Or $ai_IO[0] = 0 Then DllClose($h_DLL) SetError(1) Return "" EndIf Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0) If @error Or $ai_IOU[0] = 0 Then DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0]) DllClose($h_DLL) SetError(1) Return "" EndIf Local $v_Struct = DllStructCreate('udword') DllStructSetData($v_Struct, 1, 1) While DllStructGetData($v_Struct, 1) <> 0 $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct)) $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1)) WEnd DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0]) DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0]) DllClose($h_DLL) Return $s_Buf EndFunc ;==>_INetGetSource I guess there is no need to say that i'm a newbie with AutoIT Any help or guidance would be appreciate. Thanks
  4. You're right ! I guess there is no need to tell that i'm a newbie with AutoIt ! Thanks
  5. I add those lines to your script $aIPs = _GetAllIps(DllStructGetPtr($adapter, "IpAddressListNext")) MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine", & $aIPs) and i get the following message: Error:Variable used without being declared. This message is for the first one !( of the two lines)
  6. Hi, I got a error message when i run this script: $csn = Run("C:\Program Files\TeamViewer\Version4\TeamViewer.exe") ShellExecute ($csn) The message is displaying in french maybe because of my computer (I'm french). Here is the message: Windows ne trouve pas '5168'. Vérifiez que vous avez entré le nom correct, puis réessayez. you can translate it in english by something like this: Windows can't find '5168'. Please check that you entered the right name, then try again. And everytime i run the script I got a different number displaying in the error message. When i run this script i got my program srunning as i want but affraid if it there is a problem i would like to know about it before leaving the test environment. any help or guidance would be appreciate. thanks
  7. Thanks for your help. I'm sorry to say that but I'm real newbie with AutoIt and I don't know what part extract from your code to got it works !
  8. Hi, Sorry to bother you with something which might seems to be so simple but i can't find a way to display de subnet mask of a computer. I tried different thing but none of them worked. Is there somebody who can help me ?
  9. It seems that I didn't include a file in my script ! I don't know if it's the source of my problem and I even don't know what is the name of the file that i have to include if i have to. Is there anybody who got an idea ? Any help or guidance would be appreciate. thanks
  10. Sorry, it's not IP Address it's Subnet Mask like this: MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine", & ipconfig($lookfor = "Subnet Mask")) But still ! I got this message: Error: Variable used without being declared. and still ! i didn't found out how got it work ! If somebody could help me that would be great !
  11. Hi, I would like show the subnet mask of my computer and i tried to use your script but i can't have it works. Here is what i tried ipconfig() ;~ -------------------------------------------------------------------------------- #cs Possible things to have returned Host Name Primary Dns Suffix Node Type IP Routing Enabled WINS Proxy Enabled DNS Suffix Search List Media State Description Physical Address Connection-specific DNS Suffix Description Physical Address Dhcp Enabled Autoconfiguration Enabled IP Address Subnet Mask Default Gateway DHCP Server DNS Servers Lease Obtained Lease Expires #ce ;~ -------------------------------------------------------------------------------- Func ipconfig($lookfor = "IP Address") $cmd = Run(@Comspec & " /c ipconfig /all", "" , @SW_HIDE, 2+4) $Result = "" While 1 $line = StdoutRead($cmd) If @error Then Return "Error" if StringInStr($line,$lookfor) then ExitLoop WEnd $Data = StringSplit(StringStripWS($line,7),$lookfor,1) $Data = StringSplit($Data[2],":",1) $Data = StringStripWS($Data[2],7) ConsoleWrite (@CR & $lookfor & "=" &$Data) Return $Data EndFunc MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine", & $Data) I also tried this ipconfig() ;~ -------------------------------------------------------------------------------- #cs Possible things to have returned Host Name Primary Dns Suffix Node Type IP Routing Enabled WINS Proxy Enabled DNS Suffix Search List Media State Description Physical Address Connection-specific DNS Suffix Description Physical Address Dhcp Enabled Autoconfiguration Enabled IP Address Subnet Mask Default Gateway DHCP Server DNS Servers Lease Obtained Lease Expires #ce ;~ -------------------------------------------------------------------------------- Func ipconfig($lookfor = "IP Address") $cmd = Run(@Comspec & " /c ipconfig /all", "" , @SW_HIDE, 2+4) $Result = "" While 1 $line = StdoutRead($cmd) If @error Then Return "Error" if StringInStr($line,$lookfor) then ExitLoop WEnd $Data = StringSplit(StringStripWS($line,7),$lookfor,1) $Data = StringSplit($Data[2],":",1) $Data = StringStripWS($Data[2],7) ConsoleWrite (@CR & $lookfor & "=" &$Data) Return $Data EndFunc MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine", & ipconfig($lookfor = "IP Address")) (You noticed that i only add one line at the end of the script) But in both case i get this error message: Error: Variable used without being declared. And it's for the line 41, the one with the MsgBox command. Any guidance or help would be appreciate. Thanks
  12. Ok. Next time i will do it right. I just got my problem solved by myself so the point of this topic is useless. Just in case here is my script. (It sends some computer information's by email)
  13. Hi everybody, No need to tell that i'm a newbie with AutoIt. I couldn't find a solution to my problem sorry if somebody already answered something like this but idon't think so. Context: The following script is working (i got error message but it's working) $yyyymd = @MDAY & "/" & @MON & "/" & @YEAR $ping = Ping("192.168.80.1", 1200) $ping2 = Ping("www.google.fr", 1200) $File = "C:\Program Files\TeamViewer\Version4\TeamViewer.exe" MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine", _ "Date : " & $yyyymd & @CRLF & _ "Adresse IP de la machine : " & @IPAddress1 & @CRLF & _ "Adresse IP de la passerelle : " & GetLanGW() & @CRLF & _ "Adresse IP du serveur DNS : " & GetLanDNS() & @CRLF & _ "Resultat du ping de la passerelle (si different de 0 = OK) : " & $ping & " ms" & @CRLF & _ "Resultat du ping de google.fr (si different de 0 = OK) : " & $ping2 & " ms" & @CRLF & _ "Cliquez sur Ok pour valider ce rapport et lancer l'outil de prise en main a distance" & @CRLF) $csn = Run("C:\Program Files\TeamViewer\Version4\TeamViewer.exe") ShellExecute ($csn) $url = "http://support.netoptima.fr/" ShellExecute ($url) Func GetLanGW() Local $colItems = "" Local $strComputer = "localhost" Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems If (StringLen($objItem.IPAddress(0)) > 3) And (StringLen($objItem.DefaultIPGateway(0)) > 3) Then If @IPAddress1 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress2 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress3 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress4 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) EndIf Next Else Return @IPAddress1 ; if you dont have Gateway EndIf EndFunc ;==>GetLanGW Func GetLanDNS() Local $colItems = "" Local $strComputer = "localhost" Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems If (StringLen($objItem.IPAddress(0)) > 3) And (StringLen($objItem.DNSServerSearchOrder(0)) > 3) Then If @IPAddress1 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress2 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress3 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress4 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) EndIf Next Else Return @IPAddress1 ; if you dont have DNS EndIf EndFunc ;==>GetLanDNS Here is my problem I would like to extract the informations from my script and send them by email here is the second (no need to say that it doesn't works) $s_SmtpServer = "mail.netoptima.fr" ; to be completed $s_FromName = "Kapi l'international" ; to be completed $s_FromAddress = "Kapi-linternational@intechinfo.fr" ; to be completed $s_ToAddress = "a-k_93@hotmail.fr"; yours Dim $t_Body[1] $t_Body[0] = "'Resultat du test permettant d'etablir un diagnostic de votre machine:', & @CRLF & _ 'Date : ' & $yyyymd & @CRLF & _ 'Adresse IP de la machine : ' & @IPAddress1 & @CRLF & _ 'Adresse IP de la passerelle : ' & GetLanGW() & @CRLF & _ 'Adresse IP du serveur DNS : ' & GetLanDNS() & @CRLF & _ 'Resultat du ping de la passerelle (si different de 0 = OK) : ' & $ping & ' ms' & @CRLF & _ 'Cliquez sur Ok pour valider ce rapport et ouvrir une fenetre vers l outil de prise en main' & @CRLF" $s_Subject = "Presentation du nouveau directeur de l'ecole" if _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $t_Body) Then msgbox(0,"OK","no error") Else msgbox(0,"error",@ERROR) EndIf Is there anybody who can help me ?
  14. it works ! Thank you !
  15. Hi, I'm trying to do a script which give a statement of the machine. I guess there is no need to tell that i am a novice with AutoIt. the information that i want to display are: - The Date of the day - The Ip adress of the machine - The Dns, the gateway - the result of a ping and some other stuff that will have in mind when i'll succeed in doing those things Here is what i wrote: $yyyymd = @MDAY & "/" & @MON & "/" & @YEAR $ping = Ping("google.com", 1200) MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine" & @CRLF & _, "Date : ", $yyyymd & @CRLF & _, "Adresse IP de la machine : " & @IPAddress1 & @CRLF & _, "Resultat du ping : ", $ping & @CRLF & _) here is the error message that i get: error: Missing separator charater after keyword and it's for the line openning the "MsgBox" Is there anybody who can help me ?
×
×
  • Create New...