First the easy fix. This should let you change the suffix in just one place.
Code: Select allvar jpgQuality = 10;
var nameSuffix = "-processedScrRES.jpg";
var docPath = getDocumentPath();
var docName = doc.name.replace(/\.[^\.]+$/, '');// remove extension if present in doc name
docName = docName.replace(' as Smart Object-1',"");// remove smart object suffix if present
if(undefined != docPath){
var saveFile = doc.path + "/" + docName + nameSuffix;
}else if(!app.activeDocument.info.instructions == '' && new File(app.activeDocument.info.instructions).exists){
var saveFile = new File(app.activeDocument.info.instructions).parent + "/" + docName+ nameSuffix;
}else{
// need to do something else to get a valid path
alert('no path')
}
If ACR doesn't pass a path with every file I am not sure there is a 'save' way to supply the path info. I think that if you only batch open images in one folder at a time with ACR the script could save the path in app.customOptions. Then later when the path is not found it can look there. But there is no real way to make sure the path in the customOptions is valid for the activeDocument. If it's not the files will be saved in the wrong place.
So if ACR always passes the path for the first file and you only open multiple files from the save folder at one time I could code storing the path in customOptions if you want to try it.
Need Assistance with script for CS6
-
bacton
Need Assistance with script for CS6
Hello Mike,
Thank you for the fix regarding the variable for the 'suffix' information. I haven't yet had the opportunity to test it but I'm confident that it will work just fine.
I am quite disappointed by the failure of the script to work with multiple files passed from ACR to PS CS6. I appreciate that it is a shortcoming with ACR/CS6.
My project work flow often involves files from different folders and in the past it has been a major convenience for me to process files from where-ever and the script would automatically place the processed file in the correct folder. This is a feature/convenience that is important to me.
I did perform a test with the current version of the script where I passed 3 files (each originating from different folders) from ACR to CS6. In such instances CS6 opens them sequentially with the last file being the active file in CS6. I went to the "File info..." in CS6 for each file #3, #2 and #1 examining the contents of the IPTC "instructions" field. I discovered that only file #3 (the last file opened in CS6) had anything in this field.... the full path and filename. This is what you suspected was happening.
My understanding is that the script is triggered in CS6 with each 'open' command. Does this mean that the 'open' command is triggered only once, whether or not there is one file or many files being loaded into CS6?
I don't know? I know very little (nothing) about java scripting. Is there possibly some other way of triggering and/or capturing/recording the path/filename information in the situation of multiple files?
You've done so much on this script and it is sooooo close......
Thank you Mike.
Bob
...
Thank you for the fix regarding the variable for the 'suffix' information. I haven't yet had the opportunity to test it but I'm confident that it will work just fine.
I am quite disappointed by the failure of the script to work with multiple files passed from ACR to PS CS6. I appreciate that it is a shortcoming with ACR/CS6.
My project work flow often involves files from different folders and in the past it has been a major convenience for me to process files from where-ever and the script would automatically place the processed file in the correct folder. This is a feature/convenience that is important to me.
I did perform a test with the current version of the script where I passed 3 files (each originating from different folders) from ACR to CS6. In such instances CS6 opens them sequentially with the last file being the active file in CS6. I went to the "File info..." in CS6 for each file #3, #2 and #1 examining the contents of the IPTC "instructions" field. I discovered that only file #3 (the last file opened in CS6) had anything in this field.... the full path and filename. This is what you suspected was happening.
My understanding is that the script is triggered in CS6 with each 'open' command. Does this mean that the 'open' command is triggered only once, whether or not there is one file or many files being loaded into CS6?
I don't know? I know very little (nothing) about java scripting. Is there possibly some other way of triggering and/or capturing/recording the path/filename information in the situation of multiple files?
You've done so much on this script and it is sooooo close......
Thank you Mike.
Bob
...
-
Mike Hale
Need Assistance with script for CS6
I think that we need to start over. This time with my having a better understand of your workflow. I don't really need to know what you do in ACR but I think I do need to know the following.
1. How do you select the files? I assume you are not using the Photoshop File>Open menu item. If you are using Bridge then we may be able to match the paths using the selections in Bridge.
2. Where is ACR in the workflow? If I select a few images with bridge, right click and choose open in ACR... from the pop-up menu then in ACR select all and open objects the open event does happen and none of the images have a path in the file info. If I choose open from the pop-up the images still go through ACR but this time the open event does occur. However all but the last open event have empty descriptors so that is why there is no path info except for the last opened.
It could be that we can't find a way and you will need to change your workflow.
1. How do you select the files? I assume you are not using the Photoshop File>Open menu item. If you are using Bridge then we may be able to match the paths using the selections in Bridge.
2. Where is ACR in the workflow? If I select a few images with bridge, right click and choose open in ACR... from the pop-up menu then in ACR select all and open objects the open event does happen and none of the images have a path in the file info. If I choose open from the pop-up the images still go through ACR but this time the open event does occur. However all but the last open event have empty descriptors so that is why there is no path info except for the last opened.
It could be that we can't find a way and you will need to change your workflow.
-
bacton
Need Assistance with script for CS6
I'm sorry Mike for the difficulties that I'm causing you but I do appreciate very much your patience.
1) I suppose that the beginning of my workflow is Extensis Portfolio, the DAM software that I'm using to manage all of my images.
It is probably possible to have Portfolio put the folder/filename into the 'IPTC Instructions' field. I'm not sure how to go about doing that but I could probably figure it out or ask someone at Portfolio tech support. Then it would always be there regardless of what ACR/CS6 is doing.
2) I typically use Portfolio to identify the image or images that I'm going to process. Then I drag and drop the images into CS6. If an image is a RAW image it gets opened in ACR. Otherwise, it gets opened directly in CS6.
NOTE: The script was working well until recently when I changed my ACR setting to 'Open as smart object' in PS CS6. That is the single thing that caused the process to go off the rails.
What are your thoughts on all this?
BA
...
1) I suppose that the beginning of my workflow is Extensis Portfolio, the DAM software that I'm using to manage all of my images.
It is probably possible to have Portfolio put the folder/filename into the 'IPTC Instructions' field. I'm not sure how to go about doing that but I could probably figure it out or ask someone at Portfolio tech support. Then it would always be there regardless of what ACR/CS6 is doing.
2) I typically use Portfolio to identify the image or images that I'm going to process. Then I drag and drop the images into CS6. If an image is a RAW image it gets opened in ACR. Otherwise, it gets opened directly in CS6.
NOTE: The script was working well until recently when I changed my ACR setting to 'Open as smart object' in PS CS6. That is the single thing that caused the process to go off the rails.
What are your thoughts on all this?
BA
...
-
Mike Hale
Need Assistance with script for CS6
It looks like you can remove the open event handler. It's not going to be of any help when opening multiple images.
I think your best bet would be to try having Portfolio add the metadata.
The best I was able to come up with would take twice as long to open the files than if you could get the path from the metadata.
I think your best bet would be to try having Portfolio add the metadata.
The best I was able to come up with would take twice as long to open the files than if you could get the path from the metadata.
-
bacton
Need Assistance with script for CS6
Thank you Mike.
I will pursue the path of having Portfolio put the path/filename in the 'instructions' field.
It may take a couple of days to get this in place.
I'll keep you posted.
Thank you.
BA
...
I will pursue the path of having Portfolio put the path/filename in the 'instructions' field.
It may take a couple of days to get this in place.
I'll keep you posted.
Thank you.
BA
...