Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SaveCurrent File as .PNG automatic, not a copy..smart like

Community Beginner ,
Aug 07, 2008 Aug 07, 2008

I'm looking for a script that takes the file I'm working on.. usually a .psd looks at the current saved filename and where its existing saved directory location is, and saves out a .PNG file to the same directory overwriting any existing file that might already exist with the same filename and extension.

So if i'm working on buttons.psd, I use the script.. it should save out a buttons.png to the same directory as buttons.psd ... no message prompts pestering me to remove the stupid " copy.png" string.. and no prompts about the interlaced choice. Just automated.. it would be HUGE time saver.

wouldn't mind if it could be adapted to do the same for other formats like .jpg, .gif aswel.. but mainly working with png files, and the constant baby sitting and ok promts, renaming files (ie removing the sodding copy string.. " ok the overwrite propmt etc etc etc .. .. the constant Adobe application workflow that has still yet to be improved is really killing.

TOPICS
Actions and scripting
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Aug 08, 2008 Aug 08, 2008
Hi Koogle,
I might be able to help you. Can you post your email address, or contact me through mine (click on my name for the details)?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 08, 2008 Aug 08, 2008
sent an email :)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 08, 2008 Aug 08, 2008

ok try67 its great and all you can make a script and sell a binary that can do this.. but I'm not buying this!..

this type of functionality should already be in adobe CS3..  useless ADOBE! instead of giving us half assed features every release.

SORT IT OUT

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 08, 2008 Aug 08, 2008
You may not agree with the way that Adobe does it's business, but just because it doesn't have EXACTLY the feature you want doesn't make it useless. Personally, I don't see the ability to overwrite a file with NO warning to the user as something that should be in any software.

You should be able to easily accomplish what you are trying to do with a simple action, give it a function key to activate, and all you have to worry about is the 'replace' dialog (a simple extra return key press isn't a big task).
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 08, 2008 Aug 08, 2008
> You should be able to easily accomplish what you are trying to do with a simple action, give it a function key to activate, and all you have to worry about is the 'replace' dialog (a simple extra return key press isn't a big task).

Or have an action that calls a script that does the overwrite without warning.
It's trivial.

My big problem with the whole 'Save As...' UI is that when you have, lets say, a
image called 'Frog.psd' and you tell the UI you want to save it as a .jpg, the
UI in just about every other app I've ever used automatically changes the name
in the dialog to 'Frog.jpg'. If you're not paying attention, PS will happily
write a jpg formatted file out on your Frog.psd file. It doesn't even have the
good graces to append a '.jpg' resulting in Frog.psd.jpg. Even Notepad does that.

This is one usability bug I hope to see addressed in CS4.

-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 08, 2008 Aug 08, 2008
its more than just one tiny workflow feature that adobe lacks!

they've had lacklustre upgrades each and every version, you gotta be a complete noob to not see how pathetic how some features are just the bare minimum effort that was put in. Even the decade old filters are just another joke. And some of the tools must have been designed by complete retards! Designing tools for noobs must be easy at adobe.

"You may not agree with the way that Adobe does it's business"

The only reason they are still in business because the competition didn't wisen up and make the right design decisions and marketing while they had a chance with there own products. Now were stuck with the fat fish that buys up every innovate product then outputs shity lame upgrades on each release, there is no innovation and whatever improvements are made its only just the bare minimum to string it out for some other subtle improvements on the next release cycle while they slack on other areas.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 08, 2008 Aug 08, 2008
I'm not sure I understand what you mean. On both my PC and my Mac, in both CS2 and CS3, it changes the file extension based on the selected file type in both the 'Save as" dialog and the Export for web dialog.

Is there a different dialog that you are referencing?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 08, 2008 Aug 08, 2008
> Is there a different dialog that you are referencing?

I don't think so. If I do a Save As... and flip through different file types,
the name of the file in the edit field remains the same. I have to change the
extension manually to match the file type before I save. It doesn't matter if
the doc is new or not. And PS will gladly write a jpg over a psd.

-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2008 Aug 08, 2008
That's not the way it works on my new MacPro/OSx.5.4/PSCS3. If I "Save As" a file, when I select a different file type it changes the extension in the file dropdown. When scripted this might not apply.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 08, 2008 Aug 08, 2008
Under Preferences, you need to change your settings for 'Append File Extension'. If I change it to 'Never', then I get the same results as you describe. Mine is set to "Always"
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 08, 2008 Aug 08, 2008
...just checked on my PC, and I don't even see an option to 'Never' change the file extension; the only options are 'Use Upper Case' and 'Use Lower Case'. I don't see how it can be turned off on a PC. On the PC, I can't get it to NOT change the file extension.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2008 Aug 09, 2008
Dismissing OK buttons? I use Basta Computing's BuzOf for Windows. Dismisses those annoying dialog boxes for you. Used to use OkeyDokey Pro on Mac Classic (don't know if it went OSX).

HTH

Steve
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 11, 2008 Aug 11, 2008
"Dismissing OK buttons? I use Basta Computing's BuzOf for Windows. Dismisses those annoying dialog boxes for you. Used to use OkeyDokey Pro on Mac Classic (don't know if it went OSX).
"

looking for a script thats a bit smarter than having to have extra software in the background that would in itself need extra time in setting up.. and only really be needed for a few prompts within photoshop.

anyway can we get back ontopic.. maybe someone knows how a script like this could be achieved with javascript and vb? any actual useful guidance in getting this done
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 12, 2008 Aug 12, 2008
You're still going to get the dialog to overwrite existing files.

#target photoshop

app.bringToFront();

$.localize = true;

docRef = app.activeDocument

var x = separateFileName(docRef.name)
theFile = new File ( docRef.path + "/" + x['filename'] + '.png')

docExportOptions = new ExportOptionsSaveForWeb

docExportOptions.format = SaveDocumentType.PNG //-24 //JPEG, COMPUSERVEGIF, PNG-8, BMP
docExportOptions.transparency = true
docExportOptions.blur = 0.0
docExportOptions.includeProfile = false
docExportOptions.interlaced = false
docExportOptions.optimized = true
docExportOptions.quality = 100
docExportOptions.PNG8 = false

docRef.exportDocument (theFile,ExportType.SAVEFORWEB,docExportOptions)

function separateFileName(theFileName){
if (/\.\w+$/.test(theFileName)) {
var m = theFileName.match(/([^\/\\]+)\.(\w+)$/);
if (m)
return {filename: m[1], ext: m[2]};
else
return {filename: 'no file name', ext:null};
} else {
var m = theFileName.match(/([^\/\\]+)$/);
if (m)
return {filename: m[1], ext: null};
else
return {filename: 'no file name', ext:null};
}
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 12, 2008 Aug 12, 2008
well thanks, I had actually received another similar script that does the same thing only a smaller, but it too seems to have these pesky replace dialog prompts

"You're still going to get the dialog to overwrite existing files. "

is there no way of getting the script to just ok the replace dialog? after whats the point in scripting if you're still gotta babysit dialogs prompts 😞 ... and i'm definetly wanting it to replace and update an existing file.. i wouldn't be wanting a script if I didn't want it as seamless as possible.

seems like I'm almost there to a completly functional script
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 12, 2008 Aug 12, 2008
> "You're still going to get the dialog to overwrite existing files. "
>
> is there no way of getting the script to just ok the replace dialog?

Delete (or rename) the file before you save the new version.

-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 12, 2008 Aug 12, 2008
"Delete (or rename) the file before you save the new version."

thats noob workflow.. the kinda retarded workflow and solutions to problems that I'm seeing more and more in this industry.

I can't imagine what your scripting solutions are like if thats the kinda response you give to people.

Perhaps you are not understanding the problem and why that is not really a good solution.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 12, 2008 Aug 12, 2008
#target photoshop

app.bringToFront();

$.localize = true;

docRef = app.activeDocument

var x = separateFileName(docRef.name)
theFile = new File ( docRef.path + "/" + x['filename'] + '.png')

if (theFile.exists) {
theFile.remove()
}

docExportOptions = new ExportOptionsSaveForWeb

docExportOptions.format = SaveDocumentType.PNG //-24 //JPEG, COMPUSERVEGIF, PNG-8, BMP
docExportOptions.transparency = true
docExportOptions.blur = 0.0
docExportOptions.includeProfile = false
docExportOptions.interlaced = false
docExportOptions.optimized = true
docExportOptions.quality = 100
docExportOptions.PNG8 = false

docRef.exportDocument (theFile,ExportType.SAVEFORWEB,docExportOptions)

function separateFileName(theFileName){
if (/\.\w+$/.test(theFileName)) {
var m = theFileName.match(/([^\/\\]+)\.(\w+)$/);
if (m)
return {filename: m[1], ext: m[2]};
else
return {filename: 'no file name', ext:null};
} else {
var m = theFileName.match(/([^\/\\]+)$/);
if (m)
return {filename: m[1], ext: null};
else
return {filename: 'no file name', ext:null};
}
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2008 Aug 12, 2008
Koogle,

I might suggest hanging around this forum for a while before you refer to X as "noob", use the word "retarded", and imply that his scripting ability is second rate.

X has done more for photoshop scripting that any other single person outside of Adobe engineers. His work is brilliant.

If you're going to act like like a spoiled brat, you are not welcome here.

Bob
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 12, 2008 Aug 12, 2008
"if (theFile.exists) {
theFile.remove()
} "

Mark awesome.. the script works.. and no prompts -seamless just what I had wanted to begin with.

as to you bob ..if X in his last reply had sounded more like he was refering to having the script delete the file to avoid the replace promt..my reply would have been far different .. just his reply sounded to me like I was to manually delete the file before using the script which is what I was getting at.. my response had nothing to do with insulting him personaly just the idea besides he had hijacked this thread onto something completely different to begin with, without providing any viable solution to someone who hasn't done photoshop scripting before.

anyway i'm outta here, thanks Mark you finally came around.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 12, 2008 Aug 12, 2008
"anyway i'm outta here, thanks Mark you finally came around."

'Finally'??

I don't know why I did; your attitude around here hasn't justified the time I spent helping you.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 13, 2008 Aug 13, 2008
Mark,
Thanks so much for writing and posting the script. My problem is, I have no idea how to implement it. I've heard of Scripts and assume they are some kind of system macro. How do I put the script onto my system? I guess you can tell I need very specific step by step instructions if you would be so kind as to provide them. I think it's great that you and others who are so knowledgeable are willing to take your time to read these posts and share your expertise. Thanks again.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 14, 2008 Aug 14, 2008
Copy it into a text program, and save it with a .js or .jsx extension (i.e. saveAsPNG.jsx) into the 'Scripts' folder in the 'Presets' folder with the Photoshop application. It will then appear in the Scripts menu under 'File' menu.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 14, 2008 Aug 14, 2008
Mark,
Thanks for quick response. I copied & pasted your script into Wordpad and at first I got "PNG.txt.jsx"; I tried again in Notepad and saw the option "All Files" which enabled me to SaveAs with only the jsx extension. I saved it to C:\Program Files\Adobe\Photoshop Elements 6.0\Presets\Scripts (there was a folder there named "Stack Scripts Only" but I didn't put it there.)Then I closed PSE6 and reopened it and went to File menu where most items were grayed out, so I opened a photo file to give me more menu options. There was no Scripts menu under the File menu of the main toolbar. I do see an option there called Automation Tools, but it's grayed out. I did Help searches for "script" and "automation tools" but no pages came up. Am I looking in the wrong place for the scripts menu or what?
Also, (I'm not sure how to phrase this question)-- how do I run the script when I want to save a PNG file after having edited it? In other words, after I get the scripts menu in place, how do I use it when I do a SaveAs? Thanks again for being so helpful.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines