Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/12/2014 in all areas

  1. trancexx

    OOP or functional.

    AutoItObject is great way to learn some OOP basics from AutoIt. Memory usage shouldn't worry you, there wouldn't be differences. I never said this, but AutoItObject relies on one particular reference counting bug in AutoIt. When it would be fixed AutoItObject will stop working unless rewritten. But you also shouldn't worry much about that either, it probably will never be fixed .
    2 points
  2. ; ;################################## ; 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
  3. mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples
    1 point
  4. Update 2/2/12: v2.0.7 Fix _RegRead returns string data for _RegExport. Update 1/30/12: v2.0.6 - SCRIPT BREAKING Change _RegRead treatment of REG_MULTI_SZ data. Data is returned in a comparable format to AutoIt's native RegRead function: CRLF delimited substrings. (AutoIt's RegRead actually returns LF delimited substrings.) Update 1/29/12: v2.0.5 Added more supported formats to the Export function and fixed infinite loop errors. REG_LINK remains unsupported. v2.0.4 Fixed some REG_MULTI_SZ issues in Write/Copy/Move functions. Re-read the _RegWrite header notes for the pertinent information. Thanks again step887 for reporting. Update 1/28/12: v2.0.3 Do not use RegDeleteKeyEx on 32-bit OS's, it is not needed (and does not exist on XP 32-bit and lower, or lower than Server 2003 SP1). Thanks step887 for reporting the error! Update 12/2/10: v2.0.2 Fixed wrong @error return from _RegRead which would cause _RegValueExists to incorrectly return Success. Update 5/25/10: Ok, huge overhaul. Added: - Function documentation! - Improved _RegRead and _RegWrite to better handle data. Specifically, REG_MULTI_SZ data types are correctly read / exported if the data was incorrectly written to the registry by another application. And the data is correctly written even if it was supplied to the function with incorrect termination. Because of the unusual format of this data type, it is returned from _RegRead as binary data. - _RegRead / _RegWrite support all known registry value data types (in at a least a limited way). For uncommon types, the values are read / written as binary data. - Better error checking and reporting, especially before any delete operations. - x64 Platform: Support for directly reading the 32-bit and 64-bit registry views from both 32-bit and 64-bit scripts. - All operations are now done via custom registry functions. I didn't want to go all the way, but AutoIt doesn't support a root key like HKLM32 to force reading the 32-bit registry on the x64 platform from a native 64-bit script. Once I decided to introduce that capability in some of the higher level functions, I had to rewrite all the low level functions as well. - _RegExport function to recursively export a key or a single value to a MS compatible REG file. - Other undocumented helper functions that could be pilfered for nefarious usage. There might be some more minor things that I've forgotten. I've tested this pretty well, but please report any bugs or problems. Update 4/16/2010: Added the latest version of this UDF. It includes some custom _RegWrite / _RegRead functions as well. The _RegWrite function allows you to set the REG_OPTION_VOLATILE flag on a registry key. Example at the bottom. I needed this for a script, and didn't necessarily like big_daddy's solution. Here's a recursive registry copy/move function. I tested it and it seems to work perfectly (knock on wood). It could probably use some more error catching, so suggestions are welcome. _RegFunc.au3
    1 point
  5. I just tested this in one of my listviews and all the items were updated: _GUICtrlListView_AddItem($sBlistView, $FileList_A[$i] & @LF) GUICtrlSetFont($sBlistView, 12, 600) Is that what you wanted? or do yow want a dynamic size change after LV is populated that works like CTRL + in a browser? Bill edit: spelling
    1 point
  6. GeekIT, Do you mean that you want to delete this thread? If so, then you cannot - and I will not because it should be left as a record of how NOT to ask for help here. But if you mean that you want to be deleted from this forum - I would be happy to oblige! M23
    1 point
  7. If I understand your requirements correctly Mandar's hotStrings function will do what you want. It works similar to Hotkeys except that the trigger is a whole word not just a single key or key combination.
    1 point
  8. 1 point
  9. Ctrl+Alt+H on the function line and voila.
    1 point
×
×
  • Create New...