tonycstech
Новичок
- Сообщения
- 94
- Репутация
- 3
У меня старый код с исползованием _RecFileListToArray
Явно новая версия Autoit убрала эту функцыю.
Чё делать ?
Вот код.
Явно новая версия Autoit убрала эту функцыю.
Чё делать ?
Вот код.
Код:
Func PathSwapsearchName($sDir)
Local $aFiles
$aFiles = _RecFileListToArray($sDir, "*.ini", 1, 1, 0, 2); List all the ini files on this path
For $i = 1 To $aFiles[0]; Now taking each one in turn
Local $sText
$sText = FileRead($aFiles[$i]); Read the file contents
;MsgBox(0, $aFiles[$i], $sText); Display - just for interest
$sText = StringReplace($sText, GUICtrlRead($hStringInput), GUICtrlRead($hReplaceInput)) ;Replace the current path with the new one
If @extended Then; If there were replacements
Local $hFile
;MsgBox(0, $aFiles[$i], $sText) ; Show the new content - just for interest
FileSetAttrib($aFiles[$i], "-H") ;Remove Hidden attribute so it can write to file
$hFile = FileOpen($aFiles[$i], 2); Open teh file and overwrite with the new content
FileWrite($hFile, $sText)
FileClose($hFile)
FileSetAttrib($aFiles[$i], "+H") ;Restore Hidden attribute so it can write to file
Else
;MsgBox(0, $aFiles[$i], "Not Found"); Say nothing was changed - just for interest
EndIf
Next
MsgBox(64, "Information", "All Done", "", $hGUI)
EndFunc ;==>PathSwapsearchName