Leaderboard
Popular Content
Showing content with the highest reputation on 05/24/2016 in all areas
-
; ;################################## ; Include ;################################## #Include<file.au3> ;################################## ; Variables ;################################## $SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED $FromName = "Name" ; name from who the email was sent $FromAddress = "your@Email.Address.com" ; address from where the mail should come $ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED $Subject = "Userinfo" ; 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(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed $BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "******" ; username for the account used from where the mail gets sent - REQUIRED $Password = "********" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS $tls = 0 ; enables/disables TLS when required ;~ $SmtpServer = "smtp.gmail.com" ; GMAIL address for the smtp-server to use - REQUIRED ;~ $IPPort=465 ; GMAIL port used for sending the mail ;~ $ssl=1 ; GMAIL enables/disables secure socket layer sending - put to 1 if using https ;~ $SmtpServer = "smtp.office365.com" ; O365 address for the smtp-server to use - REQUIRED ;~ $IPPort=25 ; O365 port used for sending the mail ;~ $ssl=1 ; O365 enables/disables secure socket layer sending - put to 1 if using https ;~ SmtpServer = "smtp.mail.yahoo.com" ; Yahoo address for the smtp-server to use - REQUIRED ;~ $IPPort = 465 ; Yahoo port used for sending the mail ;~ $ssl = 1 ; Yahoo enables/disables secure socket layer sending - put to 1 if using https ;################################## ; Script ;################################## Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl, $tls) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf ; ; The UDF 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, $tls = 0) 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 : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $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 ; Set security params If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True If $tls Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendtls") = True ;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, 8) $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 ;==>MyErrFunc Edit: Fixed Bcc ... Edit: Added support for different port and SLL which are used by GMail (Port 465) Edit: Added Importance support (10/2008) EDIT: Added $TLS option (07/2020 Some interesting Info from the thread:1 point
-
Timerinit vs Epochtime
Patyadigg reacted to JLogan3o13 for a topic
@Patyadigg TimerInit and TimerDiff are really just a measurement of elapsed time within the script (think stop watch). When you reboot the computer, you are of course going to lose that handle unless you are writing it out somewhere to a file. Even then, it would be difficult to accurately measure the amount of time the reboot takes. If I understand you correctly (not always a given ) it sounds like _Now() or _NowTime() might be a better tool for your needs.1 point -
Detect GUI (simple question)
eKolin reacted to JLogan3o13 for a topic
@eKolin as I tell my son who is just beginning his journey into scripting - sometimes it is better to do it yourself than to have someone tell you. Mock up a script and try out the difference between 0 and 2; it should become pretty apparent to you.1 point -
Detect GUI (simple question)
eKolin reacted to JLogan3o13 for a topic
@eKolin I am guessing you are looking to use Mouse functions. Look at MouseCoordMode in the help file to set it relative to the active window. Or, you can give a better explanation of what you're trying to accomplish and we can help you get away from all the messy Mouse-work altogether1 point -
Simply put, its a game to help your mouse accuracy ect. Downloads Page Link: Link Two main modes at the moment: Classic Mode - Must hit 120 targets in 3:00. Difficulty goes up at 30 targets hit and 80 targets hit (Target gets smaller). Twitch Mode - Hit as many targets as you can without missing 6 times. Each mode can be played at 4 different difficulties. Easy Difficulty - You have 1.8seconds to hit target (Counts as a miss) Medium Difficulty - You have 1second to hit target (Counts as a miss) Hard Difficulty - You have .8seconds to hit target (Counts as a miss) Expert Difficulty - You have .6seconds to hit target (Counts as a miss) Each one has its own results screen and tracks your best results in each game. Show's Hit/Miss/Total Targets/Accuracy Images MainGUI: (Selecting a difficulty write to your settings and will default to that always) Classic Mode: Classic Mode Miss / Last "Level" (Smallest target): Classic Mode Results / Win (Loss has a red X in stead of a green checkmark): Twitch Mode Results: Records: And there we have it! Downloads: GitHub: GitHub Download Sources (You'll need images/sounds so to play the game download the .RAR from the GitHub) Source.au3 DefaultGameModule.au3 TwitchGameModule.au31 point
-
Here is a small example (from @UEZ: #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 Global $iW, $iH, $hImage, $hBitmap, $hGUI $hImage = _GDIPlus_BitmapCreateFromFile("C:\Program Files\AutoIt3\Examples\GUI\Torus.png") $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetState() _WinAPI_BitmapDisplayTransparentInGUI($hBitmap, $hGUI) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() GUIDelete() Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Edit: after some changes (upgrades) you have to insert: #include <WinAPISysWin.au3> at top of script "#include section"1 point
-
It doesn't work: I suggest: try to get the handle of FireFox window $hWin = _FFWindowGetHandle() and make it to a child of your GUI. This short example: #include<GUIConstantsEx.au3> #include<WinAPI.au3> #include<WindowsConstants.au3> #include<Constants.au3> $hGUIMain = GUICreate("Parent") $Toolbar_hoehe = 30 $Toolbar_breite= 100 $hGUITool = GUICreate("Toolbar", $Toolbar_breite ,$Toolbar_hoehe,-1,-1,$WS_SYSMENU+$WS_CAPTION,$WS_EX_TOOLWINDOW) $Toolbarfenster = WinGetPos($hGUITool) GUISetBkColor(0xaabbcc) $btnToggle = GUICtrlCreateButton("TG",1,1,28,28) GUISetState(@SW_SHOW,$hGUIMain) GUISetState(@SW_SHOW,$hGUITool) While 1 $avMsg = GUIGetMsg(1) Switch $avMsg[1] Case $hGUIMain Switch $avMsg[0] Case -3 Exit EndSwitch Case $hGUITool Switch $avMsg[0] Case $btnToggle If _WinAPI_GetParent($hGUITool) <> $hGUIMain Then ContinueCase ; wenn es kein Child-Fenster ist, dann zu einem machen $pos = WinGetPos($hGUITool) ; alte Position speichern _WinAPI_SetParent($hGUITool,0) ; Parent entfernen WinMove($hGUITool,"",$pos[0],$pos[1],$Toolbarfenster[2],$Toolbarfenster[3]) ; an alte Position schieben GUISetStyle($WS_SYSMENU+$WS_CAPTION,$WS_EX_TOOLWINDOW,$hGUITool) ; neuer Style Case -3 GUISetStyle(BitOR($WS_CHILD,$WS_BORDER),0,$hGUITool) ; den Style ändern _WinAPI_SetParent($hGUITool, $hGUIMain) ; einbetten WinMove($hGUITool,"",0,0,$Toolbar_breite,$Toolbar_hoehe) ; an 0,0 des Hauptfensters schieben _WinAPI_RedrawWindow($hGUITool) ; neu zeichenen _WinAPI_RedrawWindow($hGUIMain) ; neu zeichenen EndSwitch EndSwitch WEnd should help to explore the needed functions.1 point
-
I think you need to have 5 posts at least before you can edit your posts. I'm just playing with the Example Script right now. Hope to come up with a solution1 point
-
Yes, there is. Outlook creates events which can be grabbed by an AutoIt script. Please check the Outlook Example Scripts thread (link is in my signature) for the _OL_Example_NewMail_Event.au3 script.1 point
-
A Non-Strict JSON UDF (JSMN)
argumentum reacted to trekker for a topic
solved it: Local $Obj = Json_Decode($Json1) $myarray = (Json_Get($Obj, '["aaData"]')) $i = 0 For $element IN $myarray ConsoleWrite(Json_Get($myarray[$i], '["date"]') & @LF) ConsoleWrite(Json_Get($myarray[$i], '["status"]') & @LF) ConsoleWrite(Json_Get($myarray[$i], '["amount"]') & @LF) ConsoleWrite(Json_Get($myarray[$i], '["creditDebitType"]') & @LF) ConsoleWrite(Json_Get($myarray[$i], '["sourceDestinationDescriptor"]') & @LF) ConsoleWrite(Json_Get($myarray[$i], '["description"]') & @LF) $i = $i + 1 next1 point -
AutoIt Game: RSS Aim Training
argumentum reacted to Damein for a topic
@argumentum - Reuploaded as a ZIP. Thanks. @mLipok - Thanks and I'll add that!1 point -
1 point
-
$msg = GUIGetMsg() , hangs up ?
argumentum reacted to Jdop for a topic
Tried it on a VM with the most recent Autoit build, and it seems to work. Now I have see what the real issue is. I'm going to install the most recent version of Autoit on my production machine and see if that makes a difference.1 point -
forgive us for our rudeness. Usually when we see memory reading - 9999 out of 10,000 it is for a game. I've been here over 10 years and I can only count on one hand the number of times I've seen a reason to read memory (including yours) that is legit.1 point
-
Use $excel = _Excel_Open(False) to open Excel in the background (according to the help file )1 point
-
A Better Passwords Generator
Student_coder reacted to water for a topic
Welcome to AutoIt and the forum! Can you please post what you have tried so far? We do not spoon-feed users here, we teach them to code1 point -
I write mine by hand 95% of the time.1 point
-
EzMySql UDF - Use MySql Databases with autoit
falcontechnics reacted to Jos for a topic
Isn't that what I already said?1 point -
EzMySql UDF - Use MySql Databases with autoit
falcontechnics reacted to mLipok for a topic
@falcontechnics I think this error is not comming from code snippet which you post. This code is correct: Local $hostname Local $IP Local $rtext1 Local $time Local $sMySqlStatement = "" $sMySqlStatement &= "INSERT INTO testtable (hostname,IP,RegKey,time) VALUES (" & _ "'" & $hostname & "'," & _ "'" & $IP & "'," & _ "'" & $rtext1 & "'," & _ "'" & $time & "');" I think so because the code have & char and presented error have not.1 point -
Version 1.2.0.0 of the UDF has been released. Please test before using in production! For download please see my signature.1 point
-
Yes it is possible You can find a working example here: For more information check this page https://msdn.microsoft.com/en-us/library/ms722562(v=vs.85).aspx1 point