Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/04/2020 in all areas

  1. @Siwa OIC. With that in mind you benefit by using _WD_Timeouts to adjust the default timeout values. You may want to check out _WD_LoadWait. Finally, you can also look into adjusting the pageLoadStrategy setting, which has previously been discussed in this forum.
    1 point
  2. When you define a GUI in Koda, the sizes reflect the client area, whereas WinGetPos returns the true dimensions of the window. On my Win7 it is perfect. Do you have defined a scale in your system (like 125%) ?
    1 point
  3. @Siwa Your script shouldn't get "stuck" as long as you've included appropriate error checking. Can you provide an example where this is occurring? FWIW, you can read more about the webdriver timeouts here. Be advised that the term "script" is referring to javascript, not AutoIt. 😉
    1 point
  4. As far as I can test this code does what you want it to do. I have modified the script so that all arrays hold the number of rows in the first row. I have modified the PCRE so the search pattern has to be found at column 1 of each record I have added some debugging code. Can easily be removed #include <Array.au3> #include <File.au3> ; Documentation: ; All arrays store the row/column count in row 0 Global $aArrayInput, $aArrayOutput, $aMat Global $sDir = @ScriptDir Global $sFileName = '*' Global $sFileExtension = 'texture.dds' ; or '*' for all files or 'pdf' for just PDFs Global $sListPath = @ScriptDir & '\TextureList.lst' Global $sFind = 'textures\cperrella\fabric\cloth_knits\wrinkles_01_n.texture' & '.dds' Global $sMatInput = @ScriptDir & '\civ_female_act3.model_materials.txt' $aArrayOutput = _FileListToArrayRec($sDir, $sFileName & '.' & $sFileExtension, 1, 1, 0, 2) ; if @error then Exit ConsoleWrite("_FileListToArrayRec: @error=" & @error & ", IsArray($aArrayOutput): " & IsArray($aArrayOutput) & @CRLF) If IsArray($aArrayOutput) Then If Not FileExists($sListPath) Then _FileWriteFromArray($sListPath, $aArrayOutput, 1) ; Do not write the record count to the file _FileSearchInTXT() Else Global $aArrayOutput[1] = [0] ; Modified: $aArrayOutput needs to be defined as an array as _FileListToArray might not return/create the array EndIf _FileReadToArray($sMatInput, $aMat, $FRTA_COUNT) _ArrayDisplay($aMat, "before Moving rows") ; ==> Just for debugging can be removed ; Lines with certain strings should be excluded Global $sExclude = "(?i)^===*|(?i)^---*|(?i)^shader*|(?i)^material*|(?i)^template*|^\s|^ *" $sExclude = StringReplace($sExclude, ".", "\.") ; $sExclude = StringReplace($sExclude, "?", ".") ; REMOVED as it would kill (?i) in the pattern $sExclude = StringReplace($sExclude, "*", ".*?") ; Remove all lines holding on of the $sExclude patterns or empty lines Global $iOutIndex = 1 For $iInIndex = 1 To $aMat[0] If Not StringRegExp($aMat[$iInIndex], $sExclude) And $aMat[$iInIndex] <> "" Then ConsoleWrite("Moved : " & $iInIndex & " | " & $iOutIndex & " | " & $aMat[$iInIndex] & @CRLF) ; ==> Just for debugging can be removed $aMat[$iOutIndex] = $aMat[$iInIndex] $iOutIndex += 1 Else ConsoleWrite("Ignored: " & $iInIndex & " | " & $iOutIndex & " | " & $aMat[$iInIndex] & @CRLF) ; ==> Just for debugging can be removed EndIf Next _ArrayDisplay($aMat, "After moving rows") ; ==> Just for debugging can be removed ReDim $aMat[$iOutIndex] $aMat[0] = $iOutIndex - 1 _ArrayDisplay($aMat, "After ReDim") ; ==> Just for debugging can be removed For $i = 1 To $aMat[0] For $j = 1 To $aArrayOutput[0] If $aMat[$i] = $aArrayOutput[$j] Then ConsoleWrite("Copying file " & $aArrayOutput[$j] & " to " & @ScriptDir & @CRLF) ; ==> Just for debugging can be removed FileCopy($aArrayOutput[$j], @ScriptDir, $FC_NOOVERWRITE) Else ConsoleWrite("No match found for " & $aMat[$i] & @CRLF) EndIf Next Next _ArrayTrim($aMat, 17, 0, 1) _ArrayDisplay($aMat, "Array (trimmed)", Default, 8) Exit ;~ ---------------------------------------------------------------------------------------------- Func _FileSearchInTXT() If $sListPath <> '' And $sFind <> '' Then _FileReadToArray($sListPath, $aArrayInput, $FRTA_COUNT) For $i = 1 To $aArrayInput[0] If StringInStr($aArrayInput[$i], $sFind) Then ConsoleWrite("Found file: " & $aArrayInput[$i] & @CRLF) EndIf Next Else MsgBox(48, 'Error', 'A file was not picked or what to find was cancelled/empty!') EndIf EndFunc ;==>_FileSearchInTXT
    1 point
  5. @Siwa AdlibRegister ( "function" [, time = 250] ) is available just for this purpose. You should carefully read the Remarks of the Help file: The adlib function should be kept simple as it is executed often and during this time the main script is paused. AdlibRegister("MyExit") $h = TimerInit() While 1 Sleep(20) WEnd Func MyExit() If TimerDiff($h) > 5000 Then Exit EndFunc
    1 point
  6. Basic comparison logic would be as follows (untested), but as @water said, there are better and more efficient ways of doing it. For $i = 0 To UBound($smallArray - 1) For $j = 0 To UBound($bigArray - 1) If $smallArray[$i] = $bigArray[$j] Then FileCopy("Path\To\Source\" & $smallArray[$i], "Path\To\Destination\Filename.file", $FC_NOOVERWRITE) Else ConsoleWrite("No match found for " & $smallArray[$i] & @CRLF) EndIf Next Next
    1 point
  7. BYTE *bPort, BYTE* inRBuff, *see above
    1 point
  8. #Include <WinAPI.au3> Global Const $SPI_GETMOUSESPEED = 112 ; 0x0070 Global Const $SPI_SETMOUSESPEED = 113 ; 0x0071 ; Get individual setting : Global $g_tMouseSpeed = DllStructCreate('int Speed') _WinAPI_SystemParametersInfo($SPI_GETMOUSESPEED, 0, DllStructGetPtr($g_tMouseSpeed), 0) ConsoleWrite("MouseSpeed (individual) = " & $g_tMouseSpeed.Speed & @CRLF) ; Info : value ranges between 1 (slowest) and 20 (fastest) - 10 is the default ; 1. Set speed to 1 = 'slowest' (for 4 sec.) _WinAPI_SystemParametersInfo($SPI_SETMOUSESPEED, 0, 1, 2) ConsoleWrite("MouseSpeed = 1 ('slowest')" & @CRLF) Sleep(4000) ; 2. Set speed to 20 = 'fastest' (for 4 sec.) _WinAPI_SystemParametersInfo($SPI_SETMOUSESPEED, 0, 20, 2) ConsoleWrite("MouseSpeed = 20 ('fastest')" & @CRLF) Sleep(4000) ; 3. Set speed back to individual setting _WinAPI_SystemParametersInfo($SPI_SETMOUSESPEED, 0, $g_tMouseSpeed.Speed, 2)
    1 point
×
×
  • Create New...