This is what I have so far & it needs to be fine tuned if possible. I copied the contents of the Excel file into ScriptEditor in the section that says ThreeLetterCodeList. I don’t know how to make the script compare the file names of the jpg folder with the list of 3 letter code. Also I was thinking to delete the items that match but I decided to moved them.
set JPG_Str to "Please locate the folder that contains your JPG files..."
set JPG_Folder to (choose folder with prompt JPG_Str) as text
set JPG_Contents to list folder JPG_Folder without invisibles
set JPG_Roots to {}
repeat with ThisFile in JPG_Contents
set end of JPG_Roots to GetTextItem(ThisFile as text, ".", 1)
end repeat
-->I need to compare the 3 letter code with the choosen folder of .jpgs file names in server. If the 3 letter code matches with part of the jpg file name then move the .jpg to folder in the desktop called Moved files. Below is the list of the 3 letter code names. Example : AAN (Names of the jpg files that matches with the 3 letter code on the server) II_AAN1.jpg, II_AAN2.jpg
set ThreeLetterCodeList to {"AAN", "ABH", "ABT", "AFE", "AGP", "AHM", "AIL", "ALI", "ALV", "AME", "APE", "APP", "APS", "ARE", "ARM", "ART", "ARV", "ARY", "ASH", "ATL", "ATR", "AZR", "AZS", "BAR", "BBL", "BBO", "BBV", "BCC", "BCH", "BCN", "BDA", "BDD", "BDH", "BDY", "BEH", "BEV", "BGA", "BHG", "BHS", "BIO", "BKS", "BLK", "BLM", "BLQ", "BLR", "BLS", "BNT", "BOB", "BOC", "BOH", "BPC", "BRB", "BRY", "BSR", "BSS", "BTF", "BTV", "BVC", "BVP", "BWO", "BWR", "BZY", "CAI", "CBC", "CBF", "CBV", "CCC", "CCE", "CCG", "CCS", "CDP", "CEB", "CEC", "CEM", "CFA", "CFL", "CFZ", "CGH", "CHB", "CHO", "CHS", "CIB", "CIK", "CIM", "CIX", "CLD", "CLH", "CLR", "CMH", "CMO", "CNC", "COB", "COD", "COQ", "COT", "COX", "COZ", "CPE", "CPW", "CQP", "CRV", "CSE", "CTB", "CTC", "CTN", "CUV", "CVA", "CVE", "CVO", "CXM", "CYO", "DAS", "DBC", "DBR", "DEA", "DEL", "DFH", "DIV", "DKH", "DOU", "DPR", "DRR", "DVS", "EAG", "EBY", "ECO", "EDB", "EDG", "EG2", "EHA", "EHL", "EHN", "EHR", "EHS", "ELO", "EME", "ER1", "ERC", "ESS", "EXV", "FHS", "FLR", "FON", "FPC", "FRN", "FRR", "FSP", "FWB", "FWM", "FWT", "FWW", "FWY", "FXH", "FXT", "GBC", "GBO", "GCP", "GG1", "GHE", "GKA", "GMW", "GOH", "Gra", "GRB", "GSB", "GSL", "GTL", "GUV", "GVT", "HAB", "HAR", "HBE", "HBR", "HDL", "HDW", "HEM", "HFL", "HGI", "HGL", "HHP", "HHR", "HHS", "HHV", "HIF", "HII", "HLG", "HLS", "HMA", "HOB", "HOL", "HRF", "HSB", "HSJ", "HTL", "HUE", "IAK", "IDD", "IDP", "IGA", "IGP", "IGR", "ILK", "INB", "IND", "INV", "IOH", "IPI", "IPK", "IPL", "IPS", "IRH", "ISC", "ISL", "IST", "ITS", "JAM", "JGH", "JLH", "KAR", "KBC", "KBI", "KBL", "KBY", "KCE", "KCL", "KCT", "KFI", "KIH", "KJK", "KKS", "KOU", "KPA", "KUH", "LAC", "LAL", "LAS", "LAY", "LBC", "LBO", "LCQ", "LDH", "LEH", "LGS", "LGU", "LII", "LKG", "LKN", "LLE", "LLG", "LLR", "LMK", "LNS", "LOM", "LPQ", "LPT", "LRH", "LSM", "LSV", "LSW", "LVT", "LYC", "MAV", "MBB", "MBK", "MCL", "MEE", "MGK", "MIN", "MKC", "MLH", "MMD", "MNA", "MNH", "MNP", "MPC", "MPO", "MRL", "MRQ", "MRR", "MSC", "MSM", "MTG", "MTO", "MTT", "MUM", "NAE", "NAR", "NCC", "NHI", "NIR", "NOT", "NPP", "NPR", "NRJ", "NSA", "NVE", "NWB", "OAC", "OBC", "OBH", "OCH", "OCR", "OCS", "OCY", "OGT", "OHI", "OIB", "OLH", "ONP", "OTI", "OVL", "OVW", "PAL", "PAP", "PBN", "PBR", "PBS", "PCB", "PCE", "PCV", "PEB", "PES", "PFT", "PGA", "PHH", "PHR", "PIN", "PLE", "PLN", "PLP", "PLR", "PMA", "PMB", "POB", "POK", "POW", "PPE", "PRD", "PRG", "PRT", "PRU", "PSB", "PSD", "PTL", "PTR", "PTY", "PUH", "PVB", "PVO", "PWR", "PWT", "PYA", "PYB", "PZP", "RAM", "RBA", "RBM", "RD1", "REM", "REN", "RHA", "RIA", "RIP", "RMR", "RMT", "ROY", "ROZ", "RPB", "RPD", "RRS", "RRT", "RS2", "RUK", "RVE", "RVV", "RWF", "RWP", "RYH", "RYK", "RYR", "RYV", "SA2", "SAB", "SAG", "SAN", "SB3", "SBC", "SBM", "SBO", "SBQ", "SBS", "SC2", "SCG", "SCK", "SCM", "SCV", "SDG", "SDV", "SEI", "SES", "SET", "SEV", "SEW", "SFR", "SGT", "SHD", "SHE", "SHF", "SHI", "SHO", "SHX", "SIB", "SKD", "SKL", "SLT", "SLV", "SMA", "SMF", "SMQ", "SMX", "SMZ", "SNB", "SND", "SNH", "SNL", "SNO", "SNY", "SPK", "SPQ", "SPS", "SQA", "SRC", "SRE", "SRH", "SRO", "SSH", "SSL", "SSN", "SSP", "STG", "STK", "STQ", "STS", "STT", "SUR", "SUT", "SVB", "SVO", "SVR", "SWB", "SWC", "SWE", "SWT", "TAB", "TAC", "TAG", "TBV", "TCM", "TCS", "TCT", "TCX", "TDN", "TDU", "TJH", "TKR", "TLY", "TMC", "TOL", "TPS", "TPX", "TRI", "TRR", "TSV", "TVI", "TWP", "UCB", "UGA", "UGS", "UJG", "UMH", "VAI", "VAX", "VBG", "VBS", "VCO", "VCR", "VDB", "VDS", "VEN", "VKW", "VLA", "VLB", "VLD", "VLG", "VMT", "VOG", "VPI", "VPK", "VPR", "VSE", "VTF", "WAK", "WAM", "WAV", "WAW", "WBE", "WBR", "WCB", "WDU", "WEC", "WEK", "WEL", "WHA", "WJM", "WKN", "WLB", "WLC", "WLO", "WLP", "WLV", "WMA", "WMD", "WME", "WMM", "WMV", "WMW", "WOR", "WOS", "WPB", "WPC", "WPE", "WPK", "WRA", "WRN", "WSA", "WSC", "WSG", "WSH", "WSR", "WSS", "WTC", "WWA", "WWT", "YL1", "YL2"}
set Warning_Str to "The following operation will move files to a folder in a desktop called Moved Files from Resort Images!" & return & return & "Do you wish to proceed anyway?"
set DWarning to display dialog Warning_Str buttons {"No", "Yes"} default button 2
if button returned of DWarning is "NO" then
beep 4
display dialog "You just Cancel." with icon caution buttons {"Cancel"}
end if
if button returned of DWarning is "Yes" then
tell application "Finder"
if (folder "Moved Files from Resort Images") = false then
make new folder at desktop with properties {name:"Moved Files from Resort Images"}
end if
end tell
end if
on GetTextItem(ThisString, ThisDelim, ThisItem)
-- ThisString -> String to look in
-- ThisDelim -> Text element that delimit the string
-- ThisItem -> Number of the element to return
copy the text item delimiters to OldDelims
set the text item delimiters to ThisDelim
if class of ThisItem is list then
set fromItem to (item 1 of ThisItem) as integer
set toitem to (item 2 of ThisItem) as integer
set arrItem to (text items fromItem thru toitem of ThisString)
else
set arrItem to every text item of ThisString
end if
set the text item delimiters to OldDelims
if class of ThisItem is list then
return arrItem as text
else
if ThisItem is not 0 then
return (item ThisItem of arrItem) as text
else
return arrItem -- return every items
end if
end if
end GetTextItem
try
on error theErrorMessage --theErrorNumber
beep 3
display dialog "Error: " & theErrorMessage & theErrorNumber & return buttons {"OK"} default button 1 with icon caution
end try