Notifications
Clear all

[Closed] File Read ok but save problem

Hi !!!
I have a problem to save my datas.
I wanna edit a .cws file that is a non encrypted file.
My script is used to open a file find any specific text inside and replace it and save it finally to another file. Everything works except saving.

thefile = (openfile "C:\\e09sr005.cws") -- input
    theArray = #()
    theObject = #()
    thetxt = "" as string
    origShot = "e09sr005"
    finalShot = "e09sr006"
    
    i = 1
    
    while ((not (eof thefile))) do
    (
    	theline = readline thefile
    	if (findstring theline origShot) != undefined then
    	(
    		theline = substituteString theline origShot finalShot
    		print "diferent undefined"
    	)
    	
    	append theArray theline
    	
    )
    close thefile
    --print theArray
    
    
    
    
    if (newTXT = createFile "C:\\e09sr006_eddy.cws") != undefined do
    (
    	
    	for i in theArray do 
    	(
    		thetxt = ""
    		thetxt = (i + "
") as string
    		format thetxt to: newTXT	
    
    	)
    	
    	flush newTXT
    	close newTXT
    )

I have atteched a .zip file with all files inside if someone can help me.

1 Reply

Problem solved. Stupid mistake from me.