Archive: File Write Issue


File Write Issue
Okay, so ive got everythign in the installer, and when I was debugging it to make sure everything worked I noticed that it wasnt writing the files with the correct information;

My code for the write file is the following:

Function asimbridge

!macro WriteLineB LineB
FileWrite $R0 `${LineB}$\r$\n`
!macroend
!define WriteLineB `!insertmacro WriteLine`

Push $R0
FileOpen $R0 `$INSTDIR\ASIMBridge.bat` w
${WriteLineB} '@echo off'
${WriteLineB} 'rem bridge file created Thu, 25 Jun 2009 14:49:20 -0500 by user $uNameRem'
${WriteLineB} 'rem install option: normal install'
${WriteLineB} 'rem browser path: C:\Program Files\Internet Explorer\iexplore.exe'
${WriteLineB} 'rem company directory: $INSTDIR'
${WriteLineB} 'rem automatic login: on'
${WriteLineB} ''
${WriteLineB} 'set PHPRC="$INSTDIR\"'
${WriteLineB} 'if not exist "$INSTDIR\php.exe" GOTO PHPERR'
${WriteLineB} 'if not exist "$INSTDIR\%1" GOTO BRGERR'
${WriteLineB} ''
${WriteLineB} 'GOTO PHPEXEC'
${WriteLineB} ''
${WriteLineB} ':PHPEXEC'
${WriteLineB} '"$INSTDIRphp.exe" "$INSTDIR\upload_bridge_file.php" "$INSTDIR\%1"'
${WriteLineB} 'if ERRORLEVEL 1 GOTO RETERR'
${WriteLineB} 'GOTO END'
${WriteLineB} ''
${WriteLineB} ':PHPERR'
${WriteLineB} 'echo $INSTDIR\php.exe does not exist - please check your bridge configuration'
${WriteLineB} 'GOTO PAUSEX'
${WriteLineB} ''
${WriteLineB} ':BRGERR'
${WriteLineB} 'echo $INSTDIR\%1 does not exist - please check your bridge configuration'
${WriteLineB} 'GOTO PAUSEX'
${WriteLineB} ''
${WriteLineB} ':PAUSEX'
${WriteLineB} 'PAUSE'
${WriteLineB} 'GOTO END'
${WriteLineB} ''
${WriteLineB} ':RETERR'
${WriteLineB} 'echo "Bridge upload failed with error code %ERRORLEVEL%"'
${WriteLineB} 'GOTO PAUSEX'
${WriteLineB} ''
${WriteLineB} ':END'
${WriteLineB} 'EXIT'
${WriteLineB} ''
${WriteLineB} 'EXIT'
FileClose $R0
Pop $R0
FunctionEnd



Now the file is writing correctly, but anywhere it says $instdir it does teh following;

If install directory = C:\ASIM

it will write to the file as: C:\ASIM\ASIM\*


Is there a way to get rid of this duplication?


Check the value of $INSTDIR using a message box. Also your WriteLineB define is inserting the WriteLine macro.

Stu


Yea I ran the MB, and it was correct with the install path....however it is NOT writing to my .bat file.


Is it not possible to write to an executable bat file?


got it......stupid plaguing typo


On a ComboBox, how do you retrieve the selection that they make?

I tried the GetSelection but it just errors out

Any ideas?