Hidden control characters in file generated by AppleScript?

Hi all,
I've come across a strange problem. I have an AppleScript app (kindly produced for me by a member here) that gets called up by cron, which puts up a dialog box at regular intervals asking me to write down what I am doing (to create an activity log). The log is saved to my Documents folder if it doesn't already exist; otherwise my typing will just get time-stamped and added to the file.
This has been working just fine for several months (years), and now, all of a sudden, AppleScript konks out on me -- it simply crashes. The reason, I discovered, is the log file itself. It gets inflated out of proportions (something like 2.5 Megs where 40K would suffice) because it contains hidden control characters (gremlins) between each letter and zillions of them between words and lines.
When the script opens this inflated file, TextEdit balks ('Application not responding'), which in turn crashes AppleScript.
I discovered these gremlins when I opened the document in Classic mode with Word 5, which allows me to remove them and thus make the file smaller and therefore palatable to TextEdit again.
But that doesn't solve the problem: Every entry continues to be inserted with another load of gremlins, and I can't understand why. I deleted preferences both for TextEdit and AppleScript, and I perform regular disk maintenance.
TextEdit is set to save plain text files, end-of-line is Macintosh style, character set is Western Mac OS Roman. It's always been like this before when it worked ok.
Any ideas?
Thanks in advance.
G4 MDD 1.25 GHz, 768 MB RAM Mac OS X (10.3.9)

Hi Camelot,
The script doesn't specify TextEdit -- it just creates/updates a text file which I then read with TextEdit. Here's the script, and below is the link to the test log:
--STARTOFSCRIPT------------------------------------------
-- Find out if the log file is actually there.
-- We can't get the last entry of a file that doesn't exist.
set fileExists to false
tell application "Finder"
if exists file "MacHD:Users:gisela:Documents:Gisela'sActivityLog.txt" then set fileExists to true
end tell
-- Get the last entry in the log file to present to the user.
-- If the file wasn't there, present a default choice to the user.
if fileExists then
set myLogFile to open for access ((path to documents folder as text) & "Gisela'sActivityLog.txt")
set logFileContents to read myLogFile using delimiter return
close access myLogFile
set lastLogEntry to last item of text items of logFileContents
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to tab
set lastEntry to text item 2 of lastLogEntry
set AppleScript's text item delimiters to oldTIDs
else
set lastEntry to "Nothin' much."
end if
-- Ask the user what they're doing.
set myLogEntry to text returned of (display dialog "So... What're you doing?" default answer lastEntry buttons {"OK"} default button "OK" with icon note)
-- Get the date and time via "Do Shell Script" (for me, easier than mucking with AppleScript's date results).
-- Modified order to Year Month Day# Weekday hour:min:sec [Gisela]
set dateUnix to do shell script "date"
set dateText to word 8 of dateUnix & " " & word 2 of dateUnix & " " & word 3 of dateUnix & " " & word 1 of dateUnix & " " & word 4 of dateUnix & ":" & word 5 of dateUnix & ":" & word 6 of dateUnix & " " & tab
-- Open a log file on the desktop. The file is created if it doesn't exist.
set myLogFile to open for access ((path to documents folder as text) & "Gisela'sActivityLog.txt") with write permission
-- Write a log entry into the file.
write dateText & myLogEntry & return to myLogFile starting at eof
-- Close the log file.
close access myLogFile
-- Script by Bryan K. Vines, Corpus Christi, TX, via Apple Discussion Forum 22/5/04 and 24/5/04
--ENDOFSCRIPT------------------------------------------
Here's the test log => http://www.webalice.it/gisela/TestLog.txt. Had to change the name because my webspace doesn't like apostrophes (').
This phenomenon only occurs in connection with this Activity log script. My gut tells me it's not AppleScript's fault, but I can't figure out where else to look.
Kind regards,
Gisela

Similar Messages

  • Hidden Text in PDF file generated from Ai

    One of my clients (an Ad Agency) has a problem with a PDF file.
    They make the layout in Adobe Illustrator them (to send the file to the newspaper) use the "Save as" menu and use the prepress setting.
    The designer use "Helvetica Neue" the TrueType that came with MacOSX.
    But for a weird reason one letter in the headline dissappear... this one>>>> "É"
    When I check the file in Acrobat 9 and X reports a "Hidden Text".
    Any idea what happen there???
    Thanks a lot

    "Save as PDF" occasionally writes internal links as external links (pointing to a file with the current PDF file name). Such links won't work after the PDF is renamed, even if the PDF is a stand-alone PDF.
    Try printing the book to a .ps file and distilling, instead of "Save as PDF".
    Also see: http://www.microtype.com/Hmmms.html#0702
    Shlomo Perets
    MicroType, FrameMaker/Acrobat training & consulting
    "24 easy ways to improve your PDFs with FrameMaker-to-Acrobat TimeSavers/Assistants",
    http://www.microtype.com/ImprovePDF.html

  • AppleScript puts control characters in txt file, inflating it enormously

    Hi all,
    I've come across a strange problem. I have an AppleScript file that puts up a dialog box at regular intervals asking me to write down what I am doing (to create an activity log). The file is saved to my Documents folder. This has been working just fine for several months (years), and now, all of a sudden, AppleScript fails on me. The reason is, the log file is inflated out of proportions because it contains hidden control characters (gremlins) between each letter and zillions of them between words and lines. Opening one of these files makes TextEdit go crazy ('Application not responding'). I discovered these gremlins when I opened the document in Classic mode with Word 5 (the best application ever to have been produced by MS, which allows me to remove them and make the file palatable to TextEdit again).
    But that doesn't solve the problem: Every entry continues to be inserted with another load of gremlins, and I can't understand why. I deleted preferences both for TextEdit and AppleScript, and I performed regular disk maintenance.
    TextEdit is set to save plain text files, end-of-line is Macintosh style, character set is Western Mac OS Roman. It's always been like this before when it worked ok.
    Any ideas?
    Thanks in advance.
    G4 MDD 1.25 GHz, 768 MB RAM Mac OS X (10.3.9)

    The solution to my problem can be found in the AppleScript forum here:
    http://discussions.apple.com/message.jspa?messageID=2353871
    With many thanks to reese_, who provided the solution, and to Tom, who directed me there!

  • Help writting a file without crlf control characters

    Hi All,
    I have a little trouble when writting a file in UTF-8 format, It's only one string  and this string is writting to a file in UTF-8 format but I need to omitt the CR-LF Control Characters of the file generated.
    OS - HP-UX
    How can I do  this?
    here is the sample code:
    DATA: g_cadena TYPE string,
               g_filcad    TYPE string.
    DATA: l_len TYPE i,
              l_msg TYPE string.
      CONCATENATE '||A|1|2005-09-02T16:30:00|1|ISP900909Q88|'
                  'Industrias del Sur Poniente, S.A. de C.V.|'
                  'Alvaro Obregón|37|3|Col. Roma Norte|México|'
                  'Cuauhtémoc|Distrito Federal|México|06700|'
                  'Pino Suarez|23|Centro|Monterrey|Monterrey|Nuevo Léon|'
                  'México|95460|CAUR390312S87|Rosa María Calderón Uriegas|'
                  'Topochico|52|Jardines del Valle|Monterrey|Monterrey|'
                  'Nuevo León|México|95465|10|Caja|Vasos decorados|20|200|1|'
                  'pieza|Charola metálica|150|150|IVA|52.5||'
            INTO g_cadena.
      l_len = STRLEN( g_cadena ).
      CLEAR g_filcad.
      g_filcad =  '/usr/home/cadena.txt'.
      OPEN DATASET g_filcad
         FOR OUTPUT MESSAGE l_msg IN TEXT MODE ENCODING UTF-8.
      IF sy-subrc NE 0.
        WRITE: / 'Message:', l_msg.
        RETURN.
      ENDIF.
      TRANSFER g_cadena TO g_filcad LENGTH l_len.
      CLOSE DATASET g_filcad.

    Thanks to all.
    I solved by my self.
    Regards

  • Can we control the PDF file name that is generated by BI Publisher based on the content in the input PDF

    can we control the PDF file name that is generated by BI Publisher based on the content in the input PDF?

    No, there isn't. The way you're using the file is not recommended. You
    should use a review tracker to avoid getting in the way of one another.

  • Removing the Control Characters from a text file

    Hi,
    I am using the java.util.regex.* package to removing the control characters from a text file. I got below programming from the java.sun site.
    I am able to successfully compile the file and the when I try to run the file I got the error as
    ------------------------------------------------------------------------D:\Debi\datamigration>java Control
    Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal repet
    ition
    {cntrl}
    at java.util.regex.Pattern.error(Pattern.java:1472)
    at java.util.regex.Pattern.closure(Pattern.java:2473)
    at java.util.regex.Pattern.sequence(Pattern.java:1597)
    at java.util.regex.Pattern.expr(Pattern.java:1489)
    at java.util.regex.Pattern.compile(Pattern.java:1257)
    at java.util.regex.Pattern.<init>(Pattern.java:1013)
    at java.util.regex.Pattern.compile(Pattern.java:760)
    at Control.main(Control.java:24)
    Please help me on this issue.
    Thanks&Regards
    Debi
    import java.util.regex.*;
    import java.io.*;
    public class Control {
    public static void main(String[] args)
    throws Exception {
    //Create a file object with the file name
    //in the argument:
    File fin = new File("fileName1");
    File fout = new File("fileName2");
    //Open and input and output stream
    FileInputStream fis =
    new FileInputStream(fin);
    FileOutputStream fos =
    new FileOutputStream(fout);
    BufferedReader in = new BufferedReader(
    new InputStreamReader(fis));
    BufferedWriter out = new BufferedWriter(
    new OutputStreamWriter(fos));
         // The pattern matches control characters
    Pattern p = Pattern.compile("{cntrl}");
    Matcher m = p.matcher("");
    String aLine = null;
    while((aLine = in.readLine()) != null) {
    m.reset(aLine);
    //Replaces control characters with an empty
    //string.
    String result = m.replaceAll("");
    out.write(result);
    out.newLine();
    in.close();
    out.close();

    Hi,
    I used the code below with the \p, but I didn't able to complie the file. It gave me an
    D:\Debi\datamigration>javac Control.java
    Control.java:24: illegal escape character
    Pattern p = Pattern.compile("\p{cntrl}");
    ^
    1 error
    Please help me on this issue.
    Thanks&Regards
    Debi
    // The pattern matches control characters
    Pattern p = Pattern.compile("\p{cntrl}");
    Matcher m = p.matcher("");
    String aLine = null;

  • Add "Trailing Nullcolls" to sql loader control files generated by OWB

    Hi gurus,
    I've got a problem loading data with SQL Loader. I need to add the parameter "trailing nullcols" into the SQL Loader control file generated by OWB. I don't want to do this by saving the skript on my hard disk and run it manually, so any ideas where I can put this parameter? I am using OWB 10.1 on a windows 2000 machine.
    Thanks
    Stephan

    Hi,
    I found the solution to problem.
    1; Select the mapping where you map your source flat file to a table.
    2; Right click on the mapping and select "configure"
    3; Go Sources and Targets -&gt; YOUR_TABLE_NAME -&gt; SQL*Loader Parameters
    4; Set Trailing Nullcols = true :-)
    Thank you to anyone looking at this problem.
    Greetings
    Stephan

  • Remove control characters in txt file (saved from Excel)

    Hi,
    I have a txt file that contains invisible control characters and I want to remove those characters. I've been thinking of 2 options
    1/ Get the content of the file into a string, then go through each character and basically takes only alphanumeric, new lines, Alt+Enter character (character that is created in txt files in Excel that breaks line). With this approach, I'm stuck on getting the character code for Alt+Enter so if anyone could point out. That helps a great deal.
    2/ Use some pattern matching {ctrnl} or something to remove all control characters. I've tried this approach and it didn't work for me.
    Please help me with this problem. Any help or suggestion is greatly appreciated.

    (saved from Excel) Why not save it as csv?
    trivektor wrote:
    With this approach, I'm stuck on getting the character code for Alt+Enter so if anyone could point out. That helps a great deal.
    You can figure that out with a hex editor or just write a small app that prints int values for each byte, not character, and print the file.
    Presumably you already found the Character class and its methods.
    Edited by: jschell on Sep 22, 2008 4:29 PM

  • [SOLVED] Why are control characters visible in text files??

    Hi,
    If I direct the output of 'ls' to a file like:
    ls > file.txt
    and open the file in a editor such as vi, joe or mousepad, it looks like this:
    [[01;34m22x22[[0m
    [[01;34m24x24[[0m
    [[01;34m32x32[[0m
    [[0mindex.theme[[0m
    [[01;34mscalable[[0m
    [[m
    I just did the same thing on an old slackware box and no control characters are visible. The same for a recent LFS build. I realize I could probably pipe through dos2unix, but it shouldn't be happening anyway. Any input is appreciated.
    Thanks
    -Frank
    Last edited by fianella (2007-10-24 10:37:00)

    at the DOS prompt (sorry, old habits die hard :-) ) type
    alias ls
    and see what the results are.  Compare that against your slackware or lfs builds.  You will probably find that the color= option is different - most builds will not include the color ANSI sequences if you pipe the output, but if it says color=always the color codes will be included in the redirected file.
    Assuming you find an alias for ls that forces color output, you need to find where that is taking place... in your ~/.bashrc file?  in /etc/profile.d?  And change that to alias ls='ls --color=tty' or something sensible like that.

  • Removing unwanted control characters in exported text files

    I am currently evaluating Crystal Reports 2008 to determine applicability to our requirements. I need to export data files to continuous text to be read by other application software. I have successfully created the files but have what I believe to be page feed or end-of-page control characters (small rectangles) in the output. Can someone enlighten me as to how I can suppress or remove these control characters?

    In the export to text options enter 0 for the number of lines per page. This will produce an unpaginated text document without the page control markers.

  • Generate and Write unicode characters to file

    The genearted characters looks OK (up to x00FF) but after writing them to file those characters and their values are different. Also the characters after 0x00FF are not coming proper.
    Any idea?
    Solved!
    Go to Solution.

    You should probably give this page a thorough read if you are intending on using Unicode in your application.  Here is a relevant excerpt:
    ASCII technically only defines a 7-bit value and can accordingly represent 128 different characters including control characters such as newline (0x0A) and carriage return (0x0D). However ASCII characters in most applications including LabVIEW are stored as 8-bit values which can represent 256 different characters. The additional 128 characters in this extended ASCII range are defined by the operating system code page aka "Language for non-Unicode Programs".  For example, on a Western system, Windows defaults to the character set defined by the Windows-1252 code page. Windows-1252 is an extension of another commonly used encoding called ISO-8859-1.
    Windows-1252 gives you characters up to 0xFF (ÿ) but not anything greater than 8-bits (e.g. no 0x0100).  By default LabVIEW only supports these 8-bit characters uses multi-byte character strings--interpretation is based on the current code page selected in the operating system.  You may turn on Unicode through the instructions provided in my first link (it is unsupported and can be a bit buggy on occasion...) to obtain multibyte unicode character support to allow for multibyte characters not in the OS code page.
    Unicode has multiple encodings, and the raw bits for a given character depend on the encoding used.  LabVIEW's limited unicode support appears to use UTF-16LE (little-endian) encoding for anything displayed within the UI.  So to get the characters to show up on the UI, you must enable unicode (instructions shown in my first link) and write the proper UTF-16LE codes:
    UTF-8 is more common and thus easier to work with outside of LabVIEW (e.g. my version of Notepad++ evidently does not support UTF-16LE).  I usually end up using UTF-8 encoded strings for files and converting them to UTF-16LE  for display in LabVIEW.
    The unicode library in my first link has the necessary subVIs for converting between UTF-8 and "Unicode" (i.e. UTF-16LE).
    Best Regards,
    John Passiak

  • WRITE CHARACTERS TO FILE???

    Hi everyone,
    I am working on a VI that has to write some characters into an existing
    file.
    I have used: Open File--> Write to File--> Close File but once it
    writes the desired data to that file it also writes some kind of bug
    which cannot be read once that File is read.
    Therefore I used the Wirte Characters to File SubVI which works ok.
    When the new data comes in it has to replace the old one, this means
    that the APPEND TO FILE option of the subVI is set to FALSE. The problem
    is that everytime my VI runs and generates the new data that will
    replace the old one, it asks me if I want to replace the existing file,
    which is what I want to do.
    My question is, if there is any way to override the prompt window that
    asks if the e
    xisting file will be replaced and perform the "replacement"
    automatically?
    Appreciate any help,
    Horacio Castilleja
    [email protected]

    This is a common problem with using some of the simple VIs that do not
    present all of the common/usefull functions.
    If you "Save As..." the Write Characters to File.vi to another name like "My
    Write Characters to File.vi" and add a boolean control
    to the front panel or boolean constant to the diagram and connect it to the
    "Advisory Dialog? (display:T)" boolean input of the Open/Create/Replace
    File.vi, with a False, it will suppress the dialog box.
    Stu
    Horacio Castilleja wrote in message
    news:[email protected]..
    > Hi everyone,
    >
    > I am working on a VI that has to write some characters into an existing
    > file.
    > I have used: Open File--> Write to File--> Close File but once it
    > writes the desired data to that file it also w
    rites some kind of bug
    > which cannot be read once that File is read.
    > Therefore I used the Wirte Characters to File SubVI which works ok.
    > When the new data comes in it has to replace the old one, this means
    > that the APPEND TO FILE option of the subVI is set to FALSE. The problem
    > is that everytime my VI runs and generates the new data that will
    > replace the old one, it asks me if I want to replace the existing file,
    > which is what I want to do.
    > My question is, if there is any way to override the prompt window that
    > asks if the existing file will be replaced and perform the "replacement"
    > automatically?
    >
    > Appreciate any help,
    >
    >
    > Horacio Castilleja
    > [email protected]
    >
    >
    >

  • Control Characters visible in code view

    Not sure how I managed to turn on this "feature" but when I'm looking at any .cfc file in CFBuilder I see lightly grayed out controll characters (like \n for new line or >> for tab, or ..... for spaces). Not a really big deal, but damned annoying when you're staring at it for a while. Does anyone know how to turn this off?

    I'll share that I point out that and many other little hidden gems in a talk of that name, available online:
    http://carehart.org/presentations/#cfbgems
    I realize you wouldn't have thought to look there for the answer, but I'm saying that if folks using CFB were to check it out, they may learn lots of other little surprises (solutions/features) like that. Hope it helps someone.
    /charlie

  • Apple TV Remote hidden controls

    Are these controls legit? While in know some of these are simple and work on the device without much risk, I don't want to blow my device trying out unknown/new control.
    Restart Your Apple TV
    p><span>This is my favorite tip on this list because I frequently find myself navigating into the Apple TV’s layered Settings screens to restart the device whenever it gets <a href="/glossary/wi-fi" title="Wi-Fi is a way of wirelessly connecting to the internet over a broadband connection." class="lexicon-term">Wi-Fi</a> issues. Well, no more! Simply press and hold the DOWN and MENU button at the same time for six seconds to restart your Apple TV.</span></p>
    h3 dir="ltr"><strong>Sleep Your Apple TV</strong></h3>
    p><span>You can also quickly put your Apple TV to sleep using the remote. Usually it goes to sleep at after a predetermined amount of time passes. To make that happen sooner hold the PLAY/PAUSE for five seconds.</span></p>
    h3 dir="ltr"><strong>Get To Home Screen Instantly</strong></h3>
    p><span>Sometimes you can be knee deep in submenus on the Apple TV, especially when using some third-party channels. The good news is you don’t need to back out of each sub-menu step by step. Simply press and hold the MENU button on the Apple TV remote for three seconds and you’ll be taken to the Home screen right away.</span></p>
    h3 dir="ltr"><strong>Arrange / Hide Channels</strong></h3>
    p><span>For the longest time the layout of the Home screen was fixed, but then in a software update last year Apple finally added the ability for the user to rearrange and hide channels. This no doubt came in response to the increased availability of third-party channels on the Apple TV--some of which a user may never have an interest in viewing.</span></p>
    p>To rearrange channels simply hold down the SELECT button for two seconds. The channel icons will jiggle. Use the DIRECTION arrows to move the selected channel. Or press the PLAY/PAUSE button to hide an channel.</p>
    h3 dir="ltr"><strong>Rewind / Fast Forward At Different Intervals</strong></h3>
    p>Everyone knows you can use the left and right direction pad to skip backwards and forwards, but you can actually use the same left and right buttons on the direction pad to rewind and fast forward at different intervals. Hold the LEFT button to rewind 30 seconds. Press the LEFT button to rewind continuously. Alternate your rewind speeds further by pressing LEFT once each time to cycle through slow, medium, or fast rewind.</p>
    p><span>The opposite applies to fast forwarding as well. Hold the RIGHT button to fast forward 30 seconds. Press the RIGHT button to fast forward continuously. Alternate your fast forward speeds further by pressing RIGHT once each time to cycle through slow, medium, or fast fast forward.</span></p>
    h3 dir="ltr"><strong>Go Slow-Mo</strong></h3>
    p><span>This one is really cool. You can rewind or fast forward through video in slow motion on the Apple TV. To do this simply press the PAUSE button then press the LEFT or RIGHT button to rewind or fast forward in slow motion.</span></p>
    h3 dir="ltr"><strong>View Video Settings</strong></h3>
    p><span>Sometimes you might want to adjust audio or other settings for a video that is already playing. You can use the Apple TV remote to quickly do this by pressing and holding the SELECT button for three seconds while the video is play. This will bring up the video’s settings including subtitles, speaker settings, audio, and closed captions.</span></p>
    h3 dir="ltr"><strong>Mark Episodes As Watched</strong></h3>
    p><span>Many times we have full TV series we’ve bought via the iTunes Store that we watch on the Apple TV. However most of the time we’ve already seen some of the episodes in each season. This tip allows you to use the Apple TV remote to mark episodes as already watched. To do this you need to be in the iTunes TV Shows channel on the Apple TV. Select the episode you want to mark as watched and then press and hold the SELECT button. You can also mark entire seasons as watched by selecting the season and then pressing and holding the SELECT button as well.</span></p>
    h3 dir="ltr"><strong>Pair / Unpair Apple TV Remote</strong></h3>
    p><span>If you’ve got lots of Apple TV’s in your house you may have some remote conflicts. The good thing is you can quickly pair and unpair remotes simply by using...the remote. To pair a remote to an Apple TV press and hold the RIGHT and MENU buttons for five seconds. To unpair a remote from an Apple TV press and hold the LEFT and MENU buttons for five seconds.</span></p>
    h3 dir="ltr"><strong>Switch On-Screen Keyboards</strong></h3>
    p><span>Using the on-screen keyboard is one of the chores of navigating the Apple TV. You’ll use this keyboard whenever you need to enter login information (say, for Netflix) or when you are searching for a show. Thankfully the Apple TV remote has these hidden controls to make using the keyboards easier.</span></p>
    p><span>Press PLAY/PAUSE when entering text to switch between the alpha, numeric, and symbol keyboards. You can also hold down the SELECT button for two seconds to bring up the accented characters and then press PLAY/PAUSE to select the one you want.

    Welcome to the Apple Community.
    If you don't want to use a remote with your computer the easiest thing to do is just to turn the IR off. (System_Preferences/Security/General)
    If you still want to use your computer remote then you must pair your computers remote with the computer AND the Apple TV remote with the Apple TV.
    To pair a remote with a device hold down the menu and FF buttons together for six seconds or until you see a chain icon on screen (best take the computer into another room, or turn it off, when you do this)

  • How can i test if i'm in the EOF of my file text in applescript?

    hello
    i want to known how can i test my EOF of my file text or if i meet "Plan N°" when i read each linesdxhezdcxezkchcochzhejc
    my file text :
    Plan N°1
    94.64%
    MDF_280;;3050;1850;1
    piece;0;0;500;500;0;AAA
    piece;0;504;500;500;0;AAA
    piece;0;1008;500;500;0;AAA
    piece;0;1512;500;500;0;AAA
    piece;0;2016;500;500;0;AAA
    piece;0;2520;500;500;0;AAA
    chute;0;3024;26;500
    piece;504;0;500;500;0;AAA
    piece;504;504;500;500;0;AAA
    piece;504;1008;500;500;0;AAA
    piece;504;1512;500;500;0;AAA
    piece;504;2016;500;500;0;AAA
    piece;504;2520;500;500;0;AAA
    chute;504;3024;26;500
    piece;1008;0;500;500;0;AAA
    piece;1008;504;500;500;0;AAA
    piece;1008;1008;500;500;0;AAA
    piece;1008;1512;500;500;0;AAA
    piece;1008;2016;500;500;0;AAA
    piece;1008;2520;500;500;0;AAA
    chute;1008;3024;26;500
    piece;1512;0;700;300;1;BBB
    piece;1512;704;700;300;1;BBB
    piece;1512;1408;700;300;1;BBB
    piece;1512;2112;700;300;1;BBB
    chute;1512;2816;234;300
    chute;1816;0;3050;34
    Plan N°2
    93.58%
    MDF_280;;3050;1850;1
    piece;0;0;300;700;0;BBB
    piece;0;304;300;700;0;BBB
    piece;0;608;300;700;0;BBB
    i want test
    i : line 1 ok next
    i <- 94... ok -< next
    if i == MDF_280 => loop (exit while EOF or when i == Plan N°)
    do ....
    end loop
    soory but i'm novice in apple script
    and i'm french
    i need to improve my english
    this is my applescript
    repeat with l in lesLignes
    if (l as text) starts with "MDF_280" then
    while ???? (!= EOF or "MDF_280") do ....
    if (l as text) starts with "piece" then .....
    end if
    end if
    end repeat
    THANKS

    property sString01 : "Plan N" -- String to search for.
    property sString02 : "MDF_280" -- String to search for.
    set uFile to (choose file) -- Select file to process.
    set tText to read uFile -- Read contents of selected file.
    repeat -- Cycle through contents of 'tText'.
    set {offset01, offset02} to {offset of sString01 in tText, offset of sString02 in tText} -- Obtain offset locations of 'sString01' and 'sString02'.
    if (offset01 = 0) then exit repeat -- If 'sString01' does not exist, exit repeat loop.
    -- Adjust content of 'tText' as to position of 'offset02' relative to 'offset01'.
    if (offset02 > offset01) then set tText to get (characters (offset02 + (count sString02)) through (count tText) of tText) as string
    set offset01 to (offset of sString01 in tText) - 1 -- Obtain next offset of 'String01'.
    if (offset01 < 1) then set offset01 to (count tText) -- Correct 'offset01' to obtain remaining contents of 'tText'.
    set tmpText to get (characters 1 through offset01 of tText) as string -- Obtain subset content of 'tText' - between 'sString02' and next 'sString01', of end of 'tText'.
    display dialog tmpText -- Display obtain subset of content of 'tText'.
    end repeat
    Since you posted 'how can i read a file text by applescript', and have not replied to others posts; nor marked any reply as 'answered' or even 'helpful'; and, I anticipate you creating a new post asking how to incorporate one of the 'how can i read a file text by applescript' replies into the above (or similar) code - a revised version of 'how can i read a file text by applescript' incorporated within the above code is provided below.
    property sString01 : "Plan N" -- String to search for.
    property sString02 : "MDF_280" -- String to search for.
    property sString03 : "piece" -- String to search for.
    property sString04 : "chute" -- String to search for.
    set uFile to (choose file) -- Select file to process.
    set tText to read uFile -- Read contents of selected file.
    repeat -- Cycle through contents of 'tText'.
    set {offset01, offset02} to {offset of sString01 in tText, offset of sString02 in tText} -- Obtain offset locations of 'sString01' and 'sString02'.
    if (offset01 = 0) then exit repeat -- If 'sString01' does not exist, then exit the repeat loop.
    -- Adjust content of 'tText' as to position of 'offset02' relative to 'offset01'.
    if (offset02 > offset01) then set tText to get (characters (offset02 + (count sString02)) through (count tText) of tText) as string
    set offset01 to (offset of sString01 in tText) - 1 -- Obtain next offset of 'String01'.
    if (offset01 < 1) then set offset01 to (count tText) -- Correct 'offset01' to obtain remaining contents of 'tText'.
    set tmpText to get (characters 1 through offset01 of tText) as string -- Obtain subset content of 'tText' - between 'sString02' and next 'sString01', of end of 'tText'.
    set tPars to paragraphs of tmpText -- Obtain list of 'piece' entries.
    repeat with i in tPars -- Cycle through list.
    if (i begins with sString03) then
    set {var01, var02, var03, var04, var05, var06} to my handle_List(i) -- Obtain individual values.
    -- Your code here.
    display dialog ("Piece: " & var01 & " ... " & var02 & " ... " & var03 & " ... " & var04 & " ... " & var05 & " ... " & var06) -- Code sample.
    else if (i begins with sString04) then
    set {var01, var02, var03, var04} to my handle_List(i)
    -- Your code here.
    display dialog ("Chute: " & var01 & " ... " & var02 & " ... " & var03 & " ... " & var04) -- Code sample.
    end if
    end repeat
    end repeat
    on handle_List(localList) -- Extract values, from each line of data, and place into a list.
    set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ";"}
    set tItems to text items 2 through -1 of localList
    set AppleScript's text item delimiters to oAStid
    return tItems -- Return a list of values.
    end handle_List

Maybe you are looking for

  • Unable to boot Windows 7 Home Premium 64bit dv6

    Hello, I have a HP dv6 that I force shutdown. Upon reboot, it asks me to do a Windows diagnostic and if I select that option, all I see is a blue screen (not the blue screen of death) and nothing else happens. No progress bar, nothing...a DOS window

  • How i can change tablespace of a table in oracle 8.04

    Dear I want to move tablespace of a table in oracle 8.04 version but it is not working my statement is ALTER TABLE ACCOUNTING_ENTRY MOVE TABLESPACE EDI_TSPACE; and got the following error message: ORA-14004: missing PARTITION keyword how i can change

  • Does anyone know why I cant save (dnloaded) form to edit fields with Cute PDF Writer?

    Please Help!!  I am trying to get stuff out to a customer, and I have to keep re-entering information each time.........For some reason after I download a form and complete the fields from internet,  I PRINT/SAVE to Adobe Cute PDF Writer.  Later when

  • A Friend can not down load itunes to his computer has windows xp .

    Has tried several times with no luck. Icon does not appear on desk top ,it appears in cProgram files but does not open when clicked on. Any information would be helpful Lewis C.

  • Clarification on return/restocking policy

    On Dec 13, purchased a Droid 2 global to replace my aging 8830. Roughly 48 hours later I returned it to store and asked to reactivate the 8830. I emphasized my extreme displeasure with the unit's quality. However, on the receipt it states that the re