17 posts in this topic
More reliable check for file
I'm trying to check for the existance of a file, on logon the file is there, then gets deleted and after a while recreated. I'm using this code:
Sleep(100) If not FileExists($sFile) Then Sleep(150) If FileExists($sFile) Then GUICtrlSendToDummy($iDummy) What happens is this:
User logs on, the file is present, or at least it usually is After about 10 seconds the file gets deleted Then after about 50 seconds the file gets created again, this is when I need the check, because now the process is finished. The above code is part of a pretty long do....until false loop running an animation.
The problem is that sometimes this code fails. Without the sleep statements it didn't work at all so I think this is a timing issue. Pretty primitive code I admit, there must be a better way...
I'm going to build a new function that I have been unable to find. PLEASE CORRECT ME. It will tweak the internal AutoIt functions giving me the ability to trash stuff I do not want to spin around. Get it? Please throw me whatever you got and I will put it togeather. Ship it now.
My supersleep() will be in here somewhere. It's on another thread.
Super Idle Down Process
Hello. I need a trick to make a process idle down less than sleep. I use onevents for almost everything, but the problem is the project I'm working on has almost 50 processes.
Even at around 1% idle it adds up and there will be more processes added. What I'm looking to do is get to a C like idle of .03 to .08 cpu. Any tricks you have will be great and I will post the final code I use. I love AutoIt, but is does need a cooler name, lol. Thx.
running files in order
I'm trying to execute files
I want it to run in order.
for instance, if there's folder like below, I want to run 1.exe > 2.exe > 3.exe
|___folder 1 > 1.exe
|___folder2 > 2.exe
|___folder3 > 3.exe
What I did to do the above, was to make a text file that contains the path to each of those files and put those in array form.
but copying and pasting every path of those files into a text file is very exhausting thing to do when there's like hundreds of files to execute.
So I was wondering if there is a simple way to run those files.
I'd be thankful if anybody answers it.
Help with Nested For loop
I am trying to updated a autoit app that moves files from one location to another. What Ia m trying to do is exclude specified sub directories from being moved/copied or files within the sub-folders
As of now the code doesn't want to execute the nested for loop
Global $szDrive, $szDir, $szFName, $szExt Global $File = "*" func File_mover($Src,$File,$Dst) ; GET DIRECTORY EXCLUDES ; ###################### ; Create blank 2 dem array Local $ExArray ; load ini file Local Const $sFilePath = "exclude.ini" ; Check to see if ini exists Local $iFileExists = FileExists($sFilePath) ; If the INI file is not found, output error message If not $iFileExists Then msgbox(0,"Oh NO!", $sFilePath & " not found!") endif ; Read ini file Local $aArray = IniReadSection($sFilePath, "test") ; Start the array loop If Not @error Then for $i = 1 to $aArray ; Add Ini values into array _ArrayAdd($ExArray, $aArray[$i]) next endif ; Display array ;_ArrayDisplay($ExArray, "test Label") ProgressOn("Moving Scanned File(s)", "Moving scans into citrix...", "0%") $aFiles = _FileListToArray3($Src, $File, 1, 1, 0, 0) For $i = 1 To $aFiles call("_PathSplit",$aFiles[$i], $szDrive, $szDir, $szFName, $szExt) $SrcFile = $Src & "\" & $szDrive & $szDir & $szFName & $szExt $DstFile = $Dst & "\" & $szDir & $szFName & $szExt $NumFiles = DirGetSize($Src,1) ; If File Exsists copy and rename file If FileExists($DstFile) Then $DstFile = call("_IfIdenticalIncrement", $SrcFile, $DstFile) If $DstFile <> "" Then For $ii = $NumFiles To 100 Step 10 ProgressSet($ii, $ii & "%","Moving Files...") ; Move Scans ; List Dir in srouce dir $dirEx = _FileListToArray($Src,"*",2) If UBound($dirEx) > 1 Then ; Look in the dir list array For $dir In $dirEx ; Find and compaire dir in exclude array For $exclude In $ExArray If ($dir = $exclude) Then ; if exclude dir found go to top loop and skip ContinueLoop 2 EndIf Next FileMove($SrcFile, $DstFile, 8) Next endif Sleep(100) Next EndIf ; File doesnt exists so copy the file over Else For $ii = $NumFiles To 100 Step 10 ProgressSet($ii, $ii & "%","Moving Files...") ; Move Scans ; List Dir in srouce dir $dirEx = _FileListToArray($Src,"*",2) If UBound($dirEx) > 1 Then ; Look in the dir list array For $dir In $dirEx ; Find and compaire dir in exclude array For $exclude In $ExArray If ($dir = $exclude) Then ; if exclude dir found go to top loop and skip ContinueLoop 2 EndIf Next FileMove($SrcFile, $DstFile, 8) Next endif Sleep(100) next EndIf ProgressSet(100, "Scans Moved...Successfully!", "Done!") sleep(2000) ProgressOff() Next endfunc Func _IfIdenticalIncrement($vSrcFile, $vDstFile) Local $Count = 0 ; Get the modified date of the source file. $ScrVer = FileGetTime($vSrcFile, 0, 1) ; To get all elemnt of the distination file (in plan to add incremental number). call("_PathSplit",$vDstFile, $szDrive, $szDir, $szFName, $szExt) ; Loop to increment the name of the file. While FileExists($vDstFile) $Count += 1 $vDstFile = $szDrive & $szDir & $szFName & "(" & $Count & ")" & $szExt WEnd ; If file(1), it assume that is the first copy. If $Count = 1 Then Return $vDstFile ; If file(x-1) is identical then assume the file is already duplicated. ElseIf $ScrVer = FileGetTime($szDrive & $szDir & $szFName & "(" & $Count - 1 & ")" & $szExt, 0, 1) Then Return "" ; Else assume it is a new version. Else Return $vDstFile EndIf EndFunc ;==>_IfIdenticalIncrement
This part is skipped and not sure why
For $exclude In $ExArray If ($dir = $exclude) Then ; if exclude dir found go to top loop and skip ContinueLoop 2 EndIf Next INI file is this
[test] EXCLUDE1=test1 EXCLUDE2=test2 EXCLUDE3=test3