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

Script error during saving file

New Here ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

I'm using Photosho v21.1.0.

When I run an Action (script) and trying to save a file into a local directory (C:/temp) I get an Error message "Cannot save to C:/temp/C:/Temp/file.jpg". I get twice the directory name.

How to solve this problem ? Thank You

Views

1.8K

Translate

Translate

Report

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 ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

Where did you get this script? Seems like an issue with the code. Should be easy to fix though if the code is available

 

-Manan

Votes

Translate

Translate

Report

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 ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

I have created myself different scripts to save my images in different directories.

Votes

Translate

Translate

Report

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 ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

Can you post your script so we can see your source code like you can see it. We have no idea is what you have coded. All we know is there is an error in your save code. We can not tell you where your error is.

 

For example here is a save as jpeg function I may use.  If you pass it that path it will fail.

function SaveAsJPEG(saveFile, jpegQuality){
	var doc = activeDocument;
	if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) doc.bitsPerChannel = BitsPerChannelType.EIGHT;
	jpgSaveOptions = new JPEGSaveOptions();
	jpgSaveOptions.embedColorProfile = true;
	jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
	jpgSaveOptions.matte = MatteType.NONE;
	jpgSaveOptions.quality = jpegQuality;
	activeDocument.saveAs(File(saveFile+".jpg"), jpgSaveOptions, true,Extension.LOWERCASE);
}
JJMack

Votes

Translate

Translate

Report

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 ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

If you have created the script then you could easily debug it using Extendscript or VSCode. Just set the break point where you are saving the file and see how the path is determined. If you have issues debugging the script then share it across, we.will have a look at it.

 

-Manan

Votes

Translate

Translate

Report

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 ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

I actually use Photoshop Actions (formerly called Scripts), to make a series of adjustments to tone, sharpness, cropping, etc., and then save the processed images in specific directories. It is during the saving process that the error appears.
What you're proposing is a scripting language that I don't master at all, sorry !

Votes

Translate

Translate

Report

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 ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

Actions were always part of Photoshop from what I remember. I started using Photoshop when  Version PS 3 was current.  Adobe made Photoshop Plug-in Scriptingsupport available as an optional download in Photoshop version PS 7.  Scriptingsupport plug-in became a standard part of Photoshop in Photoshop CS version 8 of Photoshop.  Actions have always been called Actions.

 

If you have a  problem with an Action you recorded you should full expand the action in the actions Palette so you can read every step and all the setting recorded into your action foe each step to find out where your  problem is.  We can not see what you recorded unless you post you action sets .atn file here.

JJMack

Votes

Translate

Translate

Report

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 Employee ,
May 18, 2020 May 18, 2020

Copy link to clipboard

Copied

Upgrade to 21.1.2 or newer if your timing is right. If that still fails then please post your ATN file or the JavaScript you are running.

Votes

Translate

Translate

Report

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 ,
May 25, 2020 May 25, 2020

Copy link to clipboard

Copied

LATEST

I think I found the solution in an old forum post :

https://community.adobe.com/t5/photoshop/problem-with-the-save-as-function-when-used-in-an-action-si...

Using Actions on version 21.1, the "save as" command creates bugs and generates an error message.

In my case, run an action that saves a file to 2 different folders as "save as". Saves to the first folder and I get the error "file name is invalid".

Just need to update Photoshop version to the actually version and this problem is gone !

Thank You to all the participants in this discussion

 

Votes

Translate

Translate

Report

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