Convert Classic script to OSX

Hi, would anyone know how to convert this classic script to OSX like?

tell application “Finder”
open selection
select folder “In”
open selection
set theFile to choose file with prompt “Choose”
open for access theFile
set redfile to read theFile using delimiter return
set theBigList to {}
repeat with i from 1 to count of redfile
set theLine to last word of item i of redfile
copy theLine to the end of theBigList
end repeat
repeat with i from 1 to count of theBigList
set ad to item i of theBigList
set filetype to “.eps”
set thisfile to {ad & filetype}
select disk “Display Ads Hires”
open selection
select (every file of disk “Display Ads Hires” whose name contains thisfile)
copy selection to folder “In”
end repeat
close container window of folder “In”
close container window of disk “Display Ads Hires”
end tell

There are several errors in your script. If I’ve correctly understood what it’s meant to do, this should work with any version of Mac OS:

set theFile to choose file with prompt "Choose"
set theBigList to paragraphs of (read theFile from 1)

repeat with i from 1 to (count theBigList)
  set item i of theBigList to (last word of item i of theBigList) & ".eps"
end repeat

tell application "Finder"
  duplicate (every file of disk "Display Ads Hires" whose name is in theBigList) to folder "In"  of desktop
end tell


The code works perfect,

Is there a way for the script to end when it reaches the last line of the text file. Reason for, the script will continue to reapeat its self until it timeout.


I don’t understand what you’re saying. If the script’s working perfectly, then it ends when the files have been duplicated. If you want it to end when it reaches the last line of text, leave out the duplication. The code I posted doesn’t contain any error checks for dodgy text files, non-existent disks or folders, or duplicate file names, but if it hit any of those problems, it would stop with an error message. There’s nothing there that would cause it to keep repeating.