Photoshop seems to mismatch my file's path

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

cfgraves

Photoshop seems to mismatch my file's path

Post by cfgraves »

I have a script that opens up a large number of files, does some actions and then saves them back to another folder. Sometimes Photoshop though seems to "lose" the path to the correct folder. This usually is repaired with a system reboot.

Some code:

var docs = [new File("~/Users/printermac/Desktop/Orders/20120611/kit-10538/SW20120611-473355kc-CLRV2_qty1-1of4_rpt_300dpi.jpg"),
new File("Users/printermac/Desktop/Orders/20120611/kit-10538/SW20120611-473355kc-CLRV2_qty1-2of4_rpt_300dpi.jpg"),
new File("Users/printermac/Desktop/Orders/20120611/kit-10538/SW20120611-473355kc-CLRV2_qty1-3of4_stp_300dpi.jpg"),
new File("Users/printermac/Desktop/Orders/20120611/kit-10538/SW20120611-473355kc-CLRV2_qty1-4of4_rpt_285dpi.jpg")]

This creates an array of files to be opened with the following code. fileArray in this case is the array above just passed through to a function. Each item of the array gets iterated as such:

try {
var doc = open(fileArray[k])
} catch (error) {
var errorFile = true
newRGBDoc.close()
newBITMAPDoc.close()
alert("File could not be opened at: " + fileArray[k])
return
}

These files though located at the above location seem to evade Photoshop. If I give it a different path but essentially the same as I using this script as the user printermac:

~/Desktop/Orders/20120611/kit-10538/SW20120611-473355kc-CLRV2_qty1-1of4_rpt_300dpi.jpg

Then it will find the file and open it but then complains that the file hasn't been saved so no operations can be run on it like a real file. I've been using this script pretty steadily for going on 2 1/2 years. I know this problem is Photoshop related, not an issue with my script persay cause it works all the time except in the case where Photoshop is not performing correctly.

Has anyone had this issue before? Have any clue a way I could fix this? It seems like a preference that get set's wrong but I'm not really sure.