Problem with formatting the saved text to hard disk

I use a modified code from Macromedia for saving the content of a text filed on hard disk. See code at the end.
The code works fine and a text file is saved in the given location on the hard disk.
The problem is that all of the content of the text field appears in a very long single line.
The line breaks in the text field does not appear at all in the saved text file.
for example:
if the following is the the content of the text filed on the stage:
abcdef
jhijklm
nopqrst
uvxwyz 
then the saved file is like: abcdefjhijklmnopqrstuvxwyz 
No line break happens! How can this be fixed?
Thanks for any suggestions.
HR
******************* Here is the code *************************
--this handler saves the contents of the field into a text file called 'output.txt'
--it over writes anything that is in the 'output.txt' file.
global myFile
on mouseUp
  if objectP(myFile) then set myFile = 0  --Delete the instance if it already exists
  myFile = new(xtra "fileio")    -- Create an instance of FileIO
  openFile (myFile, the moviePath &"output.txt",0)--Open the file with R/W access
  delete(myFile) --deletes the file
  createFile (myFile, the moviePath &"output.txt) --creates the file again
  openFile(myFile,the moviePath &"output.txt,0) --Open the file with R/W access
  mySaveString = member("input").text --puts the contents of the field 'input' into the variable mySaveString
  writeString(myFile,mySaveString) --writes text to the file
  closeFile(myFile) -- Close the file
  myFile = 0 -- Dispose of the instance
end

You need to replace the carriage returns (that aren't followed by a line feed) with the CRLF combination. Feel free to place the following JavaScript handler into a movie script and call it prior to writing your string to disk:
function jsStringToDOS (str) {
  return str.replace(/(\x0D)(?!\x0A)/g, "\x0D\x0A");
global myFile
on mouseUp
  if objectP(myFile) then set myFile = 0  --Delete the instance if it already exists
  myFile = new(xtra "fileio")    -- Create an instance of FileIO
  openFile (myFile, the moviePath &"output.txt",0)--Open the file with R/W access
  delete(myFile) --deletes the file
  createFile(myFile, the moviePath &"output.txt") --creates the file again
  openFile(myFile,the moviePath &"output.txt",0) --Open the file with R/W access
  mySaveString = member("input").text --puts the contents of the field 'input' into the variable mySaveString
  mySaveString = jsStringToDOS(mySaveString) -- convert to Windows CRLF characters
  writeString(myFile,mySaveString) --writes text to the file
  closeFile(myFile) -- Close the file
  myFile = 0 -- Dispose of the instance
end

Similar Messages

  • Problem with retrieve the chinese text from oracle DB

    my running enviroment is
    Linux 6.0+ apache Jserv+java 1.1+oracle 8.05
    my db character set is zhs16cgb231280.
    when i retrieve the chinese text using servlet and forward to client browser. it doesnt display the text property.but if i transfer the data to an Applet. it will be ok.
    my knowledge is oracle using unicode to communicate between db and JDBC.
    So i dont know how to solve my problme.
    Who can help me?
    Thanks Advanced

    Hello,
    What's the charset of your database? Mine is AMERICAN_AMERICA.UTF8
    In this case, I could successfully insert and retrieve the Chinese characters without any encoding parameter in the getString() method. Perhaps you could try it.

  • Does formatting the macbook pro's hard-disk many times harms it?

    Hello everyone,
    I want to format my macbook pro, but before i do the formatting, because i formatted it before many times
    So, does formatting the hard disk many time reduce the performance of the hard disk? and makes it less doing its jobs than before?
    or it is fine to do format as many times as i want? Because i want to install the system again
    Thanks guys

    You shouldn't have a problem. If you do it a lot (but a lot) of times maybe your hard drive could have some problems. But when you format the disk the only thing you do is restarting the partitioning table. If you securely erase your content all disk will be set to 0 values and maybe will have better performance.
    You shouldn't worry about it. If you use a SSD you shoud consider a little more than with a HDD. SSD's havve a number writting cicles. But with a really intensive use for a normal-advanced user a good SSD can last more than 5 years without a problem.
    My experience with a Windows computer tells me that after reinstalling Windows more than 30 times, in all benchmarks HDD scores the same.
    With mac I've been more lucky and I only had to reinstall once!
    Go on with your formatting!

  • Problem with Photoshop CS5. Memory and Hard disk space Mac OSX

    Just got CS5 Master Suite.  Whenever I open photoshop it takes a ton of memory 1 gig +. When I open  files it takes up more and more until it takes up all my memory and hard  disk space. I open a simple multi layered file that is 25 megs in size  to work on it. Before I know it photoshop is taking 20gigs+ of my hard  disk space along with 3+ gigs of system memory. Is there a memory  problem in photoshop cs5?
    Thanks!
    Joseph
    UPDATE:
    So I just opened the 25 meg file  in photoshop cs5 and watched my free space on my hard drive go down 8  gigs the instant I opened it. It went from 27 gigs of freespace to 19  instantly. As I open more files and close others it works till my harddrive goes to zero space... stalls the computer big time. Only way to correct it is to quit photoshop cs5 and wait a few minutes for the space to return... and it takes a few minutes for it all to return.
    I am running a Macbook Pro with OSX 10.6., 4 gigs of ram on board.
    anyone else having simular problems?

    http://forums.adobe.com/thread/681490?tstart=0
    Maybe this thread offers some information.
    And have you perused this page?
    http://kb2.adobe.com/cps/404/kb404440.html

  • Anyone has a problem with a Samsung M3 1TB portable hard disk in Mountain Lion?

    I was using this hard disk in Lion with Time Machine, but a while after the update to Mountain his stop to work.
    Anyone has the same problem? I already search in the Samsung/Seagate web site for any problem related, but without any luck.
    If this question is in the wrong community, let me now.
    Thanks for any information
    Vinicius Teixeira Coelho
    PS: Any English correction just tell me =]

    I can no longer even 'see' my Samsung disk in the Disk Utility and I don't know what to do. If I could reformat it and sacrifice the files that I've probably lost that would be ok, as it was my back-up drive. This is frustrating

  • Problem with ownership/privileges of NEW external hard disk

    An external La Cie drive died on me this morning. I replaced it with a brand new one on which I copied all my files from a back-up. Everything went OK. I gave the new disk the exact same name than the one that had passed away and that was enough for QuarkXpress to figure out the correct location of images imported in various documents.
    I then stumbled upon an unexpected ownership/privileges problem with an European piece of software, Ragtime, that will not allow me to do anything but read a document, claiming that "I do not have sufficient privileges".
    I tried to grant myself such "privileges" in the Get Info window, but OS X refuses, stating once again that I do not have sufficient privileges to tinker with the system.
    I am all by myself, I am the owner/administrator of the machine and don't know what to do. I called Apple Care, but they claim that I'm not entitled to any help because a) the problem occurred with a disk not manufactured by Apple and b) the software I was using is not manufactured by Apple.
    Underprivileged
    G5   Mac OS X (10.4.7)  
    G5   Mac OS X (10.4.7)  

    Hi, okapulco. Welcome to the Discussions.
    I presume this is when using Ragtime in an attempt to work with documents on the new FireWire drive. I suspect your former LaCie drive had been set-up as follows:
    1. Open the Get Info window for the FireWire drive.
    2. In the Ownership & Permissons pane, select "Ignore ownership on this volume."
    3. Close the Get Info window.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • Problem in formatting of long text -- line break not recognized.

    Hi ,
    We have a PO smartform in our SRM system and we are facing problem with formatting of long text on the smartform for long texts maintained for the PO.
    for ex, we maintain the long text as --
    "this is long text for item 1.
    1. this is line 1.
    2. this is line 2."
    On the smartform it is displayed as --
    this is long text for item 1. 1. this is line 1. 2. this is line 2.
    So basically, the line breaks in the text are not considered in the smartform .
    Any suggestions on how to fix this issue ??
    Thanks.

    Hello Harmeet,
    Which Std. FM are you using to fetch the PO texts? If the PO doesn't exist in your system, i'm afraid you cannot use Include Texts as mentioned by Harsh.
    As an alternative you'll have to create a table & pass the text lines to it! I don't think SmartForms are not smart enough to identify new-line character.
    BR,
    Suhas

  • Help - The chain of virtual hard disks is corrupted

    I took a snapshot of a VHD that I tried to expand to 40GB. After expanding I tried to restart the VM but got the error that "The Chain of virtual hard disks is corrupted".
    Apparently because I expanded the Parent VHD it threw up this error ( i assume because the snapshot differed in size?)
    This led me to Vhdtool which I ran:  vhdtool.exe /repair parentvhdfile.vhd snapshotvhdfile.vhd /quiet
    This appeared to have run okay. However when I went to restart the VM again I got the error:
    Servername Failed to start
    Microsoft emulated IDE controller failed to power on with error - the chain of virtual hard disks is corrupted. There is a mismatch in the virtual sizes of the parent virtual hard disk and differencing disk.
    Failed to open virtual disks. The size of the vurtua;l disk is not valid.
    etc...
    I notice that my parent VHD = 40GB in size, whilst the Snapshot (avhd) file = 109K
    I think I need your help, I don't know what to do!!

    If you made changes to the parent drive, your chain will be corrupted.  Changes to the parent disk invalidate all the child disk.
    Do you have a backup of the original parent disk?

  • Export to excel with formatting was autowrapping text in a cell

    Export to excel with formatting was autowrapping text in a cell without having to check the can grow option.  When the can grow option is checked it does wrap the text however it spans multiple rows, which causes complications when trying to sort. 
    It worked in:
    ProductVersion=10.0.0.533
    ProductName=Crystal Enterprise 10 Embedded
    Doesnt work in:
    Crystal Reports 10.0 Service Pack 6
    After the upgrade the reports did not autowrap, b/c the "can grow" option was not checked.  I believe this was fixed by "ADAPT00305137 Patch ID: 36479914
    Description:
    When users export to Excel 97-2000 with the page-based format, text fields are wrapped, even when the "can grow" feature in the
    Designer is turned off." .   After we turn the option to grow on it does wrap however it spans across multiple rows.  So I guess my question is there a way for it not to span multiple rows when wrapping text?
    Edited by: dforde on Jan 27, 2010 11:12 PM

    I could be wrong, but I believe the export to excel option exports the database values, and the export to HTML exports the values seen in the sheets. If the database values are stored as seconds, the Excel will see them as seconds, and the data will have to be formatted properly in Excel.
    I haven't toyed around with Excel exports that much, but it might be possible to set up a template or macro in excel that would have the proper formatting, and use it when opening the Disco export.

  • Application Express 3.1 + BI-Publisher + problem with formating numbers

    Hello together!
    I use the Oracle BI Publisher Template Builder for Word (10.1.3.4) to generate RTF-Templates. I upload these templates in Oracle Apex (Advanced support-->BI-Publisher/OC4J as print service).
    It works well, but I have a problem with formating numbers.
    In Template Builder I define following number formats, for example: #.##0 for numbers like 1.454.234 and #.##0,00 for numbers like 54,80
    In Template-Builder Preview it looks well.
    But whatever I do, in use with Oracle Apex dots and comma are allready interchances in the printout.
    That means,
    1.454.234 become 1,454,234 in PDF-Report
    54,80 become 54.80 in PDF-Report
    Other than that, the layout is exactly the same like in Template Builder defined.
    What's wrong?
    Do I have to change any country parameter?
    Juliane

    I also had the same problem. I tried with normal formating of 99g99g999d99 instead of ##,##,##0.00 and it has resulted correct way.

  • HT1918 problem with changing the payment information

    I've got a problem with changing the payment information !!
    when I change them and I followed the instruction , and when I click done
    it says " for assistance, contact iTunes support at " the link " . and nothing
    change , so what should I do ?

    Hi Bart,
       The description of the field VBKD-BSTKD will appear in sales order (VA01/02/03) Header  Order data tab.
    If you notice the text for below one it is PO Number where Number starts with upper-case N and it iis not the one which you changed.
    Also this is a hyperlink to sales header order data screen.
    You need to enhance the code via sales exit to fix this.

  • Problems with software the update with Nokia 6233

    Problems with software the update with Nokia 6233
    Hello,
    I have so far some-paints tries my software to update.
    Each time the update procedure begins, sometime stands then on the telephone “test mode”.
    On the computer wars I the reference in the update manager “connection to the telephone broken off” and wants the update to again start.
    If I change my profile attitudes since that for example, then after a telephone restart again deleted.
    What there can I make?
    GreetingsMessage Edited by adisaily on 24-Aug-2007 09:03 AM

    It sounds like your 5800 has the earpiece fault that was common with 5800's made before February.
    You need to take it to a nokia care point for repair under warranty.
    Care points/service centres and repair info:
    UK • Europe • Asia-Pacific • USA •
    Canada • Middle East and Africa
    Elsewhere: Click here, select your country, go to the support section, then select repair.

  • I can not do the update , what should I do to fix this error ? "There was a problem with downloading the file . For tips on troubleshooting , please go to Customer Support . ( Error code : 204 ) ." thanks

    I can not do the update , what should I do to fix this error ?
    "There was a problem with downloading the file . For tips on troubleshooting , please go to Customer Support . ( Error code : 204 ) ." thanks

    Hi,
    Please refer to the help document below:
    Error downloading, installing, or updating Creative Cloud applications
    Regards,
    Sheena

  • Problem with running the midlet class (Error with Installation suite )

    hi everyone...
    i have problem with running the midlet class(BluetoothChatMIDlet.java)
    it keep showing me the same kind of error in the output pane of netbeans...
    which is:
    Installing suite from: http://127.0.0.1:49296/Chat.jad
    [WARN] [rms     ] javacall_file_open: wopen failed for: C:\Users\user\javame-sdk\3.0\work\0\appdb\delete_notify.dat
    i also did some research on this but due to lack of forum that discussing about this,im end up no where..
    from my research i also find out that some of the developer make a changes in class properties..
    where they check the SIGN DISTRIBUTION...and also change the ALIAS to UNTRUSTED..after that,click the EXPORT KEY INTO JAVA ME SDK,PLATFORM,EMULATOR...
    i did that but also didnt work out..
    could any1 teach me how to fix it...
    thanx in advance... :)

    actually, i do my FYP on bluetooth chatting...
    and there will be more than two emulators running at the same time..
    one of my frens said that if u want to run more than one emulator u just simply click on run button..
    and it will appear on the screen..

  • I purchased Microsoft Office for Mac through the Apple website.. I have downloaded all from the disk into my Mac, no problem with all the other Word etc, but Outlook is asking for the key number: I have put it in but its obviously not the right one...????

    I purchased Microsoft Office for Mac through the Apple website.. I have downloaded all from the disk into my Mac, no problem with all the other Word etc, but Outlook is asking for the key number: I have put it in but its obviously not the right one...???? In the box with the disk came the product key, have put it in and it doesnt work. Please help..x

    unfortunately - you can not.  you can't even buy outlook by itself at microsoft's own website.
    does it have to be outlook?  maybe you can get away with using something else that's outlook compatible.
    how about trying Thunderbird for Mac OS?
    or maybe you can call apple and let them know you purchase the wrong version - they might give you a break and just pay the difference for the home and business version.
    good luck

Maybe you are looking for

  • Jabber and windows 8

    I have jabber running on a windows 8 machine. I can't get deskphone video to work. Also when using a wireless usb headset my voice will not work. The voice will work if I use wired headset. Does anyone know when windows 8 will be supported, or when a

  • Exceptions in a loop

    I have a quartz job which calls my status service to update the status multiple items in a loop. Like I have 5 items whose status I want to update with the job. the job iterates collection of items and calls update item , now for some reason a item u

  • When I import pictures from my camera into iPhoto, does it import the original photo size?

    I've been importing pictures from my camera & my phone into iphoto, but I'm not sure if it's automatically importing it as the original file size and not changing it into a smaller photo... Is there a way I can check this? Thanks in advance for your

  • REQUEST: Eval access of data in regions

    Hi all, I would like to propose a change, that I think I've briefly mentioned before. But want to get it on the radar as I'll be very shortly providing a working implemention in my patched version of Spry. At times, I need to have a region to spit ou

  • MenuBar Transitions...

    I need to make my MenuBar fade its items in rather than scale them in. How do I go about doing this? I've looked into the showEffect and hideEffect tags,but they're not doing much.