Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/26/2018 in all areas

  1. ConsoleWrite(_GifAnimated(@ScriptDir & "\filename.gif") & @CRLF) Func _GifAnimated($_sGifFileName) If FileExists($_sGifFileName) = 0 Then Return False Local $objImage = ObjCreate("WIA.ImageFile") $objImage.LoadFile($_sGifFileName) Return $objImage.IsAnimated EndFunc
    5 points
  2. Jos

    Doubt with a quantity

    You are comparing with a literal string, not a number. change that to: $cantidad = Number($cantidad) if $cantidad > 750 and $cantidad < 1000 Then Jos
    1 point
  3. BrewManNH

    Doubt with a quantity

    Remove the quotes around the numbers in the comparisons. If $cantidad > 750 And $cantidad < 1000 Then
    1 point
  4. Finally I solved this also by add : Return $foundedNUM and make "$foundedNUM" Global Global $foundedNUM=$iCurrentLineNum Final code : #include<array.au3> ;#include '_Startup.au3' #include <Date.au3> #include<File.au3> Sort_File() Func Sort_File() $fileToRead = @ScriptDir & "\daysarray.qu" ;dim $foundedNUM ;###################################### Load Days Local $FileRead = FileRead($fileToRead) $aTxt = StringRegExpReplace($FileRead & @CRLF, "(.*?)(\r\n)(.*?)(\r\n)", "$1,");Read first line to array $aTxt = StringSplit($aTxt, ",") _ArrayDelete($aTxt, 0) ;Delete Total Rows Value Dim $Arraytofill[1] For $i = 0 to UBound($aTxt,1) -1 _ArrayAdd($Arraytofill,$aTxt[$i]) Next _ArrayDelete($Arraytofill, 0) ;Delete Total Rows Value _ArraySort($Arraytofill) _ArrayDisplay($Arraytofill,"$Arraytofill") $aTxt2 = StringRegExpReplace($FileRead & @CRLF, "(.*?)(\r\n)(.*?)(\r\n)", "$3,");Ready line and pass line $aTxt2 = StringSplit($aTxt2, ",");Ready line and pass line _ArrayDelete($aTxt2, 0) ;Delete Total Rows Value Dim $final_array[1] For $i = 0 to UBound($Arraytofill,1)-1 ;$fileToRead = @ScriptDir & "\daysarray.qu" ConsoleWrite(@CRLF&$aTxt[$i]) $getLine=_LineNumsOfSearchStr($fileToRead,$Arraytofill[$i]) ;ConsoleWrite(@CRLF&"Next Line is: "&$Second_Line) $Second_Line=FileReadLine($fileToRead,$foundedNUM+1) _ArrayAdd($final_array,$Second_Line) Next _ArrayDelete($final_array, 0) ; _ArrayDisplay($final_array,"$final_array") FileDelete($fileToRead) Sleep(1000) For $i = 1 to UBound($Arraytofill,1)-1 ConsoleWrite(@CRLF&$Arraytofill[$i]) ConsoleWrite(@CRLF&$final_array[$i]) ;_ArrayDisplay($final_array,"$final_array") FileWrite($fileToRead,@crlf&$Arraytofill[$i]) FileWrite($fileToRead,@crlf&$final_array[$i]) Next TidyDayssarray() EndFunc Func _LineNumsOfSearchStr($sFileName, $searchString, $bDeleteLine = False) Local $location, $aCurrentLineNum, $iCurrentLineNum, $sFile, $iOccur = 1, $sRes = "" If FileExists($sFileName) = 0 Then Return 1 Do $sFile = FileRead($sFileName) $location = StringInStr($sFile, $searchString, 0, $iOccur) ; Find the $iOccur occurrence of the "substring" If $location > 0 Then $aCurrentLineNum = StringRegExp(StringRegExpReplace($sFile, "(?s)(.{" & $location & "})(.*)$", "\1"), "(?s)(\v+)", 3) ;Find line number $iCurrentLineNum = UBound($aCurrentLineNum) + 1 ; Line number Global $foundedNUM=$iCurrentLineNum ;Consolewrite(@crlf&"Founded Date Line Is: "&$foundedNUM&@crlf) ; _FileWriteToLine($sIniFile, 1, $iCurrentLineNum, True) ;ConsoleWrite("CharPos: " & $location & " Ln: " & $iCurrentLineNum & @CRLF) $sRes &= $iCurrentLineNum & "|" If $bDeleteLine Then Else $iOccur += 1 EndIf Else ExitLoop EndIf Sleep(10) Until 0 FileClose($sFile) ;ShellExecute($fileToRead) Return StringSplit(StringTrimRight($sRes, 1), "|") Return $foundedNUM EndFunc ;==>_LineNumsOfSearchStr Func TidyDayssarray() Global $aLines _FileReadToArray($fileToRead, $aLines) For $i = $aLines[0] To 1 Step -1 If $aLines[$i] = "" Then _ArrayDelete($aLines, $i) EndIf Next _FileWriteFromArray($fileToRead, $aLines, 1) ConsoleWrite(@crlf& " Tidy Done" & @CRLF) EndFunc
    1 point
  5. You need to do some error checking in there. ;~ I am using the FF.au3 since I need to automate FireFox $currentIRISURL = _FFCmd(".location.href") ;This works the same way as _IEPropertyGet($oIE, "locationurl") ; check here to see if you have anything returned by the previous command, I don't know what it returns or what errors you might get Global $pages = _StringBetween($currentIRISURL, "page=", "&search") If Not @error Then MsgBox(1, "", $pages[0]) Else MsgBox(1, "", "Not found") EndIf
    1 point
  6. 1 point
  7. if you want to keep and save only content of first column (column 0) of the array, the you have to change the "index" in the code so to point to column 0 of the array instead of column 1. for convenience I've changed a bit the code inserting a new variable called $iWantedColum, so you can set that variable to the column you are interested to keep. change this portion of code in the main script. _ArrayDisplay($aArray3, "Debug") Local $iWantedColumn = 0 ; column to keep (0, 1, or 2) ; count the number of links found Local $iRows = 0 For $i = 0 To UBound($aArray3) - 1 If $aArray3[$i][$iWantedColumn] <> "" Then $iRows += 1 Else ExitLoop EndIf Next If $iRows Then ; if there are wanted links ; extract found links Local $aArray4 = _ArrayExtract($aArray3, -1, $iRows - 1, $iWantedColumn, $iWantedColumn) _ArrayDisplay($aArray4, "found links") ; save links to disk file _FileWriteFromArray($sNewFile, $aArray4) Else MsgBox(0, "Debug", "no links found") EndIf
    1 point
  8. .... from what I see from the screenshot, all links contained in the links2.txt file are also contained in the links1.txt file, so they are considered "duplicate" and consequently discarded. For what I understud, you need to keep only links that are present in links2.txt but not also in the links1.txt file. .....isn't so?
    1 point
  9. well, time ago I wrote a function that could be useful to solve your problem something like this should work: #include <File.au3> #include <Array.au3> ; disk files containig links Local $sFilename1 = "links1.txt" Local $sFilename2 = "links2.txt" Local $sNewFile = "Result.txt" ; get content from files to arrays Local $aArray1 = FileReadToArray($sFilename1) Local $aArray2 = FileReadToArray($sFilename2) ; create a new 2D array containing elements as following: ; column [0] : elements contained only in file 1 ; column [1] : elements contained only in file 2 ; column [2] : elements contained in both files Local $aArray3 = _Separate($aArray1, $aArray2) _ArrayDisplay($aArray3, "Debug") ; count the number of links found Local $iRows = 0 For $i = 0 To UBound($aArray3) -1 If $aArray3[$i][1] <> "" Then $iRows += 1 Else ExitLoop EndIf Next If $iRows Then ; if there are wanted links ; extract found links Local $aArray4 = _ArrayExtract($aArray3, -1, $iRows - 1, 1, 1) _ArrayDisplay($aArray4, "found links") ; save links to disk file _FileWriteFromArray($sNewFile, $aArray4) Else MsgBox(0, "Debug", "no links found") EndIf Func _Separate(ByRef $in0, ByRef $in1) $in0 = _ArrayUnique($in0, 0, Default, Default, 0) $in1 = _ArrayUnique($in1, 0, Default, Default, 0) Local $z[2] = [UBound($in0), UBound($in1)], $low = 1 * ($z[0] > $z[1]), $aTemp[$z[Not $low]][3], $aOut = $aTemp, $aNdx[3] For $i = 0 To $z[Not $low] - 1 If $i < $z[0] Then $aTemp[$i][0] = $in0[$i] If $i < $z[1] Then $aTemp[$i][1] = $in1[$i] Next For $i = 0 To $z[$low] - 1 $x = _ArrayFindAll($aTemp, $aTemp[$i][$low], 0, 0, 1, 0, Not $low) If Not @error Then ; both For $j = 0 To UBound($x) - 1 $aTemp[$x[$j]][2] = 1 Next $aOut[$aNdx[2]][2] = $aTemp[$i][$low] $aNdx[2] += 1 Else ; only in $low $aOut[$aNdx[$low]][$low] = $aTemp[$i][$low] $aNdx[$low] += 1 EndIf Next For $i = 0 To $z[Not $low] - 1 If $aTemp[$i][2] <> 1 Then $aOut[$aNdx[Not $low]][Not $low] = $aTemp[$i][Not $low] $aNdx[Not $low] += 1 EndIf Next ReDim $aOut[_ArrayMax($aNdx)][3] Return $aOut EndFunc ;==>_Separate
    1 point
  10. .. do you need to retrieve the links that are contained only in File 2 and not also in file 1 ?
    1 point
  11. Hehe, innertext returns the text without the html tags so your StringBetween can't work Use this instead $sHTML = $oDiv.innerhtml and it will roll on nice
    1 point
  12. Bundle v2.3 released, with experimental support for (encryption of) object methods. @souldjer777: Glad to hear you got it working again, although I get the impression your CodeScannerCrypter work environment is not entirely stable, as your latest issue is resolved in my own environment now. Maybe try with the latest version of the bundle, released today? Kindly post the smallest-possible reproducer test script if you continue to experience serious issues. @Deye: Hello there. Your wish is my command (well, as I'm waiting for a very long calculation to finish your request provided a nice challenging tears-inducing interesting diversion). CodeScanner now tracks object method calls (not object queries though!), and MCF can encode/recode them (if all goes well). This is an experimental, possibly very unstable feature, so use it at your own risk!
    1 point
  13. ... something like this should do: #include <File.au3> #include <Array.au3> ; disk files containig links Local $sFilename1 = "links1.txt" Local $sFilename2 = "links2.txt" Local $sNewFile = "Result.txt" ; get content from files to arrays Local $aArray1 = FileReadToArray($sFilename1) Local $aArray2 = FileReadToArray($sFilename2) ; content of $aArray2 is merged into $aArray1 _ArrayConcatenate($aArray1, $aArray2) ; create a new array containing only unique elements $aArray3 = _ArrayUnique($aArray1, 0, 0, 0, 0) _ArrayDisplay($aArray3, "Debug") ; save the content of $aArray3 to a disk file _FileWriteFromArray($sNewFile, $aArray3)
    1 point
  14. Yeah, do you really need to retrieve a screenshot? Can't you just use a piece of code that screenshots and saves the file to where you want? Just take this as an example of an active window screenshot #include <ScreenCapture.au3> _ScreenCapture_SetJPGQuality(100);max image quality $scrFile = @DesktopDir & "\screenshot - " & @MDAY & @MON & @YEAR & '-' & @HOUR &@MIN& @SEC & ".jpg" _ScreenCapture_CaptureWnd($scrFile, "[ACTIVE]", -1, -1, -1, -1, 0)
    1 point
  15. CIG_Support

    DriveGetType Crashes

    I was still getting errors on DriveGetType since then but have been ignoring it due to time constraint. However, I've now figured out a permanent solution and hope this helps others facing the same error. Keep in mind this only affects users running admin elevated mode, which is exactly what happens with the GPO logon scripts. Standard users appear to be unaffected. First, check if the path exists with the FileExists command. If it doesn't exist then don't do the DriveGetType. That's it. Such a simple workaround. Have fun!
    1 point
  16. Why get and save from the clipboard? I feel this function does it much better in one go https://www.autoitscript.com/autoit3/docs/libfunctions/_ScreenCapture_SaveImage.htm and maybe translate this vba Excel to AutoIt http://www.ms-office-forum.net/forum/sitemap/index.php?t-335549.html
    1 point
  17. jdelaney

    Data encryption

    I was working on this...uses lots of guids for salts, hashes, and encryption based on the user provided password plus a salt: Long story short, you can store a 'Hash' to verify the password is correct...to create a hash is a one way door. It's much safer to hash the string with a salt: https://crackstation.net/hashing-security.htm The user creates an account. Their password is hashed and stored in the database. At no point is the plain-text (unencrypted) password ever written to the hard drive. When the user attempts to login, the hash of the password they entered is checked against the hash of their real password (retrieved from the database). If the hashes match, the user is granted access. If not, the user is told they entered invalid login credentials. Steps 3 and 4 repeat every time someone tries to login to their account.
    1 point
  18. @Jibberish one of our Regex experts will doubtless wander along and provide something more elegant, but for a simple method this works well for me. For this example my file is sitting on the desktop, change your file path accordingly. Let me know if you have any questions: #include <File.au3> Local $aFile, $sText, $sFile = @DesktopDir & "\test.xml" _FileReadToArray($sFile, $aFile) For $a = 1 To $aFile[0] If StringInStr($aFile[$a], '"LoopCheckbox" value="false"') Then $sText = StringReplace(FileReadLine($sFile, $a), '="false"', '="true"') _FileWriteToLine($sFile, $a, $sText, 1) EndIf Next
    1 point
  19. PsaltyDS

    Window key as hotkey

    What you wanted for Send() was: Send("#z") ; Win + z
    1 point
  20. SmOke_N

    get key pressed?

    Only the ones that record them .... Keyloggers can be useful in debugging, can be useful in alot of things, but maliciousness over the past has ruined this forum to determine the "good" from the "bad". Publicly post for the "good" and the "bad" will find it anyway. I'm sure it's nothing against you personally, It's just you won't find much help on that subject or "related" subjects that could be turned into said subject (Damn that was confusing).
    1 point
×
×
  • Create New...