Copy link to clipboard
Copied
I have been using the Export Layer Comps To Files scrips that ships with Adobe Photoshop CS5 for a while and found it very useful, apart from the numbers it automatically adds as a prefix to the layercomp name.
A friend pointed me in the direction of a altered version of this scrips which removes the numbers and only exports the layer comp name, gerat I thought. Not great! After using this successfully for a while the scrip started to throw up errors whenever I attempted to export. Either "No layer comps found" or "Adobe Save for Web & Devices Error: Could not complete this operation. There are no user slices." As I knew there were layercomps for the first error and knew that I had not created any slices for the second error I was pretty miffed. Fortunately I had the foresight to make a copy of the original script from the Photoshop presets library.
I have since deleted the offending script out of my presets folder and copied the original script back in however the error still persists. I constantly receive Adobe Save for Web & Devices Error: Could not complete this operation. There are no user slices. I have searched the forums and around the net to try and find a solution for this problem but none seem to present themselves. I am perplex how this error can persist when the original script is now being used.
If there's is anyone out there who can help me resolve this I'd be most grateful. As I say I've tried to resolve this myself and am pretty computer savvy but this one has defeated me
Thanks in advance
Copy link to clipboard
Copied
When this sort of thing happens the first thing to try is reset Photoshop preferences then try again.
Copy link to clipboard
Copied
Just curious, where did you find the modified version of the Layer Comps To Files script? I have modified that script several times in the past( and posted the modified version) and I don't see anything that would cause that error if just the file naming was changed. I would like to see that version to try and find if it could cause problems.
I would second Paul's suggestion. I think the problem has more to do with corrupted preferences than the script itself.
Copy link to clipboard
Copied
Wow that was really quick, thanks for the response Paul and Michael.
I will try to reset my preferences and update this post with the outcome.
Micheal you can download the export script I used from this link http://www.tenniswood.co.uk/technology/how-to-export-to-layer-comps-to-files-without-the-leading-num...
You mentioned that you have updated this script? would it be possible to get a copy or point me in the right direction? I have looked for this in the past but not had any joy.
Thanks again for the help guys, really appriciate it
Copy link to clipboard
Copied
Hi Guys,
I have deleted the Photoshop preferences by following the instructions in the link however the problem has persisted. The Adobe save for Web & Devices Error: Could not complete this operation. There are no user slices.
When selecting File > Scripts > Layer Comps to Files...
Destination: My HDD
File Name Prefix: None
Selected Layer Comps Only: Unchecked
File Type: PNG-24
Include ICC Profile: Checked
PNG-24 Options - Transparency: Checked, Interlaced: Unchecked
I am 100% certain that the file doesn't contain any slices and the he file is stored locally on my machine.
The version of Photoshop I am running is updated: Photoshop CS5 Extended v12.1 x64
Any other suggestions would be appriciated.
Copy link to clipboard
Copied
Very strange, Mike should be able to ppoint you to one of his amended scripts to see if it helps. In the mean time you could try this script, it will save the layerComps to the selected folder using the layerComps name...
#target Photoshop
main();
function main(){
if(!documents.length) return;
var doc = app.activeDocument;
var outputFolder = Folder.selectDialog("Please select Output folder");
if(outputFolder == null ) return;
for( var c = 0; c < doc.layerComps.length; c++ ){
doc.layerComps
.apply(); var saveFile = File(outputFolder + "/" + doc.layerComps
.name + ".png"); sfwPNG24(saveFile);
}
}
function sfwPNG24(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG;
pngOpts.PNG8 = false;
pngOpts.transparency = true;
pngOpts.interlaced = false;
pngOpts.quality = 100;
pngOpts.includeProfile=true;
activeDocument.exportDocument(new File(saveFile),ExportType.SAVEFORWEB,pngOpts);
}
Copy link to clipboard
Copied
Thanks Paul,
Sorry if this is a silly question but I'm a designer and I'm not familiar with Javascript. Do I need to open and replace a specific part of the code in the file Layer Comps To Files.jsx with this code or create a new .jsx file and only use the code provided?
Thanks again for your help
Copy link to clipboard
Copied
Copy and paste the code into a new window of ExtendScript Toolkit (this gets installed with Photoshop) Save the script to the applications presets/scripts folder. If you are using Windows 7 or Vista you will have to save it out to somewhere else IE the desktop then copy to the presets/scripts folder. If Photoshop was open close and re-start it so that it can pick up the new script.
To use:- File - Scripts - select the script. (you will need to have a psd open)
Another thought, you might be a good idea to reset the save For Web preferences, as this might have an effect? The location of these are it the link above.
Copy link to clipboard
Copied
Sorry Paul,
I've created a new .jsx file by duplicating the current one, deleting all the contents of the file and replacing with the code you have supplied. I have added it to my scripts. When I run the script it still produces the exact same error Adobe Save for Web & Devices Error: Could not complete this operation. There are no user slices.
I ran a quick test to make sure there isn't an issue or corruption with my source file but a totally fresh file with no slices and test layer comps still produces the same results as above.
It's very strange as the scripts have run previously without any issues. The default PS script and the custom script no longer works on my machine but there doesn't appear to be a trigger? My colleuges are running the same version of PS and do not experience this issue. However one did have this problem when using the downloaded script from www.tenniswod.co.uk... though at that time my exact same script had been running ok while her's was throwing up errors. she has replaced her script with the original file I supplied her from PS and was still experiencing issues however after taking a holiday and not using her machine the script now works while mine is now throwing up errors.
The only difference I can see outside of PS is that she is using a iMac and I a MacBook Pro (Late 2011) and her OS is the same but on version 10.7.3 while I'm currently on 10.7.4.
Not sure if any of that would affect PS but they are the only variables I can find
Copy link to clipboard
Copied
This does point to corrupt Save For Web prefferences
Mr Tranberry has given this to reset them...
1. Quit Photoshop
2. Delete the "Adobe Save For Web 12.0 Prefs" file:
Mac: Users/[Username]/Library/Preferences/Adobe Save For Web 12.0 Prefs
Windows XP: Documents and Settings/[Username]/Application Data/Adobe/Save For Web/12.0/Adobe Save For Web 12.0 Prefs
Windows 7 and Vista: Users/[Username]/AppData/Roaming/Adobe/Save For Web/12.0/Adobe Save For Web 12.0 Prefs
Lets hope this works.
Copy link to clipboard
Copied
Hi Guys,
Thanks for all the help but still no joy. Still getting the same Save for Web error.
I am now updating my OS X Lion software to the latest version (though it's a fairly large download of 1.06 GB) which will take a couple of hours to download before I can test again with the up to date OS. Fingers crossed that works.
If you have any other ideas I'm all ears but thanks for trying to help so far.
Copy link to clipboard
Copied
I wonder if you have run MacKeeper on this machine? As this has caused problems ...
Updating the OS might just fix the problems.
Copy link to clipboard
Copied
There are no real differences between my version that just changes the file naming and the one that can be found in that link. The only differences are I changed the filename of the script by adding a suffix and left the original part of the code I changed in comments and commented the start and end of my changes. I did that so it would be easy to see the changes( and that it's not Adobe's shipping version ).
And I would be willing to bet a good bit of money that the script did not cause the problem you are having. If you were saving the comps as anything but png that script would work fine. It, like Paul's or any script that uses SFW, is having the same issue. Most likely corrupt preferences of some kind.
Edit: I didn't see later posts about resetting preferences before I posted this. So I would think that rules out that reason.
Copy link to clipboard
Copied
Hi Paul/Michael,
Thanks for the suggestion, unfortunately I'm not running MacKeeper so that wouldn't be causing the problem.
I have had a slight breakthrough! I am able to export layer comps to other formats; BMP, JPEG, PDF, PSD, Targa, TIFF except the PNG format I want.
Both PNG-8 and PNG-24 in all variables (check boxes on or off) display the Save for Web & Devices Error.
I know the export to PNG was recently added to this script by Adobe so I can only assume that there is an issue which appears to be unknown in a certain scenario played out on my MacBook Pro. I am about to update my OS and will post an update if this resolves the issue or not.
Thnaks for all the help guys, still a bit of a conundrum
Copy link to clipboard
Copied
The problem is definitley with the save for web, here is a way to save the layer comps to PNG. This should work as it is not using Save For Web.
#target Photoshop
main();
function main(){
if(!documents.length) return;
var doc = app.activeDocument;
var outputFolder = Folder.selectDialog("Please select Output folder");
if(outputFolder == null ) return;
for( var c = 0; c < doc.layerComps.length; c++ ){
doc.layerComps
.apply(); var saveFile = File(outputFolder + "/" + doc.layerComps
.name + ".png"); SavePNG(saveFile);
}
}
function SavePNG(saveFile){
pngSaveOptions = new PNGSaveOptions();
activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
}
Copy link to clipboard
Copied
PERFECT!!!
Thanks a million Paul. The script runs fine, no dialogue pops up like the default adobe one (other than to select a file location) but the PNG's export as expected. I assume the png format is PNG-24 with this script (rather than PNG-8, just incase I need to save any transparency on layer comps in the future).
Not sure what the problem is with the Adobe one (or why it suddenly apeared) but your script serves the purpose I need it to.
FYI I updated my OS to Mac OS X Lion 10.7.5 but this didn't resolve the issue with the adobe script, which still throws up the errors, so must be a problem with the save for web step in the script as you suggest.
Thanks again for all the help finding a solution, YOU GUYS ROCK!!!.
Hopefully this will help out others who run in to this problem
Copy link to clipboard
Copied
Yes it PNG-24 but using saveas rather than save for web. So there is still a problem with Save for Web on your system.
At least you can create PNG's
Copy link to clipboard
Copied
Thanks Paul, really appriciate your help.
I'll have to look into what's causing problems on my system? could be that I need to just reinstall PS but I'll leave that as a last resort.
Your solution works fine and I'm happy with that for now... PNG's all the way lol
Copy link to clipboard
Copied
hey paul i read the board and it didn't really help me with my issue i wanted to keep my original layer comp to file script and at the same time remove the extra digits so i read your board and this my solution, it works really well for me so hopefully you can update photoshop.
heres my solution video. let me know if that brings up any issues with you guys.
Copy link to clipboard
Copied
The problem seems to be already solved, but I'm commenting this for future reference.
This has happened to me too and I think I know what causes it.
It happens when you...
1) Do "Save for Web" with the "All User Slices" selected in the dropdown menu "Slices".
(This can only be done with a file that has a user slice)
2) Then try to use the "Layer Comp to Files" script to a file that doesn't have any slices.
To avoid this you need to once open a file that "has" a user slice and save with
the "All Slices" option in the "Slices" menu and then go back to the file you want
to run the script to.
When you run the script, the saved "Slices" option from the previous export seems to
be used and causes an error when there are no user slice.
I also found a fix to the script to avoid this error to come out.
This can be also applied to the fix to "remove the numbers" added to the head of the
exported file names.
The number removal script goes something like this...
var fileNameBody = exportInfo.fileNamePrefix;
if (fileNameBody != "") fileNameBody += "_";
fileNameBody += compRef.name;
this should replace the "Layer Comps to Files.jsx" lines 188-190.
In addition to that, the script below needs to be added below line 818 and line 863.
(This line numbers are those before any alterations to the "Layer Comps to Files.jsx" script)
var idSWsl = charIDToTypeID( "SWsl" );
var idSTsl = charIDToTypeID( "STsl" );
var idSLAl = charIDToTypeID( "SLAl" );
desc4.putEnumerated( idSWsl, idSTsl, idSLAl );
The line right above where the above script should be inserted should read as the following...
desc4.putPath( id44, new File( exportInfo.destination + "/" + fileNameBody + ".png") );
Actually it can be added any where after the "desc4" variable is declared but I specified just
to make it simple.
This sets the "Save for Web" "Slices" settings to "All User Slices".
Copy link to clipboard
Copied
hi,
I did what you e-maild me and it works flawlessly, THANK YOU! this scrip will save me so much time.
my other issue now is when i change the name in the slice it will save all the layer comps to file but all layer comp to files are blank except the last comp, the script still fully runs and throws out the window that says it was successful but in the folder location theirs is only a single file of the last slice that works... all other files are completely blank. (i can do a video of the problem and send it if you need further description)
thank you again for all your help.
george
Copy link to clipboard
Copied
I don't think I fully understand your situation. I might need to see the video you suggested.
Copy link to clipboard
Copied
hi,
here the video, hopefully it helps with the small issue i'm having.
http://www.youtube.com/watch?v=g9yoISrubik
let me know if you need additional info.
Copy link to clipboard
Copied
hi,
i haven't received a reply from you on the issue i'm having with name slices, i hope you got my video description. let me know if you need me to resend.
hope to talk to you soon.
george
Copy link to clipboard
Copied
Hey, sorry for not getting back to you.
Thanks for the video. I got what the problem is but I don't think it can be fixed as easy as it seems.
The "Layer Comp To Files" script isn't meant to work with slices in the first place.
Why it's exporting the slices on default is because it's just taking the "Save for Web" settings and
saving, I suppose.
Photoshop scripts can't handle slices. At least not with the javascript code.
So I don't think there's any straight forward way to achieve what you are going for.
Sorry to disappoint you, I'll post if I find any solution.