Jump to content

Ultratuga

Members
  • Posts

    8
  • Joined

  • Last visited

Ultratuga's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Perfect. Thanks
  2. This should be easy, but i´m not seeing how... How to read the content of a text file from line 20 until the end? Stringsplit ?
  3. Maybe you´re right, and this can´t be done. I was thinking in trying to split the file in three parts, the string, the code before and the code after. Then create a new file with code before string &replacement String &code after string, but I doubt this will work...
  4. Hi, I´m don´t know if this is a simple or complicated question. I build this script, copy pasting from posts of this forum. I´m trying to replace a string in a binary file. The string I want to replace is "SMT_MAIN.DRW". The script replaces the string well. If I replace the string for one with the same number of characters, everything works great. But if the replacement string is longer or shorter, binary file becomes invalid. Can this be easily solved ? I attached the binary file toosmt_main.7z #include <String.au3> $sInFile = @ScriptDir & "\SMT_MAIN.drw" ; Original in file $Orig = "SMT_MAIN.PRT" $sFind = _StringToHex($Orig) $Insert = "SMT_MAI4.PRT" $sReplace = _StringToHex($Insert) $sOutFile = @ScriptDir & "\SMT_MAIN1.DRW" ; New edited out file _BinaryReplace($sInFile, $sFind, $sReplace, $sOutFile) Func _BinaryReplace($sInFile, $sFind, $sReplace, $sOutFile) Local $FO, $FR $FO = FileOpen($sInFile, 16) ; Open the file in binary read mode $FR = FileRead($FO) ; Read the opened file into a variable FileClose($FO) ; Close the opened file now we've read it $FR = StringReplace($FR, $sFind, $sReplace, 1); find and replace the hex string $FO = FileOpen($sOutFile, 18) ; Open a new empty file in binary write mode FileWrite($FO, $FR) ; Write the data to the new opened file FileClose($FO) ; Close the newly created file. EndFunc
  5. Hi, you´ve done a heck of job there. It´s great for pointing me the way. Now give some time to study the code. Cheers. Jose
  6. Hi. I like your idea, but sometimes I have: file.ext file.ext.10 file.ext.1000 etc... The program starts with file.ext and saves a new file every time I save, incrementing extension.
  7. Too bad, that´s too much for a noob like me. My script dies here . Thank you for your answers, jguinch and MikahS.
  8. Hi everybody, I´m trying to create my first script. Here´s my first problem: in a folder I have 5 files: file1.ext.1 file1.ext.2 file1.ext.3 file2.ext.1 file2.ext.2 In "FileOpenDialog" function is it possible to filter the files just showing the following lines? file1.ext file2.ext I have to hide the numbers and then remove duplicates, I think. Any ideas? Thanks in advance. Jose.
×
×
  • Create New...