FORUMS: list search recent posts

text file export script with strange end of line character

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Daniel Crooks
text file export script with strange end of line character
on Dec 14, 2010 at 10:54:09 am

hi people

I've written a small script to export 3d positional data from a layer to a .txt file ( with a lot of inspiration from Paul Tuersley's AEtoC4D script). I'm using writeln() and all is grand when viewed on a mac (textEdit and BBedit) but when the text file is opened on a PC (in notebook) it doesn't understand the end of line character (presumably \n) and shows a small square with no return. After some research I tried using a "\r\n" on the end of the line as opposed to the writeln() but still no luck, also tried "\r" and "\n" individually but no luck. On the mac all 4 options perform the carriage return, but on the PC i get the same non character. I tried going backwards opening the pc created file on the mac and it looks exactly the same as my mac created version ???

I did notice in Paul's script he had this line - theFile.lineFeed = "macintosh";
I did try swapping in "windows" and "msdos" and commenting out entirely but no luck.

any light that could be shed on this issue would be greatly appreciated.

cheers../daniel


Return to posts index

Dan Ebberts
Re: text file export script with strange end of line character
on Dec 14, 2010 at 6:30:17 pm

Try setting the linefeed to "Unix" (and leave out the \r\n stuff). I think both platforms can read that. Please report back. :-)

Dan



Return to posts index

Daniel Crooks
Re: text file export script with strange end of line character
on Dec 15, 2010 at 4:03:00 am

hi Dan, thanks for the reply.

I tried the "Unix" linefeed but no luck, (also tried lowercase "unix" ) but the non-character is still being inserted into one very long line of text. The one thing I did notice from a "correct" file created in Notepad is that it has a Unicode (UTF-8) encoding. I tried to save as one of text files in textedit with this encoding but it didn't make any difference either...
one last note, though I'm generating the file from AE on a Mac it only needs to be readable on a PC.

cheers../daniel


Return to posts index


Dan Ebberts
Re: text file export script with strange end of line character
on Dec 15, 2010 at 4:23:40 am

Try sticking this in there and see what happens:


theFile.encoding = "CP1252";


Dan



Return to posts index

Daniel Crooks
Re: text file export script with strange end of line character
on Dec 15, 2010 at 4:52:14 am

still no luck with "CP1252" ...


Return to posts index

Dan Ebberts
Re: text file export script with strange end of line character
on Dec 15, 2010 at 6:39:32 am

How big is your script? Can you post it?

Dan



Return to posts index



Daniel Crooks
Re: text file export script with strange end of line character
on Dec 15, 2010 at 6:57:56 am

hi Dan

unfortunately I don't have the script with me right now, but the external file writing code I borrowed from Paul's AEtoC4D script which is here:
http://www.btinternet.com/~paul.tuersley/scripts/pt_AEtoC4D_v1.4.zip
that script is also what I have been using to test your suggestions so i figure it's a safe bet to work with.

cheers../daniel


Return to posts index

Daniel Crooks
Re: text file export script with strange end of line character
on Dec 17, 2010 at 10:41:59 am

and finally... just in case anyone searches there way here in the future, the resolution to the problem was
myfile.lineFeed = "windows"
don't know why it didn't work first time round, maybe i forgot to save between edits, but anyway it works a treat.

many props to Dan Ebberts and Paul Tuersley

cheers../daniel


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]