Hi,
In your first For loop :
If FileExists Then
DeleteFile << The file exists and is deleted
ElseIf Not FileExists Then
FileCreate << The file does NOT exist and is created
EndIf
The code cannot pass from an If to another one, so either the file exists or it does not.
#include <File.au3>
#include <Constants.au3>
Local $setFiles[13] = [ _
"idsdk.dll", _
"sdk.dll", _
"ProcSafe.exe", _
"Safe.dll", _
"BHOEx.dll", _
"CServer.dll", _
"vDiskBus.inf", _
"vDiskBus.sys", _
"nti.exe", _
"GdiPlus.dll", _
"data\ClientBrand.ini", _
"data\GameSearchCfg.ini", _
"processSafe\ProcessSafe.ini"]
For $i = 0 To UBound($setFiles) - 1
If FileExists(@ScriptDir & "\" & $setFiles[$i]) Then
FileDelete(@ScriptDir & "\" & $setFiles[$i])
EndIf
;the file is necessarily deleted
_FileCreate(@ScriptDir & "\" & $setFiles[$i])
;Sleep(200) ;Why??
FileSetAttrib(@ScriptDir & "\" & $setFiles[$i], "+RSH")
Next
Local $SetACL_Set = "SetACL -on"
Local $copy_permissions = '-ot file -actn setprot -op "dacl:p_c;sacl:p_c"'
Local $remove_permissions = '-ot file -actn clear -clr "dacl,sacl"'
Local $iRead_ex = '-ot file -actn ace -ace "n:Everyone;p:read_ex"'
For $i = 0 To UBound($setFiles) - 1
If FileExists(@ScriptDir & "\" & $setFiles[$i]) Then ;this may be useless as the file is created before
RunWait(@ComSpec & " /c " & $SetACL_Set & " " & @ScriptDir & "\" & $setFiles[$i] & " " & $copy_permissions, "", @SW_HIDE)
RunWait(@ComSpec & " /c " & $SetACL_Set & " " & @ScriptDir & "\" & $setFiles[$i] & " " & $remove_permissions, "", @SW_HIDE)
RunWait(@ComSpec & " /c " & $SetACL_Set & " " & @ScriptDir & "\" & $setFiles[$i] & " " & $iRead_ex, "", @SW_HIDE)
EndIf
Next
MsgBox($MB_SYSTEMMODAL, "Waiting......", "Waiting......", 3)
Br, FireFox.