I have an index of listings that need page numbers.
I need to be able to enter a 5 digit number and have the page number that it’s on displayed to me.
I have some of the script below, but I know this will not do what I want.
set ChosenFile to choose file with prompt "Select file to lift numbers from." of type "TEXT"
open for access ChosenFile
set TextRun to read ChosenFile
close access ChosenFile
set CountWord to count (get every word of TextRun)
set NumList to {}
repeat with PointWord from 1 to CountWord
set CurrWord to get word PointWord of TextRun
if CurrWord = "#" and PointWord < CountWord then
set end of NumList to (get word (PointWord + 1) of TextRun)
end if
end repeat
set SourceLoc to choose folder with prompt "Where is the list of numbers located?"
set DestLoc to choose folder with prompt "Select folder to transfer page numbers to."
set CountItem to count every item in NumList
repeat with PointItem from 1 to CountItem
try
set ItemNo to get item PointItem of NumList
set TargetFile to (SourceLoc as text) & (ItemNo as text)
tell application "Finder"
duplicate file TargetFile to folder DestLoc
end tell
end try
end repeat
display dialog "Script finished."