Hi,
I need to write the follwoing script:
The clipboard has a list of image files separated by a line break (return). The script needs to find all image files with file names that correspond to the last 7 characters of each name (text -1 through -9) in a particular folder in another particular folder on a particular disk. If it does not find them there it needs to look in a different disk and in a different folder and if it does not find them there yet it searches in another folder. If not found - error message.
Then it needs to create a new folder and copy (not move) all files named in the list to that folder. Then it needs to change all file names to the original file names from the clipboard. Example: The clipboard has the following list:
01a1234.jpg
01b2236.jpg
023232.jpg
The script needs to find files named 1234.jpg, 2236.jpg and 3232.jpg (in the correct search order. Then it copies them to the newly created folder and renames them to 01a1234.jpg, 01b2236.jpg, 023232.jpg
I truly appreciate any help with this. I started out but it does not look too good.
Thank you very much
Ken
Here is what I got so far. Next the script needs to search the folders and copy files it finds to the correct folder. If text -9 of fileNamesLong is a letter than it should move the files to the folder named 5x7. Otherwise it needs to move them to folder named 8x10. If it does not find them then it should move to the next particular search folder and so on… Thank you very much
global folder5x7
global folder8x10
global clientFolder
global foldername
global fileNames
tell application “FileMaker Pro7”
tell current record of database 1
set foldername to cell “FullFolderName”
set x to cell “selections”
selections are
end tell
end tell
set text item delimiters to return
set fileNamesLong to text items of x
set counter to 1
set fileNames to {}
repeat with i in fileNamesLong
set fileNames to (fileNames & text -4 through -8 of item counter of fileNamesLong)
set counter to counter + 1
end repeat
tell application “Finder”
try
set clientFolder to folder foldername of folder “TempClients” of startup disk
make new folder at folder foldername of folder “TempClients” of startup disk with properties {name:“Selections”}
set folder8x10 to make new folder at folder “Selections” of folder foldername of folder “TempClients” of startup disk with properties {name:“8x10”}
set folder5x7 to make new folder at folder “Selections” of folder foldername of folder “TempClients” of startup disk with properties {name:“5x7”}
set label index of folder “Selections” of folder foldername of folder “TempClients” of startup disk to 2
set label index of folder “5x7” of folder “Selections” of folder foldername of folder “TempClients” of startup disk to 2
set label index of folder “8x10” of folder “Selections” of folder foldername of folder “TempClients” of startup disk to 2
on error
try
set clientFolder to folder foldername of folder “ClientArchive” of disk “Disk3”
make new folder at folder “TempClients” of startup disk with properties {name:foldername}
make new folder at folder foldername of folder “TempClients” of startup disk with properties {name:“Selections”}
set folder5x7 to make new folder at folder “Selections” of folder foldername of folder “TempClients” of startup disk with properties {name:“5x7”}
set folder8x10 to make new folder at folder “Selections” of folder foldername of folder “TempClients” of startup disk with properties {name:“8x10”}
set label index of folder “Selections” of folder foldername of folder “TempClients” of startup disk to 2
set label index of folder “5x7” of folder “Selections” of folder foldername of folder “TempClients” of startup disk to 2
set label index of folder “8x10” of folder “Selections” of folder foldername of folder “TempClients” of startup disk to 2
on error
display dialog “Client folder cannot be located. Maybe the external disk is not connected” buttons {“Cancel”} default button 1
end try
end try
end tell