|
Author |
Message |
t9753278
Joined: 01 Oct 2011
Posts: 2
|
Posted: Sat Oct 01, 2011 11:17 am Post subject: simple save script help |
|
|
Hi, I been messing about with javascripting now for a couple of hours, with nothing to show for it. Thought it would be easy, guess not! .. hoping some one here can do all the work for me
Im after a script that saves a copy in png format (none interlace), up a level, with a different suffix.
So, if my psd is saved here: C:\textures\psd\test.psd my png will end up here: C:\textures\test_bump.png
Thanks |
|
|
|
|
Paul R
Joined: 06 Apr 2010
Posts: 57
|
Posted: Sat Oct 01, 2011 12:29 pm Post subject: |
|
|
Here you go....
Code: |
#target photoshop
main();
function main(){
if(!documents.length) return;
try{
var Path = decodeURI(activeDocument.path.parent);
}catch(e){return;}
if(!Folder(Path).exists){
alert(Path + " Does not exist!");
return;
}
var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');
var saveFile = File(Path + "/" + Name + "_bump.png");
sfwPNG24(saveFile);
//Uncomment the line below if you want to close the document.
//app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
function sfwPNG24(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = false;
pngOpts.transparency = true;
pngOpts.interlaced = false;
pngOpts.quality = 100;
activeDocument.exportDocument(new File(saveFile),ExportType.SAVEFORWEB,pngOpts);
}
|
|
|
|
|
|
thehermit
Joined: 05 Mar 2003
Posts: 3987
Location: Cheltenham, UK
|
Posted: Sat Oct 01, 2011 12:31 pm Post subject: |
|
|
Welcome to the forum. Good luck, there are some folks here that know the dark arts, but not I. Good questing _________________ If life serves you lemons, make lemonade! |
|
|
|
|
t9753278
Joined: 01 Oct 2011
Posts: 2
|
Posted: Sat Oct 01, 2011 1:01 pm Post subject: |
|
|
Cheers Paul!! Thats saved me a lot of learning, which I hate (I went to art college) |
|
|
|
|
thehermit
Joined: 05 Mar 2003
Posts: 3987
Location: Cheltenham, UK
|
Posted: Sat Oct 01, 2011 3:56 pm Post subject: |
|
|
It's like he's a Jedi of Photoshop scripting, he can even predict my response before I make it! Dark arts indeed! _________________ If life serves you lemons, make lemonade! |
|
|
|
|
Patrick
Administrator
Joined: 14 Feb 2003
Posts: 11945
Location: Harbinger, NC, U.S.A.
|
Posted: Sun Oct 02, 2011 10:46 am Post subject: |
|
|
|
|
|
|
|
|