-
Posts
296 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sahsanu
-
Send email error - _INetSmtpMailCom error 2
sahsanu replied to AutID's topic in AutoIt General Help and Support
I just created an account in outlook.com to test it and it is working fine for me using port 25 and SSL enabled but I'm not using smtp.live.com, according to Microsoft doc it should be smtp-mail.outlook.com and as I said it is working fine. Cheers, sahsanu -
Send email error - _INetSmtpMailCom error 2
sahsanu replied to AutID's topic in AutoIt General Help and Support
Use SSL and port 587 instead of 25. Edit: In case it fails on port 587 too, use 465 instead, always with SSL activated. -
Get directory list on multiple machines
sahsanu replied to JohnSte's topic in AutoIt General Help and Support
I'm a bit bored so... Script to be used on machine 1: #include <Array.au3> #include <File.au3> $sPathMachine1 = @ScriptDir & "\root_folder_machine1" ;path to root folder on machine 1 $aListMachine1 = _FileListToArrayRec($sPathMachine1, "*", $FLTAR_FOLDERS, $FLTAR_RECUR, $FLTAR_SORT) ;_ArrayDisplay($aListMachine1) ;uncomment this line if you want to view the list of dirs found on machine 1 _FileWriteFromArray(@ScriptDir & "\listdir_machine1.txt", $aListMachine1, 1) Copy the file created "listdir_machine1.txt" to machine 2, then execute this script: #include <Array.au3> #include <File.au3> $sPathMachine2 = @ScriptDir & "\root_folder_machine2" ;path to root folder on machine 2 $sPathListMachine1 = @ScriptDir & "\listdir_machine1.txt" ;path to file copied from machine 1 which contains the list of dirs Local $aListMachine1 _FileReadToArray($sPathListMachine1, $aListMachine1) ;read the file and put the content in an array ;_ArrayDisplay($aListMachine1) ;uncomment this line if you want to view the array created For $i = 1 To $aListMachine1[0] $sCheckPath = $sPathMachine2 & "\" & $aListMachine1[$i] If Not FileExists($sCheckPath) Then ;here you should write the code to create the dirs ConsoleWrite("This dir should be created on machine 2: " & $sCheckPath & @CRLF) EndIf Next There are several comments inside the code. I hope this could be a start to write your own script Cheers, sahsanu -
Get directory list on multiple machines
sahsanu replied to JohnSte's topic in AutoIt General Help and Support
If you take a look to example script in _FileListToArrayRec() function you'll find it ;-) -
Try this code: Global $IPAddress1 = "192.168.1.37" Global $IPAddress2 = "192.168.1.40" Global $IPAddress3 = "192.168.1.41" Global $IPArray[3] = [$IPAddress1, $IPAddress2, $IPAddress3] _Ping() ;If you want lo limit the tries to ping all the machines simply add the number of tries _Ping(20) for example, by default are 10 If @error Then ConsoleWrite("One or more machines are down." & @CRLF) Else ConsoleWrite("All machines are up and running." & @CRLF) EndIf Func _Ping($iMaxtries = 10) $iCountTotal = 0 Do $iCount = 0 For $p = 0 To UBound($IPArray) - 1 $PingTemp = Ping($IPArray[$p], 250) If Not @error Then $iCount += 1 Sleep(100) Next $iCountTotal += 1 If $iCountTotal = $iMaxtries And $iCount < 3 Then Return SetError(1, 1, 1) EndIf Sleep(500) Until $iCount = 3 Return 0 EndFunc ;==>_Ping Cheers, sahsanu
-
As Jos said, you could take a look to help file, in StringRegExp you have a good refrence for regular expressions. And this is what the regular expression does: (?s)(.*project.*?version=")(.*?)(".*) Options: Case sensitive; Exact spacing; Dot doesn't match line breaks; ^$ match at line breaks; Greedy quantifiers; Regex syntax only Use these options for the whole regular expression «(?s)» &Dot matches line breaks «s» Match the regex below and capture its match into backreference number 1 «(.*project.*?version=")» Match any single character «.*» Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*» Match the character string “project” literally (case sensitive) «project» Match any single character «.*?» Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?» Match the character string “version="” literally (case sensitive) «version="» Match the regex below and capture its match into backreference number 2 «(.*?)» Match any single character «.*?» Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?» Match the regex below and capture its match into backreference number 3 «(".*)» Match the character “"” literally «"» Match any single character «.*» Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*» ${1}0.0.0${3} Insert the text that was last matched by capturing group number 1 «${1}» Insert the character string “0.0.0” literally «0.0.0» Insert the text that was last matched by capturing group number 3 «${3}» Cheers, sahsanu
-
For me it isn't clear if you wants to replace all version fields or just project part so if you want to replace all version fields go ahead with mikell regexp (mikell is really good with regular expressions ). if you just want to replace field version for project part you could use something like this: $txt = FileRead("1.txt") $txt = StringRegExpReplace($txt, '(?s)(.*project.*?version=")(.*?)(".*)', "${1}0.0.0${3}") FileWrite("2.txt", $txt) Cheers, sahsanu
-
If I understood the question, I think this could fit your needs (comments in code): Local $ProcessNameList[3][2] = [["CALC.EXE", ""], ["NOTEPAD.EXE", ""], ["MSPAINT.EXE", ""]] ;Define a 2D array to store the process name and in the second column the pids of running applications While 1 For $i = 0 To UBound($ProcessNameList) - 1 ;read the array in a for loop If ProcessExists($ProcessNameList[$i][0]) Then ;if the process exists then we will check it $aPid = ProcessList($ProcessNameList[$i][0]) ;get the pids for all instances of process name If IsArray($aPid) Then ;if we got the list continue For $x = 1 To $aPid[0][0] ;we will check in a for loop if the pid process is already in our list If Not StringInStr($ProcessNameList[$i][1], "|" & $aPid[$x][1] & "|") Then ;if the pid process is not in our list (second column of our process name array)... MsgBox(0, "Process running", $ProcessNameList[$i][0] & " is running with pid " & $aPid[$x][1]) ;... then show a message... $ProcessNameList[$i][1] &= "|" & $aPid[$x][1] & "|" ; ... and add the pid in our list (second column of our process name array) EndIf Next EndIf EndIf Next Sleep(500) WEnd Cheers, sahsanu
-
Trouble with command line parameter in RunWait()
sahsanu replied to tykkimies's topic in AutoIt General Help and Support
Regarding 64 bit OS, if you are launching now the command from a 64 bits OS to test it, believe me, it could made the difference . Try to run the command without @comspec, the command directly: RunWait('\\pafile\WindebtXL\WINDEB~1\WinDeb~1\Setup\setup.exe /s /v"/qn /L*v \"%temp%\wdins.log\" USERNAME="Lmm" AGREETOLICENSE=Yes COMPANYNAME=\"Lmm Management\""') Keep in mind that %temp% could not be expanded so you have two options, remove %temp% and put the full path for temp dir or add this option in your script: Opt("ExpandEnvStrings",1) RunWait('\\pafile\WindebtXL\WINDEB~1\WinDeb~1\Setup\setup.exe /s /v"/qn /L*v \"%temp%\wdins.log\" USERNAME="Lmm" AGREETOLICENSE=Yes COMPANYNAME=\"Lmm Management\""') By the way, do you need to quote this?: "/qn /L*v \"%temp%\wdins.log\" USERNAME="Lmm" AGREETOLICENSE=Yes COMPANYNAME=\"Lmm Management\"" And why are you escaping several ?. You could also try several variants of the command: RunWait('\\pafile\WindebtXL\WINDEB~1\WinDeb~1\Setup\setup.exe /s /v"/qn /L*v \"%temp%\wdins.log\" USERNAME="Lmm" AGREETOLICENSE=Yes COMPANYNAME=\"Lmm Management\""', @ScriptDir) RunWait('\\pafile\WindebtXL\WINDEB~1\WinDeb~1\Setup\setup.exe /s /v /qn /L*v "%temp%\wdins.log" USERNAME="Lmm" AGREETOLICENSE=Yes COMPANYNAME="Lmm Management"') RunWait('\\pafile\WindebtXL\WINDEB~1\WinDeb~1\Setup\setup.exe /s /v /qn /L*v "%temp%\wdins.log" USERNAME="Lmm" AGREETOLICENSE=Yes COMPANYNAME="Lmm Management"', @ScriptDir) If none works... I'm running out of ideas Cheers, sahsanu -
Trouble with command line parameter in RunWait()
sahsanu replied to tykkimies's topic in AutoIt General Help and Support
If you are in a 64 bits OS put this on top of your script and try again: #AutoIt3Wrapper_UseX64=y If that doesn't work add #RequireAdmin too: #RequireAdmin #AutoIt3Wrapper_UseX64=y -
Sort 2D Array with Alpha and Numerical Columns
sahsanu replied to millisys's topic in AutoIt General Help and Support
Hello, Try to convert to Number the second column before sort: #include <file.au3> #include <array.au3> Local $scores _FileReadToArray("scores.csv", $scores, 0, ",") _ArraySort($scores, 1, 0, 0, 1) _ArrayDisplay($scores, "column 1 ascending") For $i = 0 To UBound($scores) - 1 $scores[$i][1] = Number($scores[$i][1]) Next _ArraySort($scores, 1, 0, 0, 1) _ArrayDisplay($scores, "column 1 ascending") Edit: I forgot to say that if you want to sort ascending you should change the first 1 in _ArraySort() function to 0 (0 means ascending and 1 descending). Cheers, sahsanu -
Trouble with command line parameter in RunWait()
sahsanu replied to tykkimies's topic in AutoIt General Help and Support
Hello, If you have run that command line and it worked if there is no space in any dir, then try to convert the folder with space from long to short name, something like this: RunWait(@comspec & ' /c "\\pafile\WindebtXL\WindebtXLPA\WinDeb~1\Setup\setup.exe" /s /v"/qn /L*v \"%temp%\wdins.log\" USERNAME="Lmm" AGREETOLICENSE=Yes COMPANYNAME=\"Lmm Management\""') By the way, when you test this kind of command, it's better to use parameter /k instead of /c, parameter /k will keep active the command window so you could see whether there is any error to debug the problem. Exceute cmd.exe /? to see what are the parms available. Cheers, sahsanu -
parsing bitlocker encryption results
sahsanu replied to gcue's topic in AutoIt General Help and Support
And that is the reason you should specify what are the exact requirements you need to accomplish the task -
parsing bitlocker encryption results
sahsanu replied to gcue's topic in AutoIt General Help and Support
You are welcome -
As the code is public you could try to change it on your own. Just add on Keygen.au3 a new include (license.au3 uses this include already): #include <Crypt.au3> And on both, Keygen.au3 and license.au3 add a new function which acts as a wrapper for old _StringEncrypt() function: Func _StringEncrypt($fEncryptDecrypt, $sData, $sPassword) _Crypt_Startup() Local $sResult = "" If $fEncryptDecrypt = 1 Then $sResult = Hex(_Crypt_EncryptData($sData, $sPassword, $CALG_AES_256)) Else $sResult = BinaryToString(_Crypt_DecryptData("0x" & $sData, $sPassword, $CALG_AES_256)) EndIf _Crypt_Shutdown() Return $sResult EndFunc ;==>_StringEncrypt Note 1: The new encryption is not compatible with the encryption used in old _StringEncrypt(). Note 2: I don't use this UDF so I did not test it. Cheers, sahsanu
-
Include statement necessary for compiling?
sahsanu replied to cag8f's topic in AutoIt General Help and Support
Hello, I don't use Avast so I don't know where you can exclude files/folders but if you find the right option you should exclude this (change red words with your real unit and username): X:UsersUserNameAppdataLocalAutoit v3Aut2Exe Note: You should exclude this folder not just in manual/on demand scans but in real time scanning too. Cheers, sahsanu -
Hello, The problem with that method is that if you open a pic file with MsPaint and you check inside the program the list of MRU you will see the file in the list but it is not written in registry till you close the program so this method doen't work if you just have opened a file and want to check the full path. Proof of concept Open a file with MsPaint and run below script... you will get No match found. Close MsPaint and open again the same pic file... you will get the full path. Opt("WinTitleMatchMode", 2) If WinExists("- Paint") Then $sTitle = WinGetTitle("- Paint") $sPicName = StringRegExpReplace($sTitle, "(.+)\s-\sPaint", "$1") Local $sSubKey = "", $sValKey = "" Local $sParenteKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List\" ;Maybe this key is different on Win XP machine For $i = 1 To 10 $sSubKey = RegEnumVal($sParenteKey, $i) If @error Then ConsoleWrite("No match found" & @CRLF) ExitLoop EndIf $sValKey = RegRead($sParenteKey, $sSubKey) If StringInStr($sValKey, $sPicName) Then ConsoleWrite("PicName full path is: " & $sValKey & @CRLF) ExitLoop EndIf Next EndIf Note: As I comment inside the code, I don't know what is the correct RegKey for WinXP. And sorry, I don't know any other way to get the full path of a recently file opened on MsPaint . Cheers, sahsanu
-
Delete folder created by mistake.
sahsanu replied to Belini's topic in AutoIt General Help and Support
Well, this is something that we learn in the hard way. I'm sorry you removed the content in your D drive, seems you recovered the data but keep in mind that when you use move or delete commands you should be really sure about what you are doing. Cheers, sahsanu -
Delete folder created by mistake.
sahsanu replied to Belini's topic in AutoIt General Help and Support
Hello, To remove a folder on another drive just change the name of the folder in 8.3 format and change the workingdir for the parent where the folder is located, For example, you need to remove a folder named DIRECT~1 located in D:onetwo Run(@ComSpec & " /c rmdir /S /Q DIRECT~1", "D:\one\two\", @SW_HIDE) As FileGetShortName function won't work if the dir is "special" you could open a command prompt, browse to the parent folder where the "special" folder is placed and run dir /X command to get the name of that folder in 8.3 format. Warning: rmdir /S /Q will remove everyting recursively without asking you so you should be really careful or you could delete more than you want. Cheers, sahsanu