prefContents saved as a text file, tab delimited
photo1.jpg 109100
photo2.jpg 109101
photo3.jpg 109102
choose a photo named either photo1.jpg, photo2.jpg, photo3.jpg
In naming a photo to an “item of “an” item in a list”, how do I correctly repeat this:
set thephoto to (choose file)
set PhotoDefault to name of (info for thephoto)
set prefContents to (read (choose file))'s paragraphs as list
set PhotoNid to the items of prefContents as list
set NameNidList to (items of PhotoNid) as list
repeat with NameNidList in PhotoNid
set old_delim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {","}
set photoIDnum to text item 1 of NameNidList
set AppleScript's text item delimiters to {" "}
set PhotoName to (text item 1 of photoIDnum)
set StudID to (text item 2 of photoIDnum)
if PhotoDefault is PhotoName then set answer to StudID
end repeat
It will only return the last item’s ID. How can I set this loop up to seek out the correct photoname to match, and then return the ID #?
Yes I agree, this did take a while. I’m in a learning process here, so I work on the projects that appeal to me. I don’t always have the answer, but I try for others sake.
“One day someone in here saved me a thousand keystrokes”
SiTCoM
Thanks again