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

Similar Messages

  • How can I test a NT service from the outside process?

    We have an application that have an unknown problem (we actively search at this moment). The problem is such that the service associated with it seem to "freeze". The application is not responding to any demand (jsp,rmi) and the logs are not coherent BUT the service is up and running... )-:
    Is there a way in java that I can test if an NT service is'nt fully fonctional?
    My other option is to create an small java application (thread) who ask for the login page (login.jsp) after an X time interval. If the login page is returned correctly (HTTP OK), it's ok (sleep). Otherwise, I need to restart the service.
    Is the a way to stop and start an NT Service from my application?
    Thank's a lot, your help will be VERY appreciated.
    A friend really in trouble

    Is the a way to stop and start an NT Service from my
    application?Sure. Figure out what you would type at the command line to do that (something like "NETSTART Something") and use Runtime.getRuntime().exec() to execute that command.

  • How can i stop my family getting having the option of getting my text messages

    We have a family itunes account, recently I discovered that my children started receiving my text messages on their iphones.  I have removed the option of where the messages can be reached in the imessage settings.  But I don't like that they can access it if they want.  Should we have our own itunes account and is there a way we can share our music as we do at the moment.

    http://kb.mozillazine.org/Duplicate_messages_received

  • Illustrator CS 6 won't paste into a text box/paragraph of text, instead pastes a new line of text in the upper left corner of my document. How can I get it to paste into the selected paragraph or highlighted text like normal?

    I've done it a million times, I copy a selection of type...I select the type that I want to replace it with, and then I paste. Now, Illustrator will only paste the text as a "point text" (a single line) somewhere else on the artboard—it seems to always be the upper left corner of the art board.

    peg,
    In cases of sudden appearance of strangenesses, the list may be relevant, hopefully the easy part at the top.
    The following is a general list of things you may try when the issue is not in a specific file (you may have tried/done some of them already); 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
    If possible/applicable, you should save current artwork first, of course.
    1) Close down Illy and open again;
    2) Restart the computer (you may do that up to at least 5 times);
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
    4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible);
    5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
    Even more seriously, you may:
    6) Uninstall, run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • How can I test my thunderbolt port? It's not working after the update to 10.10.1

    I have been using my computer with the Thunderbolt Port for a while and after updating to 10.10.1 and after I while of using my computer I tried to use the thunderbolt port with my external monitor.. and it doesn't work at all.. video doesn't come out.. I tried a different screen with the mini adapter from thunderbolt to HDMI and another with thunderbolt to VGA and in both adapters I don't get video from my mac.
    Any idea how can I test my Thunder bolt port?
    This is what I have done:
    1 cable adapter thunder bolt to mini HDMI to an LCD screen with HDMI : No video, but my computer detects that there is something connected
    2 cable adapter thunder bolt to VGA to an LCD screen with VGA : No video, but my computer detects that there is something connected
    3 cable adapter thunder bolt to mini HDMI to an 40' TV with HDMI : No video, but my computer detects that there is something connected
    All the test pass from the Hardware test at the startup (press D at boot time).
    Any ideas? my guarantee it's expired and no coverage. Due the nature of where the port it's installed, if this is a hardware problem seems that I will (may be) have to buy the Logic Board.. no good. No bueno!!
    Thanks!!!

    restore iPhone

  • How can I test a RTP(send&receive) application on the same computer?

    I an writing an application that lets one computer (A) sends a media file to another computer (B) and B receives it and play it.
    But how can I test this application on the same computer
    Eg.Transmitter: localhost 43000
    Receiver: localhost 43000
    It will retuen an error since the port number is alreeady used by another program.
    I know if I test it on different computers, it should be fine, but how can I test it on the same computer?

    JMStudio sends RTP packets from the same UDP port as the specified in the destination port, so you can't try it in the same computer. The examples provided in http://java.sun.com/products/java-media/jmf/2.1.1/solutions/index.html follow this rule aswell, but it's easy to modify it:
    rtpMgrs[streamid]=RTPManager.newInstance();
    localAddr = new SessionAddress( InetAddress.getLocalHost(),localDataPort);
    //By deafault, in the examples, they use  remote DataPort instead of localDataPort.
    //You can specify localDataPort to any different free port number, or to
    //SessionAddress.ANY_PORT if you don't mind the port number
    remoteAddr  = new SessionAddress(destIpAddr,remoteDataPort);
    rtpMgrs[streamid].initialize(localAddr);
    rtpMgrs[streamid].addTarget(remoteAddr);

  • How can you test the video card?

    I just got a cinema display and I am having trouble calibrating it.
    I just notice that when I open up bridge CS4 it takes awhile for it to refresh. When I go to film strip view and click on a picture it will not diplay it.
    Then I change views and there is a line down the middle of the display where it gets update but the left side does not.
    Any thoughts on what it could be?
    Video card of is it the monitor?
    How can I test it?

    The only ways I can think of to test the card are XBench and the Apple Hardware Tests (insert Install DVD and restart while holding down 'd')

  • How can i test my vpn connection?

    so recently i decided to test if ver 1.3.0.3 of the quickvpn client would work better with the 1.3.0.5 rvs4000 firmware. i loaded quickvpn to an xp pro computer (freshly built, i might add) and got to work. in order to test the connection, i attempted to piggy back off an unsecured wireless network. this network is on the same ISP network as i am.
    i use dynamic DNS, and the unsecured wireless network could resolve my IP correctly, but for some reason i couldnt connect to my home network from the unsecured network. my router is set to respond to lan requests, but i couldnt ping it. my router passes HTTP traffic to a computer in my network, but i couldnt bring up the webpage. finally, my router responds with the router config page over port 443, and i couldnt bring that up.
    so i used my ISP's dialup service to test. initially, as always, i had a million problems with the vpn client. systematically, i tried to resolve the issues. i installed the patch in the readme for quickvpn. i checked log files to see where stuff was failing. eventually, i could connect to the VPN, but would get that "remote gateway is not responding" crap. i know of a (poor) workaround for this which allows you to "finalize" the connection, but that workaround doesnt allow you to ping around in your network. sometime later, after randomly messing with settings, the tunnel would connect without the workaround. i have no idea what "fixed" this.
    despite all this, my 28.8Kbps connection wouldnt allow me to do anything meaningful on my network. i couldnt connect to the router or to a server of mine (http or fileshare). the only thing i could do was ping internal devices. other requests seemed to "hang" rather than timeout or do anything more concrete. basically, i gave up on testing using dialup, even though my router and the client software confirm a good connection. but i still wasnt convinced.
    next, i figured i could create some type of "DMZ" on my network by placing a switch between my ISP's modem and my router. im not a cisco network professional by any means, but im pretty familiar with networking on a above-average level. that said, despite my best, i couldnt get my quickvpn computer to see my router from the "DMZ".
    finally, i figured i could just test the tunnel while directly connected to my network's lan. bad idea. everything seems to go okay until it locks up on "activating policy". rebooting or otherwise ending the negotiation ends in the computer being unable to do anything anymore. when i try to ping anything, i get "negotiating ip security" ad infinitum. the only way i could fix this was by doing a system restore.
    so here's the question: how can i test my quickvpn connection?why can't i just tunnel through my network? and before you scream that you can't, thegreenbow vpn client has NO PROBLEM connecting to my rvs4000 while connected to my own network.

    Hi Aaron,
    I am going exactly the same thing as you however, I had my cousin buy and install a RVS4000 at his house in Australia.
    I access it from the USA so that I can help manage his Local Area Network, he is just not technical..
    I setup a DDNS client on his RVS4000 so that I can always get to his Router via a domain name rather than a IP address.
    I noticed that you didn't mention anything regarding importing client certificate into the directory of the VPN client on your PC.
    I also noticed I disabled IPSec passthrough on the router in Australia, see the pictures below, not sure why, but the VPN client is working.
    I also did not setup any gateway to gateway VPN tunnels, Only added a client , exported certificate as per the manual, See the last screen capture below.
    You will also note if you view the screen captures that my cousins RVS4000 has not been upgraded to the new code.Is there a reason for that...not really...he's just a user, not really technical.  Also note I have not added any VPN tunnels on my RVS4000.
    I have a reasonably reliable connection between the USA and Australia. I didn;t have to play with any other options, just add users to the VPN client database.
    Your description of the working environment of your PC is missing details on the version of XP, so i will mention the following taken from the software release notes of the RVS4000 ;
    There is a known issue with Windows XP SP2 Firewall.
    ICMP packets are always dropped by the firewall when the firewall is enabled.
    This issue causes the QuickVPN client to be unable to establish a tunnel with the remote QuickVPN server successfully.
    Microsoft has released a patch to fix this issue, which you can get from:
    http://support.microsoft.com/kb/889527/en-us
    After you install the patch, the issue should be resolved. You can also fix this issue by upgrading Windows XP to SP3.
    You cannot plug a PC on the same network as the router for testing, they must be on dissimilar WAN  networks for testing purposes.
    Your remote  PC VPN client will not be allocated a IP address in the RVS4000's network, hosts behind the RVS4000 will still respond to pings, as they direct the responses to their default gateway, the RVS4000.
    The thegreenbow VPN client is a distracter at this point costing 50 something EURO  for a license, lets try to get the quickVPN client working !
    So, if you still wish try the following, firstly make sure your XP has been upgraded to  SP3;
    1.  If you upgraded your router to the new version of code, then reset your router to factory defaults to re-initialize your router, yes start again.
    2.  Export the VPN client certificate to the directory that contains the VPN client.  In my case it is;
               "C:\Program Files\Cisco Small Business\QuickVPN Client"
    3.  add a VPN client account to the router
    4.  Use port 60443 from the quickVPN client. and try  VPNing to the router.
    5  hmmm, if the client still fails try disabling IPSec Passthrough on the router for grins and giggles.
    If this fails, call the SBSC at the following location for resolution;
    http://www.cisco.com/en/US/support/tsd_cisco_small_business_support_center_contacts.html
    good luck ...regards Dave

  • How can I test my Query As A Web Service?

    Hi,guru:
        I have created my Web Service based on universe which based on SAP BW query using Query As A Web Service Designer, but when I use it in Dashboard on BOBJ platform by passing a parameter to the Web Service, it seems no response from the Server,I made 2 test steps:
        1.Pass a value to the input parameter,I checked by ST01 in BW Server and see no records of the action, and no result return.
        2.Pass a blank to the input parameter,I checked by ST01 in BW Server and got many records,and all data be retrived.
        It seems that when I passed the parameter,the Web Service seems no response and didn't run at all. Is there anybody who can tell me how can I test the Web Service,I want to test it and input my parameter.
        Thanks very much for your quick response.
    Best Regards
    Martin Xie

    Hi Martin,
    Check the following link which might be helpful:
    1657208 - "No object returned; you either have not put objects in the result pane or your query is incorrect" when using QAAWS and KEYDATE variable in BI4.x
    How to use Prompt in xcelsius of BIWS
    Regards,
    Noopur

  • How can I test my discrete graphics card in an MBP Retina?

    How can I test the hardware on the discrete Nvidia grpahics card in my late 2012 MBP Retina? 
    I've had a *lot* of problems with it which I won't repeat here but the latest fun thing it's doing is crashing and requiring a hard reset any time *anything* attempts to access the discrete graphics card.  This includes but is not limited to:
    *Opening system profiler and clicking on Graphics (it displays a blank screen)
    *Running a 3D graphics benchmark
    *Running intensive mathematical calculations on the GPU
    *Connecting to an external monitor with the thunderbolt port and using the computer for a short period of
    None of these things actually work and after unsuccessfully attempting any of them the computer becomes very unstable shortly there after and usually crashes and requires hard reset.  One time I got a crash report that said something about GPU panic. 
    Any recommendations?  I get the sense that the apple hardware test is not doing a thoroough test of the GPU if at all.
    Thanks.

    If they add OSX support for this product and it comes in at a reasonable price point, it could be an attractive solution.
    http://www.anandtech.com/show/5352/msis-gus-ii-external-gpu-via-thunderbolt
    Also, there are products from other companies that allow connection to PCIe cards through thunderbolt.  These two are geared more towards professional use (Audio/Video I/O cards).
    http://www.sonnettech.com/product/echoexpresschassis.html
    http://www.magma.com/thunderbolt.asp

  • How can I test for the bas unit enterd in a control?

    How can I to create a polymorphic vi where the user can enter either volume or temperature.
    how can Labwiev test for the base unit entered
    pseudocode example:
    input X
    if X.base_unit == m^3 do ....... 
    thanks for any suggestion to resolve or avoid my problem
    Solved!
    Go to Solution.

    Hi schaerm,
    you have to dig deeper.
    An idea is this one:
    The red marked word is containing the unit - in a coded way. Somewhere in the LV help you can find the description of this coding (I remember a chapter on memory representations of all LV datatypes...). (There surely is an easier or better way - but the example is done quic&dirty.)
    You can also format the number into a string and analyze the unit here...
    Message Edited by GerdW on 02-07-2010 07:21 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How can I test the HBA driver?

    Hi. I'm a graduate student majoring in Computer Science.
    I'm interested in writing driver drivers, especially SCSI driver driver. I modified HBA driver and compiled. but I don't know how to test it
    To my thinking because HBA driver is automatically loaded when boot, I can't replace it with my driver. Is it right?
    How can I test it ? Is kenel compiled with new driver???
    Thank you in advance.

    HBA driver is a loadable module and it is HBA-specific, i.e. it is written for a particular type of the controller hardware. It is not clear, if you have modified a driver for you boot device controller of some other HBA. Do not replace your original driver used for booting - you may not boot you system! You may add to your system the HBA for which your new driver is written and then debug it on a live system.
    You will find a lot of information about driver development and debugging in the on-line manual "Writing Device Drivers" posted on http://soldc.sun.com/developer/support/driver/IO_kit/PCI.html web page.

  • How can i test the boolean state of button action?

    Hello,
    in as2.0, how can i test the boolean value if a button was
    pressed or not?
    I have a simple function im trying to work with like this...
    button_btn.onRelease = function (success:Boolean) {
    if (success) {
    trace("we pressed the button - value is true");
    else {
    trace("value is false");
    working with booleans in this way is new to me - any pointers
    will do - thanks!

    Well, I'm not really that familiar with using video in flash,
    but from what I understand of what you are going for, these are my
    suggestions:
    If the code within your button has scope of the variable you
    are testing for:
    _global.myInfoObject;
    button_btn.onRelease = function(){
    if( myInfoObject.code == (value your are testing for) ) {
    trace("value is correct);
    } else {
    trace ("value incorrect");
    if you aren't in scope you can always maybe forward the
    onRelease function to some handler that is in scope:
    var myInfoObject;
    var release = function(){
    //to do code here;
    button_btn.onRelease = release;
    I hope some of these ideas help a little.
    You can always send your .fla to my email at
    [email protected] and I'll take a look at it.

  • HT202213 Why would my Apple TV suddenly stop recognizing my library.  Nothing has changed.  How can I test the Apple TV.  I have the latest updates.

    Why would my Apple TV suddenly stop recognizing my library.  Nothing has changed.  How can I test the Apple TV.  I have the latest updates.

    Could have to do with home sharing. Try turining off and then back on home sharing on your AppleTV.

  • How can i test and adjust my speakers plea

    Hi
    This is my setup:
    Creative X-Fi Xtreme Music Retail
    on
    Logitech Z-5300e 5. speaker system.
    What i need to know is how can i test my 5. speaker system
    using the creative software in order to check if each channel is working properly.
    I did not install the retail driver software that came with my package.
    I only installed the latest creative x-fi standalone driver ( 42MB ) from the update site and mediasource plus Go. I can't find the creative sound mixer to check my speakers.
    I also need to find a software that lets me adjust or calibrate my setup for optimal performance.
    I noticed on the x-fi quickstart guide there is a software called "mode switcher", which includes neat looking software for each mode... where can i find that program ?
    I appreciate your help.
    Thank you.

    You need to install the apps and possibly drivers from the CD first and then upgrade to the web drivers. For testing your speakers the apps are necessary. However, Start->All Programs->Creative->Creative Audio Console should let you change modes.

Maybe you are looking for

  • Labview 6 xmathtypes.dll missing

    Hi,      I am trying to run Matlab script (Matlab version I think it is the latest one) from Labview 6.1. Initially it wasn't running. Then I came across this thread http://digital.ni.com/public.nsf/websearch/CE309627064A3D5686256A9C005B0A5F?OpenDocu

  • Error : Opening a rowset for "Sheet$" failed. Check that the object exists in the database.

    Hi, i am trying to load the data from excel sheet using For each loop container in ssis 2005. But it gave me the below error: Error: Opening a rowset for "Sheet1$" failed. Check that the object exists in the database. [DTS.Pipeline] Error: "component

  • Selection and Type Tools not working in InDesign CC for Mac

    I have just recently downloaded InDesign CC (I use Mac OSX.9.2) and got the World Tools plugin to typeset in different languages. However, I am having trouble using the selection and type tools. In about the first half of the file, the type tool disp

  • How to read Filename using FileAdapter

    I am trying to write some xml files using FileAdapter of SOA11g. For that I have created synchronous BPEL process. My xyz.jca file looks something like this: <endpoint-interaction portType="Write_ptt" operation="Write"> <interaction-spec className="o

  • Large mail box (87GB total) how can I delete the data?

    I have a mail box that has a total of 87GB of data. The content is no longer needed. How do I delete the content but not the mail box?