Need Help with AppleScript

I have a Tab delimited .txt file with 23 columns and several hundred records. FileName is one of the 23 fields.  I also have a folder of .jpg files that match the filenames in the txt file.


I need to read input .txt file and If the StudentID field is not blank, rename the associated .jpg file with the StudentID.jpg and move it to a Processed output folder.


if StudentID field is blank rename the associated .jpg file in the input folder with Grade_LastName_FirstName.jpg and move the file to the “Errors” output folder. The last thing is to produce two txt files as explained in # 3 and 4 below. These new txt files will be reference files to go with each output folder.  The output folders and txt files can be created on the desktop.


Inputs:

1) Operator selected Folder containing .jpg files - default location desktop

2) Operator selected Tab delimited .txt file with 23 columns - first record is header with field names


Input File has the following fields:


SequenceNumber

FirstName

LastName

StudentID

Teacher

Grade

HomeRoom

Custom1

Custom2

Custom3

Custom4

P1

Q1

P2

Q2

P3

Q3

P4

Q4

Retouch

Spray

FileName

GSBR


Outputs to be created by AppleScript - Script will move renamed files to these two folders:

1) Folder named with name of input folder & “_” & “Processed”  i.e.   If input folder is named Branford, output folder would be Branford_Proceessed 


2) Folder named with name of input folder & “_” & “Errors”  i.e., If input folder is named Branford output folder would be Branford_Errors


3) Tab delimited .txt file with fields FirstName LastName StudentID Grade FileName from the input file for each record that has a StudentID. File should be named with name of input Folder & “_” & “Processed”  i.e.   If input Folder is named Branford, output file would be Branford_Processed.txt


4) Tab delimited .txt file with fields FirstName LastName StudentID Grade FileName from the input file for each record that did not contain a StudentID. File should be named with name of input Folder & “_” & “Errors”  i.e.   If input Folder is named Branford, output file would be Branford_Errors.txt


Any help will be soooo much appreciated.


Posted on Jan 7, 2023 11:07 AM

Reply

Similar questions

46 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Need Help with AppleScript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.