• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
if (thePath) contains similar text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

if (thePath) contains similar text


  • Subject: if (thePath) contains similar text
  • From: "Brandon Carpenter" <email@hidden>
  • Date: Fri, 13 Jul 2001 09:06:23 -0500

I have a folder with files that have this criteria:

123456789.FC.tif
123456789.BC.tif
123456789.BCB.tif
123456789.DISC.tif

I would like to write to a log file, with the name of each file going to a
differant field
based upon the letters that the filename contains.

----------------------------------------------------------(Snippet)
set folder_object to choose folder
fileList to list folder of folder_object without invisibles
repeat with aFile in fileList
copy (aFile) as string to thePath
copy text 1 thru ((offset of "," in thePath)-1) of thePath to UPCnum
if (thePath) contains "FC" then
set UPC_FC to thePath as string
end if
if (thePath) contains "BC" then
set UPC_BC to thePath as string
end if
if (thePath) contains "BCB" then
set UPC_BCB to thePath as string
end if
if (thePath) contains "DISC" then
set UPC_DISC to thePath as string
end if
end repeat
display dialog UPC_FC & return & UPC_BC & return & UPC_BCB & return &
UPC_DISC as string -- for debugging only

set INTLogfilename to folder_object & UPCnum & "int" as string
set INT_Log to open for access file INTLogfileName with write permission
set eof INTLogfilename to 0
write "100," & UPCnum & return & "111," & UPC_FC & return & UPC_BC & "124,"
& return (opt-L)
& "124," & UPC_BCB & return "22,1,1,0," & UPC_DISC to INTLogfilename
starting at eof
close access INTLogfilename
---------------------------------------------------(end Snippet)

My results look like this:
UPCnum = 123456789
UPC_FC = 123456789.FC.tif
UPC_BC = 123456789.BCB.tif
UPC_BCB = 123456789.BCB.tif
UPC_DISC = 123456789.DISC.tif

I want my results to look like this:
UPCnum = 123456789
UPC_FC = 123456789.FC.tif
UPC_BC = 123456789.BC.tif
UPC_BCB = 123456789.BCB.tif
UPC_DISC = 123456789.DISC.tif

Anyone have a hint?

Brandon


  • Prev by Date: Re: Font Script
  • Next by Date: RE: if (thePath) contains similar text
  • Previous by thread: Selecting files created on a given date
  • Next by thread: RE: if (thePath) contains similar text
  • Index(es):
    • Date
    • Thread