Leaderboard
Popular Content
Showing content with the highest reputation on 02/11/2019 in all areas
-
LAST VERSION - 1.0 07-Mar-10 This is my very simple and small UDF. Allows you to restart the script from any location with full restoration of the original command line parameters. I use this library in several of my programs, and I was not disappointed. I hope this UDF will be useful for many as for me. I will be glad to any feedback and suggestions. Restart UDF Library v1.0 Previous downloads: 943 Restart.au3 Example #NoTrayIcon #Include <Misc.au3> #Include <Restart.au3> _Singleton('MyProgram') If MsgBox(36, 'Restarting...', 'Press OK to restart this script.') = 6 Then _ScriptRestart() EndIf1 point
-
; ;################################## ; 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
-
Make Autoit to sent certain documents through Whatsapp
danish_draj reacted to alienclone for a topic
also, for better search results... https://www.google.com/advanced_search?q=site:http://www.autoitscript.com&safe=off&pws=0&hl=en1 point -
Have you checked to see the the site uses frames?1 point
-
There will be a major update in a week or two mainly about sample code creation. After that more advanced topics as you are facing will be treated. Hopefully within a month or so. Regards Lars.1 point
-
@Imranimi here an example of how to create a new tab : #include <IE.au3> Opt ("MustDeclareVars", 1) Global Const $ie_new_in_tab = 0x0800 Local $oIE1 = _IECreate ("www.autoitscript.com/forum") Local $oInputs = _IETagNameGetCollection($oIE1, "a") For $oInput In $oInputs if $oInput.innerText = "AutoIt Help and Support" then ; it can be title or some other reference... Local $oIELink = $oInput ExitLoop endif Next MsgBox($MB_SYSTEMMODAL, "Tag A", $oIELink.href) Local $oIE2 = _IECreateTab ($oIE1, $oIELink.href) Func _IECreateTab (ByRef $oIE, $url) Local $Count = 0, $oIE2 $oIE.Navigate ($url, $ie_new_in_tab) While 1 $oIE2 = _IEAttach($url, "url") If IsObj($oIE2) Then ExitLoop $Count += 1 if $Count > 100 then Exit MsgBox (0,"Error","Load expired") Sleep (50) WEND _IELoadWait ($oIE2, 300) return $oIE2 EndFunc1 point
-
1 point
-
Create own library [solved]
GoogleGonnaSaveUs reacted to Melba23 for a topic
Levignot, What you are looking for is a personal include folder. AutoIt looks for #include files in 3 places: - 1. C:\Program Files\AutoIt3\Include (if you have a standard installation). - 2. A user-defined folder (which is what you want). - 3. The script folder. So how do you tell Autoit where the user-defined folder is? Two ways to do it: - 1. If you run the full SciTE4AutoIt3 package, you can use "SciTE Config" from the <Tools> menu to set the folder. (If you do not have the full package, then I recommend that you download it from here and install it. You get a load of goodies to help you code in AutoIt. ) - 2. Or you can edit the registry directly. As it says in the Help file: There is a special registry value that can be created at "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" called "Include". It should be a REG_SZ (string) value. The contents of this value are a semi-colon delimited list of directories that should be searched for files when resolving #include's in addition to the standard locations. Once you have defined the user-defined folder, you will need to save files containing the functions that you want in that folder. Then when you need a function, you can simply #include the relevant file. I hope that is all clear - ask if not. M23 Avec un nom pareil je presume que tu es francophone. Envoie-moi un PM en francais si tu ne comprends pas. Trans: With that forum name I assume you speak French. Send me a PM in French if you do not understand.1 point -
That's massive! ... I said that I did some other calls with "idispatch" , check this: #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("WinWaitDelay", 0) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $oMyError = ObjEvent("AutoIt.Error", "_ErrFunc") Global $hOLEACC = DllOpen("oleacc.dll") ; Make a GUI Global $hGui = GUICreate("ActiveX", 800, 500) ; Create object Global $oIEObject = ObjCreate("Shell.Explorer.2") ; Check if it's created If Not IsObj($oIEObject) Then MsgBox(262144 + 48, "Error!", "Could not create object. That's bad!") Exit EndIf ; Create ActiveY control Global $hActiveX = GUICtrlCreateObj($oIEObject, 0, 0, 800, 400) ; Hide it for now GUICtrlSetState($hActiveX, $GUI_HIDE) ; Some page Global $sURL = "www.yahoo.com" ; Navigate to that page $oIEObject.navigate($sURL) ; Exit function GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") ; Wait cursor GUISetCursor(15) ; Show GUI GUISetState() ; Get that handle Global $hObjWinHandle = _GetObjectWinHandle($oIEObject) ; Write it ConsoleWrite("! $oIEObject win handle: " & $hObjWinHandle & @CRLF) ; New function Global $oAccessibleObject = _AccessibleObjectFromWindow($hObjWinHandle) ; Gained: If IsObj($oAccessibleObject) Then ; ConsoleWrite("accChild: " & $oAccessibleObject.accChild($Param) & @CRLF) ;<- ConsoleWrite("accChildCount: " & $oAccessibleObject.accChildCount & @CRLF) ConsoleWrite("accDefaultAction: " & $oAccessibleObject.accDefaultAction & @CRLF) ConsoleWrite("accDescription: " & $oAccessibleObject.accDescription & @CRLF) ConsoleWrite("accFocus: " & $oAccessibleObject.accFocus & @CRLF) ConsoleWrite("accHelp: " & $oAccessibleObject.accHelp & @CRLF) ; ConsoleWrite("accHelpTopic: " & $oAccessibleObject.accHelpTopic($Param) & @CRLF) ;<- ConsoleWrite("accKeyboardShortcut: " & $oAccessibleObject.accKeyboardShortcut & @CRLF) ConsoleWrite("accName: " & $oAccessibleObject.accName & @CRLF) ConsoleWrite("accParent: " & $oAccessibleObject.accParent & @CRLF) ConsoleWrite("accRole: " & $oAccessibleObject.accRole & @CRLF) ConsoleWrite("accSelection: " & $oAccessibleObject.accSelection & @CRLF) ConsoleWrite("accState: " & $oAccessibleObject.accState & @CRLF) ConsoleWrite("accValue: " & $oAccessibleObject.accValue & @CRLF) EndIf ConsoleWrite(@CRLF) #cs ; Change style (got to do something with the handle now that I have it) Global Const $GWL_STYLE = -16 _WinAPI_SetWindowLong($hObjWinHandle, $GWL_STYLE, BitOR($WS_OVERLAPPEDWINDOW, $WS_CHILD)) #ce ; Change title WinSetTitle($hObjWinHandle, 0, "My embedded browser") ; Show it GUICtrlSetState($hActiveX, $GUI_SHOW) ; Needed to check state Global $iNotLoaded = 1 ; Will get another handle, declare variable for it Global $hObjDocWinHandle ; for other handle ; New objects Global $oIEObjectDocument Global $oAccessibleObjectDoc ; For moving (nothing smart) Global $iX Global $iUp ; Loop till end While 1 If $iNotLoaded Then $oIEObjectDocument = $oIEObject.document If IsObj($oIEObjectDocument) Then ;Wait till fully loaded While 1 If $oIEObjectdocument.readyState = "complete" Or $oIEObjectdocument.readyState = 4 Then ExitLoop Sleep(100) WEnd $hObjDocWinHandle = _GetObjectWinHandle($oIEObjectDocument) ConsoleWrite("! $oIEObject.document win handle: " & $hObjDocWinHandle & @CRLF) ; this is what you normally get with AutoIt Window Info tool $oAccessibleObjectDoc = _AccessibleObjectFromWindow($hObjDocWinHandle) If IsObj($oAccessibleObjectDoc) Then ; ConsoleWrite("accChild: " & $oAccessibleObject.accChild($Param) & @CRLF) ;<- limitation ConsoleWrite("accChildCount: " & $oAccessibleObjectDoc.accChildCount & @CRLF) ConsoleWrite("accDefaultAction: " & $oAccessibleObjectDoc.accDefaultAction & @CRLF) ConsoleWrite("accDescription: " & $oAccessibleObjectDoc.accDescription & @CRLF) ConsoleWrite("accFocus: " & $oAccessibleObjectDoc.accFocus & @CRLF) ConsoleWrite("accHelp: " & $oAccessibleObjectDoc.accHelp & @CRLF) ; ConsoleWrite("accHelpTopic: " & $oAccessibleObjectDoc.accHelpTopic($Param) & @CRLF) ;<- limitation ConsoleWrite("accKeyboardShortcut: " & $oAccessibleObjectDoc.accKeyboardShortcut & @CRLF) ConsoleWrite("accName: " & $oAccessibleObjectDoc.accName & @CRLF) ConsoleWrite("accParent: " & $oAccessibleObjectDoc.accParent & @CRLF) ConsoleWrite("accRole: " & $oAccessibleObjectDoc.accRole & @CRLF) ConsoleWrite("accSelection: " & $oAccessibleObjectDoc.accSelection & @CRLF) ConsoleWrite("accState: " & $oAccessibleObjectDoc.accState & @CRLF) ConsoleWrite("accValue: " & $oAccessibleObjectDoc.accValue & @CRLF) EndIf ; Restore cursot GUISetCursor(-1) $iNotLoaded = 0 EndIf Else WinMove($hObjWinHandle, 0, $iX, 0) If $iX > 100 Then $iUp = -1 ElseIf $iX <= 0 Then $iUp = 1 EndIf $iX += $iUp EndIf Sleep(30) WEnd ; FUNCTIONS: Func _GetObjectWinHandle($oObject) Local $aCall = DllCall("oleacc.dll", "int", "WindowFromAccessibleObject", _ "idispatch", $oObject, _ "hwnd*", 0) If @error Or $aCall[0] Then Return SetError(1, 0, 0) EndIf Return $aCall[2] EndFunc ;==>_GetObjectWinHandle Func _AccessibleObjectFromWindow($hWnd) Local $sIID_IAccessible = "{618736E0-3C3D-11CF-810C-00AA00389B71}" Local $tGUID = _WinAPI_GUIDFromString($sIID_IAccessible) Local $pGUID = DllStructGetPtr($tGUID) Local $aCall = DllCall($hOLEACC, "int", "AccessibleObjectFromWindow", _ "hwnd", $hWnd, _ "dword", 0, _ ; OBJID_WINDOW "ptr", $pGUID, _ "idispatch*", 0) If @error Or $aCall[0] Then Return SetError(1, 0, 0) EndIf Return $aCall[4] EndFunc ;==>_AccessibleObjectFromWindow Func _ErrFunc() ConsoleWrite("--- COM Error, number = " & Ptr($oMyError.number) & ", description: " & $oMyError.windescription) EndFunc ;==>_ErrFunc Func _Quit() Exit EndFunc ;==>_Quit ; We had the same findings about loading oleacc.dll. That's great! I run first post example on Vista, and was not pleased with what I find. That is to say that I made a mistake with not waiting for page to fully load. That must be done before processing that object. It's fixed here. edit: Call to CoInitialize would be smart to add at the beginning of the script, or maybe: DllCall("ole32.dll", "int", "CoInitializeEx", "ptr", 0, "dword", 2) ;COINIT_APARTMENTTHREADEDI added error checking for AccessibleObjectFromWindow function1 point
-
VAN0, And so I am afraid falls foul of the Forum rules - thread locked. M230 points