Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text items



Title: Re: Text items
I haven't followed this carefully, but given the naming convention rigidities, wouldn't this work:

set names1 to {"231-001_M.tif", "231-001.tif", "231-001.jpg", "231-001-a_M.tif", "231-001-a.tif", "231-001-a.jpg"}
--
with the assurance of only one "." and only "_M" preceding it to deal with:
set bname to {}
repeat with aName in names1
     
if aName contains "_M" then
            
set bname's end to aName's text 1 thru ((offset of "_M" in aName) - 1)
 
else
           
set bname's end to aName's text 1 thru ((offset of "." in aName) - 1)
  
end if
end repeat

Same answer, anyway.

Adam

At 10:33 PM +0000 1/16/07, kai wrote:
On 16 Jan 2007, at 22:17, I wrote:
Actually, I missed a trick there.

And I was still not thinking straight. Sorry. Please replace that last effort with:

-------------------

to strip_extensions from l to e
   set tid to text item delimiters
set text item delimiters to return
      set l to (l as Unicode text) & return
   repeat
          set text item delimiters to "."
        if (count l's text items) is 1 then exit repeat
        set text item delimiters to "." & paragraph 1 of l's text item -1
               set l to l's text items
        set text item delimiters to ""
          set l to l as Unicode text
      end repeat
      set text item delimiters to e & return
  set l to l's text items
set text item delimiters to return
      set l to text 1 thru -2 of (l as Unicode text)
  set text item delimiters to tid
l's paragraphs
end strip_extensions

set names1 to {"231-001_M.tif", "231-001.tif", "231-001.jpg", "231-001-a_M.tif", "231-001-a.tif", "231-001-a.jpg"}

set names1 to strip_extensions from names1 to "_M"
--> {"231-001", "231-001", "231-001", "231-001-a", "231-001-a", "231-001-a"}

-------------------

---
kai


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/bellac%40accesscable.net
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Text items (From: "Fleisher, Ken" <email@hidden>)
 >Re: Text items (From: kai <email@hidden>)
 >Re: Text items (From: kai <email@hidden>)
 >Re: Text items (From: kai <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.