Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>AppleScript's <strong>text item delimiters</strong> are used to determine how text is broken apart and/or reassembled. When you get the text items of a string, the string is broken apart at each delimiter, and the result is a list of the pieces. Going the other way, if you coerce a list of text items to a string, the pieces are reassembled with the delimiter used in between each piece.</p> <p>For your example, you could use something like the following (I added a little formatting to get your result):</p> <pre><code>set theList to {¬ "/Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/BODY/: 65", ¬ "/Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/BODY/: RESENDS 0", ¬ "/Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/COVERS/: 23", ¬ "/Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/COVERS/: RESENDS 6"} set finalResult to {} -- this will be the final result set tempTID to AppleScript's text item delimiters -- stash the original delimiters repeat with anItem in theList set AppleScript's text item delimiters to "•" set pieces to text items of anItem -- break apart at bullets log result set theFile to (rest of pieces) as text -- drop the first piece and reassemble set AppleScript's text item delimiters to "/" set pieces to text items of theFile -- now break apart at slashes log result set lastPiece to last item of pieces -- trim the last piece a bit set theCount to 0 repeat while first character of lastPiece is in {space, ":"} set lastPiece to text 2 thru -1 of lastPiece -- trim it set theCount to theCount + 1 -- count up trimmed characters end repeat if theCount &gt; 4 then set lastPiece to tab &amp; tab &amp; lastPiece -- add a little formatting... set last item of pieces to lastPiece -- put the trimmed piece back set text item delimiters to tab &amp; tab set pieces to pieces as text -- put the pieces back together with tabs log result set end of finalResult to pieces -- store the reassembled text for later end repeat set AppleScript's text item delimiters to tempTID -- restore the original delimiters choose from list finalResult with empty selection allowed -- show the results </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload