PhotoshopForums.com Home
Navigate Contact FAQ Search Members
simple save script help
Post new topic   Reply to topic    PhotoshopForums.com Forum Index -> Actions and Automation
 See a User Guidelines violation? Please contact us.
Author Message

t9753278

Joined: 01 Oct 2011
Posts: 2



PostPosted: Sat Oct 01, 2011 11:17 am    Post subject: simple save script help Reply with quote

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
View user's profile Send private message

Paul R

Joined: 06 Apr 2010
Posts: 57



PostPosted: Sat Oct 01, 2011 12:29 pm    Post subject: Reply with quote

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);
}
View user's profile Send private message

thehermit

Joined: 05 Mar 2003
Posts: 3987
Location: Cheltenham, UK


PostPosted: Sat Oct 01, 2011 12:31 pm    Post subject: Reply with quote

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!
View user's profile Send private message

t9753278

Joined: 01 Oct 2011
Posts: 2



PostPosted: Sat Oct 01, 2011 1:01 pm    Post subject: Reply with quote

Cheers Paul!! Thats saved me a lot of learning, which I hate (I went to art college)
View user's profile Send private message

thehermit

Joined: 05 Mar 2003
Posts: 3987
Location: Cheltenham, UK


PostPosted: Sat Oct 01, 2011 3:56 pm    Post subject: Reply with quote

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!
View user's profile Send private message

Patrick
Administrator
Administrator

Joined: 14 Feb 2003
Posts: 11945
Location: Harbinger, NC, U.S.A.


PostPosted: Sun Oct 02, 2011 10:46 am    Post subject: Reply with quote

Good job, Paul. :) Appreciate you sharing that here. Welcome to PF, t9753278!

Patrick

_________________
Patrick O'Keefe - PhotoshopForums.com Administrator
Have a suggestion or a bit of feedback relating to PhotoshopForums.com? Please contact me!
User Guidelines
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    PhotoshopForums.com Forum Index -> Actions and Automation All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Contact - User Guidelines >

Copyright © 2003-2016. PhotoshopForums.com, iFroggy Network. All Rights Reserved.
Powered by phpBB © phpBB Group. phpBB SEO. Privacy Policy.
We are in no way affiliated with Adobe. Photoshop, Adobe and related marks are registered trademarks of Adobe.
PhotoshopForums.com