I have a file that needs to be changed. The next file works but if you put thesame code into a bigger file it doesn't work.
How come so???
This below is the small file
FileRead doesn't work with big files
8 posts
This is the big file
Problems found in the big script:
No need to copy $INSTDIR to $4 and then compare it to $INSTDIR...StrCpy $4 "$INSTDIR" StrCmp $4 "$INSTDIR" 0 +7
You forgot the back-slashes in this line.ReadRegStr $0 HKLM SOFTWAREMicrosoftWindowsCurrentVersion VersionNumber
You get the temp file name into $R0 and then open $R1. That should expain why the big script doesn't work.GetTempFileName $R0 FileOpen $8 $R1 w
I have tried them all but it still doesn't work i only get a empty file if i extract more than ten files 🙁
Are you sure that changing
What do you mean by extracting more than ten files? That doesn't make any sense... Does it work if you extract only 9?
FileOpen $8 $R1 w toFileOpen $8 $R0 w doesn't help?What do you mean by extracting more than ten files? That doesn't make any sense... Does it work if you extract only 9?
It works if i extract only 9 files but from 10 or more files i will only get an emty file.
Maybe a bug???
Maybe a bug???
By extracting more then 10 files do you mean putting more files in the dir you do File /r *.* from?
Attach the new script please.
Attach the new script please.
I have got it
You must first edit the file and then rename it, then extract the other files and after that you must copy the renamed file to the right position and delete the renamed file
Then it works! 😁
But thanks anyway 🙂
👍 File /r "C:\Program Files\Achievo\Apache2\conf\httpd.conf"
FileOpen $3 "$INSTDIR\httpd.conf" r
GetTempFileName $R0
FileOpen $1 $R0 w
loop:
FileRead $3 $2
IfErrors done
StrCmp $2 'LoadModule php4_module "c:\Program Files\Achievo\Apache2\php\sapi\php4apache2.dll "$\r$\n' 0 +3
FileWrite $1 'LoadModule php4_module "$INSTDIR\Apache2\php\sapi\php4apache2.dll "$\r$\n'
Goto loop
Push "$INSTDIR"
Push "\"
Push "/"
Call StrReplace
Pop $0
StrCpy $5 $0
StrCmp $2 $2 0 +8
Push $2
Push "C:/Program Files/Achievo"
Push $5
Call StrReplace
Pop $0
FileWrite $1 $0
Goto loop
done:
FileClose $3
FileClose $1
Delete "$INSTDIR\httpd.conf"
Rename $R0 "$INSTDIR\httpd.conf"
File /r "C:\Program Files\Achievo\*.*"
CopyFiles "$INSTDIR\httpd.conf" "$INSTDIR\Apache2\conf\"
Delete "$INSTDIR\httpd.conf"
You must first edit the file and then rename it, then extract the other files and after that you must copy the renamed file to the right position and delete the renamed file
Then it works! 😁
But thanks anyway 🙂
👍 File /r "C:\Program Files\Achievo\Apache2\conf\httpd.conf"
FileOpen $3 "$INSTDIR\httpd.conf" r
GetTempFileName $R0
FileOpen $1 $R0 w
loop:
FileRead $3 $2
IfErrors done
StrCmp $2 'LoadModule php4_module "c:\Program Files\Achievo\Apache2\php\sapi\php4apache2.dll "$\r$\n' 0 +3
FileWrite $1 'LoadModule php4_module "$INSTDIR\Apache2\php\sapi\php4apache2.dll "$\r$\n'
Goto loop
Push "$INSTDIR"
Push "\"
Push "/"
Call StrReplace
Pop $0
StrCpy $5 $0
StrCmp $2 $2 0 +8
Push $2
Push "C:/Program Files/Achievo"
Push $5
Call StrReplace
Pop $0
FileWrite $1 $0
Goto loop
done:
FileClose $3
FileClose $1
Delete "$INSTDIR\httpd.conf"
Rename $R0 "$INSTDIR\httpd.conf"
File /r "C:\Program Files\Achievo\*.*"
CopyFiles "$INSTDIR\httpd.conf" "$INSTDIR\Apache2\conf\"
Delete "$INSTDIR\httpd.conf"