Question: AppleScript - Error 1700 Can't make ~ into type location specifier
The following script that someone on another thread so kindly created for me about a year ago used to work perfectly! Now it's not working and I can't figure out why and would love feedback. I can tell you the only change from the time it was created and running perfectly to now is that I upgraded to Mavericks OS 10.9.5.
A little background info on the purpose of the script if it helps. I use a .txt file with a select listing of part numbers (usually 100-500) to compare against a master folder of images of all parts (approx. 15,500). The script finds a match and places the image in a new folder. I use this for customer image requests rather than doing it manually. I will say that if in the process of figuring out the problem with the script someone can tell me how to copy rather than move the files that would be awesome! From what I've read, System Events doesn't do copy. I have tried using Finder but it just runs and then stops responding.
Using the script below, what used to work is now giving me the following error result message:
Result: error "System Events got an error: Can’t make \"/Users/myname/Desktop/Customer Img Req\" into type location specifier." number -1700 from "/Users/myname/Desktop/Customer Img Req" to location specifier
(I've substituted 'myname' for my actual below, otherwise this is exactly what the working script looked like before. Also, I realize the person who wrote the script misspelled 'imagePolderPath' but again - it used to work, misspelling and all.)
set imagePolderPath to "/Users/myname/Desktop/WEB IMAGE LIBRARY Incomplete"
set destinationFolderPath to "/Users/myname/Desktop/Customer Img Req"
-- choose the text file with the list of names
set listFile to POSIX path of (choose file)
-- the following assumes the list file is a text file with one image name per line
set dataList to paragraphs of (read listFile as «class utf8»)
tell application "System Events"
repeat with thisFileName in dataList
-- I've used 'begins with' since I don't know whether you'll get these file names with or without extensions. This could in aberrant cases result in unwanted files being included.
move (files of folder imagePolderPath whose name begins with thisFileName) to destinationFolderPath
MacBook Pro, OS X Mavericks (10.9.5)