Where does the information get fed back to the main script?
I'm breaking down this script create by Jacques Rioux i've had to modifiy it so I can understand it.
I'm trying to find out where the information for this line gets fed from the handler.
-------------------------------------------------------------------------------- ----------------------------------------------------------------------
-- *** find this name in CSV text ***
if existsCSV and (my findNameInCsv(bh_path)) then set isChanged to true-- a check mark was added in CSV text ***
-------------------------------------------------------------------------------- ----------------------------------------------------------------------
on findNameInCsv(f) -- search the exact name from the beginning of each line ***
set {tid, text item delimiters} to {text item delimiters, {":"}}
set tName to last text item of f -- get the filename
set text item delimiters to "."
set thisExt to last text item of tName-- get name extension
set text item delimiters to tid
if thisExt is in extension_list then
set tc to (count thisExt) + 2
set suffix to text -(tc + 1) thru -tc of tName-- get last 3 characters before name extension--> _02
else -- no extension
set suffix to text -2 thru -1 of tName-- get last 3 characters --> _02
end if
tell suffix to set b to it starts with "_" and (text 2 is in "23456789")
try
if b then set sku_only to text 1 thru 16 of tName-- the begining 16 digits, I presume the first 16 characters in the nameon error
set b to false
end try
set WholenameComma to tName & ","
-------------------------------------------------------------------------------- ----------------------------------------------------------------------
if suffix begins with "_" then set WholenameComma to (text 1 thru 16 of tName & ".PSD,") -- the begining 16 digits, I presume the first 16 characters in the nameon error
set b to false
-------------------------------------------------------------------------------- ----------------------------------------------------------------------
set tc to counto'scsvText
repeat with i from 1 to tc
set aRowinSkulist to itemi of o'scsvText
-------------------------------------------------------------------------------- ----------------------------------------------------------------------
if not b and (aRowinSkulist starts with WholenameComma) or (aRowinSkulist starts with ("✔," & WholenameComma)) then -- found
(*set x to ""*)
--Not sure of its purpose
(*or b and (aRowinSkulist starts with WholenameComma or aRowinSkulist starts with "✔," & WholenameComma)*)
if not b then set item i of o's csvText to "✔," & aRowinSkulist
set text item delimiters to {","}
try
set headline2 to text item 2 of aRowinSkulist--get original Name
set x3 to (text item 3 of aRowinSkulist) & "ALTERNATIVE CODE :_" --get alternative Sku
set keyword4 to text item 4 of aRowinSkulist-- get the keyword
try
set WeekNumber5 to text item 6 of aRowinSkulist--get AIR OR SEA RECORD
on error
set WeekNumber5 to ""
end try
end try
set text item delimiters to tid
-- exiftool add the keywords to EXIF
if keyword4 is not "" then do shell script "/usr/bin/exiftool -P -overwrite_original_in_place -keywords+=" & (quoted form of keyword4) & " -headline=" & (quoted form of headline2) & " -source=" & (quoted form of WeekNumber5) & " " & quoted form of POSIX path of f
return (not b)
end if
-------------------------------------------------------------------------------- ----------------------------------------------------------------------
end repeat
return false
end findNameInCsv
Mac Pro, OS X Mavericks (10.9)