Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
STRTRAN not working
Message
From
12/06/2003 16:23:56
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00799472
Message ID:
00799560
Views:
27
Everyone caught that mistake but me today! :o) Thanks Gerald.

>You dont assign the result of STRTRAN, that was the main problem :-)
>
>BTW, why do you scan char by char?
>
>
>lcline=""
>lccode="REM Test.txt"+CHR(13)
>lccode=lccode+"COPY %1 <<IMPORTPATH>> <<IMPORTFILE>>"
>BG_ACCUWIN="C:\FOXPRO\TMP\"
>m.handle=FCREATE("test.txt")
>lcLine=STRTRAN(lcCode,"<<IMPORTPATH>>",BG_ACCUWIN)
>lcLine=STRTRAN(lcline,"<<IMPORTFILE>>","ACCUWIN.TXT")
>FPUTS(m.handle,lcline)
>FCLOSE(m.handle)
>MODIFY COMMAND test.txt
>
>
>
>>Ok, then why doesn't this work?
>>
>>clear
>>lcline=""
>>lccode="REM Test.txt"+CHR(13)
>>lccode=lccode+"COPY %1 <<IMPORTPATH>> <<IMPORTFILE>>"
>>BG_ACCUWIN="C:\FOXPRO\TMP\"
>>m.handle=FCREATE("test.txt")
>>FOR i = 1 TO LEN(lccode)
>>	IF ASC(SUBSTR(lccode,i,1))=13 .OR. ASC(SUBSTR(lccode,i,1))=13
>>		lcline=lcline+CHR(13)+CHR(10)
>>		? lcline
>>	ELSE
>>		lcline=lcline+SUBSTR(lccode,i,1)
>>		IF "<<IMPORTPATH>>" $ lcline
>>			?"Original lines: "+lcline
>>			STRTRAN(lcline,"<<IMPORTPATH>>",BG_ACCUWIN)
>>			?"New Lines: "+lcline
>>			?"******************************"
>>			WAIT WINDOW "Found <<IMPORTPATH>>"
>>		ENDIF
>>		IF "<<IMPORTFILE>>" $ lcline
>>			?"Original line: "+lcline
>>			STRTRAN(lcline,"<<IMPORTFILE>>","ACCUWIN.TXT")
>>			?"New Line: "+lcline
>>			?"******************************"
>>			WAIT WINDOW "Found <<IMPORTFILE>>"
>>		ENDIF
>>	ENDIF
>>ENDFOR
>>=FPUTS(m.handle,lcline)
>>=FCLOSE(m.handle)
>>MODIFY COMMAND test.txt
>>
>>
>>>Any idea why the substitute is not working?
>>>>
>>>
>>>The line
>>>
>>>IF ASC(SUBSTR(lccode,i,1))=13 .or. ASC(SUBSTR(lccode,i,1))=13
>>>
>>>prevent the code to execute...
>>>
>>>
>>>>
>>>>
>>>>lcline=""
>>>>lccode="COPY %1 <<IMPORTPATH>> <<IMPORTFILE>>"
>>>>BG_ACCUWIN="C:\FOXPRO\TMP\"
>>>>FOR i = 1 TO LEN(lccode)
>>>>    IF ASC(SUBSTR(lccode,i,1))=13 .or. ASC(SUBSTR(lccode,i,1))=13
>>>>        lcline=lcline+CHR(13)+CHR(10)
>>>>        ? lcline
>>>>        IF "<<IMPORTPATH>>" $ lcline
>>>>		STRTRAN(lcline,"<<IMPORTPATH>>",BG_ACCUWIN)
>>>>        ENDIF
>>>>        IF "<<IMPORTFILE>>" $ lcline
>>>>		STRTRAN(lcline,"<<IMPORTFILE>>","ACCUWIN.TXT")
>>>>        ENDIF
>>>>	    i = i+1
>>>>    ELSE
>>>>        lcline=lcline+SUBSTR(lccode,i,1)
>>>>    ENDIF
>>>>	=FPUTS(m.handle,lcline)
>>>>ENDFOR
>>>>=FCLOSE(m.handle)
>>>>MODIFY COMMAND test.txt
>>>>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform