Leaderboard
Popular Content
Showing content with the highest reputation on 02/28/2020 in all areas
-
You may resort to use an UDF. WebDriver or IE. Latest is easier to learn as it is very well documented, but WebDriver is the way to go if you prefer Chrome and don't way to use IE. Because at some point, sooner or later, by using Send and MouseClick you will hit a wall and you will be forced to take a UDF. If you want a more robust solution, and not always fighting with the browser, go with a UDF...2 points
-
As written, your script will send the output to the currently active window, which may not be the browser. Suggest that you look at the WinActivate function. P.S. Also suggest that you change your password now that you've exposed it the the entire world. 😲2 points
-
I agree ... so this should work #Include <Array.au3> $txt = "Send('BLA.CMD ""Testasdf.exe"" folder\file.txt asdf123')" & @crlf & _ "Send('{enter}')" & @crlf & _ "ShellExecute(@ScriptDir & ""\folder\file.txt"")" & @crlf & _ "ShellExecute(@HomeDrive & ""\Program Files\PROGRAMDIR\Program Dir\my program.exe"", @ScriptDir & ""\Testblabla.exe"")" $res = StringRegExp($txt, '(\w+)\.exe(?!.*?,)', 3) _ArrayDisplay($res)2 points
-
"\\?([\w ]+)(?=\.exe) This should also work (with the following assumptions): file name will always be enclosed in double quotes file name will consist of only letters, number, underscores, and spaces file name will always end with .exe file name optionally begins with a "\" directly after the initial double quote I left off the (?i) for case-insensitivity. You can add it back if it's needed. https://regex101.com/r/xYqThi/12 points
-
; ;################################## ; 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
-
Version 3.4
1,395 downloads
The CodeScannerCrypterBundle (ca. 2.9 MB unzipped) contains the following UDFs and utilities: CodeScanner: analyse AutoIt script structure and content, identify potential issues, generate MCF data files CodeCrypter: front-end GUI for the MCF library, for script encryption (without storing the decryption key(s) in the script!) MetaCodeFile UDF (MCF library): for analysis and user-defined alterations of AutoIt script structure and content MCFinclude.au3: #include this UDF in any AutoIt script that you wish CodeCrypter to process CryptoNG, by TheXman; encryption UDF using Bcrypt dll calls (32/64-bit; various algorithms) StoreCCprofile.au3/readCSdatadump.au3/helloworld.au3: auxiliary utilities and example script HowToCodeCrypt.pdf: a simple guide in five steps CodeCrypterFAQ.pdf: questions and answers, partly based upon exchanges in the CodeCrypter thread. MetaCodeTutorial.pdf: the MCF engine explained; useful for encryption, GUI translation, code translation, and much more... Please follow the links for additional information.1 point -
1 point
-
That's a very small database! I'd highly recommend using SQLite. First, AutoIt comes with a ready to use UDF for it. Next, it's the most widely used and stable piece of software ever, along with zlib possibly. Any SQLite DB can be used verbatim from any hardware/software platform you can dream of. There are SQLite DBs managing Tb of data. SQlite is free and open-source. You already use many SQLite DBs under the hood of your devices (smartphone, tablet, smart TV, router, GPS, browser, OS, car, ...).1 point
-
Just one word : SQLite Very well integrated in AutoIt (and many other languages). There are also a huge number of examples, tutorials etc.1 point
-
Too late Alex I wrote them down ! I am just teasing you1 point
-
Example of _WD_LoadWait
Danp2 reacted to seadoggie01 for a topic
I would really suggest taking a look at wd_demo.au3 that comes with the UDF. You're looking for something a bit more like this: (untested) #include <MsgBoxConstants.au3> #include <wd_core.au3> #include <wd_helper.au3> ; Here you can specify some browser specific settings... you'll need to research them depending on your browser ; ... or just copy paste someone else's code :D #Region Settings Setup _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) Global $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' #EndRegion Settings Setup ; You need to initialize some stuff with this UDF _WD_Startup() ; If there is an error setting stuff up, then exit If @error <> $_WD_ERROR_Success Then Exit -1 EndIf ; Create a new instance of a browser with some settings you request Global $sSession = _WD_CreateSession($sDesiredCapabilities) ; If there was an error, exit If Not (@error = $_WD_ERROR_Success) Then Exit MsgBox($MB_ICONERROR, "Error: _WD_CreateSession", "Failed to create a Session. Check your desired capabilities.") ; Move to the requested website _WD_Navigate($sSession, "http://yourwebsite.com") ; Anything you want to do after navigating to the website goes here MsgBox($MB_ICONINFORMATION, "Navigation completed!", "Click ok to shutdown the browser and console") ; This removes the browser instance _WD_DeleteSession($sSession) ; And this cleans up some resources _WD_Shutdown() Edit 1: Updated with Gecko driver settings... didn't realize that was used for FireFox Edit 2: _WD_Options goes before _WD_Startup1 point -
Aim at a moving target to make time pass away fast 😉1 point
-
Hmm. jchd, was right, you must strictly define your requirements Currently it seems that the best way is the concept from Malkey #Include <Array.au3> $txt = "Send('BLA.CMD ""Testasdf!^+%&()=_.exe"" folder\file.txt asdf123', 1)" & @crlf & _ "Send('{enter}')" & @crlf & _ "ShellExecute(@ScriptDir & ""\folder\file.txt"")" & @crlf & _ "ShellExecute(@HomeDrive & ""\Program Files\PROGRAMDIR\Program Dir\my program.exe"", @ScriptDir & ""\Testblabla!^+%&()=_.exe"")" $res = StringRegExpReplace($txt, '[^"]+(?=\.exe"(?:\h|\)))', 'Replacewith.exe') MsgBox(0,"", $res)1 point
-
Need to get computer description
evansullivan reacted to Subz for a topic
You can try WMI for example: Local $oWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") If Not IsObj($oWMIService) Then Exit Local $oInstances = $oWMIService.ExecQuery("Select * from win32_operatingsystem") If IsObj($oInstances) Then For $oInstance In $oInstances ConsoleWrite($oInstance.Description & @CRLF) Next EndIf Actually remembered you can get this from Registry as well Local $sDescription = RegRead("HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters", "srvcomment") MsgBox(4096, "Computer Description", @ComputerName & " = " & $sDescription)1 point -
It's because the file names contain non-word characters. Just replace in the expression \w by [^"] #Include <Array.au3> $txt = "Send('BLA.CMD ""Testasdf!^+%&()=_.exe"" folder\file.txt asdf123')" & @crlf & _ "Send('{enter}')" & @crlf & _ "ShellExecute(@ScriptDir & ""\folder\file.txt"")" & @crlf & _ "ShellExecute(@HomeDrive & ""\Program Files\PROGRAMDIR\Program Dir\my program.exe"", @ScriptDir & ""\Testblabla!^+%&()=_.exe"")" $res = StringRegExpReplace($txt, '([^"]+)\.exe(?!.*?,)', 'Replacewith.exe') MsgBox(0,"", $res)1 point
-
Here is a reply to your questions. #include <Array.au3> #cs Send('BLA.CMD "Testasdf.exe" folder\file.txt asdf123') Send('{enter}') ShellExecute(@ScriptDir & "\folder\file.txt") ShellExecute(@HomeDrive & "\Program Files\PROGRAMDIR\Program Dir\my program.exe", @ScriptDir & "\Testblabla.exe") #ce Local $sTestString = StringRegExpReplace(FileRead(@ScriptFullPath), "(?s)^.*?#cs\v+|\v+#ce.*$", "") ; ConsoleWrite($sTestString & @CRLF) $a1 = StringRegExp($sTestString, '(?i)[\w\h]+(?=\.exe"(?:\h|\)))', 3) ; post #1, after results Testasdf and Testblabla _ArrayDisplay($a1) $a2 = StringRegExp($sTestString, '(?i)[\w\h]+\.exe(?="(?:\h|\)))', 3) ; post #3, after results Testasdf.exe and Testblabla.exe _ArrayDisplay($a2) ConsoleWrite(StringRegExpReplace($sTestString, '(?is).*?(?<= "|"\\)([\w\h]+)(\.exe"\h|\.exe"\)).*?', "\1" & ' ') & @CRLF) ; post #1, after results Testasdf and Testblabla ConsoleWrite("------------------" & @CRLF) ConsoleWrite(StringRegExpReplace($sTestString, '(?is).*?(?<= "|"\\)([\w\h]+\.exe)("\h|"\)).*?', "\1" & @CRLF)) ; post #3, after results Testasdf.exe and Testblabla.exe #cs ; Returns @ output console:- Testasdf Testblabla ------------------ Testasdf.exe Testblabla.exe #ce1 point
-
That makes an assumption that the file name is not in a subdirectory as something like this in the last line is not captured ShellExecute(@HomeDrive & "\Program Files\PROGRAMDIR\Program Dir\my program.exe", @ScriptDir & "\test\Testblabla.exe") And the previous lot are equivalent to just acting on an exe with no spaces in the name (?:\\|")\w*.exe i would lean towards the trailing comma as the criteria to exclude "my program.exe" from the example. In both the first Send command and the last Shellexecute, the exe is in the last parameter.1 point
-
You get the same matches with (?i)["\\]([^ \\]+).exe"1 point
-
What's the condition to not match myprogram as well? If it's for getting program names w/o extension in this sample, use (?i)["\\]([^\\]*)\.exe" Explain your complete requirements in full detail please.1 point
-
Pal, Peter's AutoIt functions Library
dmob reacted to PeterVerbeek for a topic
Start Precision Helper to create a new project in a folder (I usually create a folder called Help in my AutoIt project folder). At the left you'll find the TOC, Index and tabs such as Settings. Add a topic in the TOC and select a HTML file by clicking the "Select topic" button (right to the Table of Contents). Keep adding topics and subtopics to create the manual/help. You can drag a topic to change its position in the TOC. Then add search keys in the Index, same procedure as topics. The green Run button creates the chm file and shows it. One neat trick is putting your HTML editor in the Precision Helper settings so it can be started by the clicking the Edit button. I've included an image of the manual I made for the Peace equalizer. In orange some pointers on how to create a chm.1 point -
So again, did you try using my script at all for this as that should work too on a straitforward SMTP server as far as I know given you set the parameters correctly. Jos1 point
-
Can't compare split results...
edumanilha reacted to FrancescoDiMuro for a topic
Definitely yes, and it is very annoying! Sometimes it is better to stop working when it's late, and begin the next day with a bunch of hours of sleep. By the way, happy to have helped1 point -
INI Editor
seadoggie01 reacted to boomingranny for a topic
1 point