How to write to a relative path with PS actions

New Here ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Hi,

What is the way to do the above? PS always looks for an absolute path, therefore all my actions break.
Any easy fix?

Thanks

TOPICS
Actions and scripting , Windows

Views

85

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Are you familiar with JavaScript? 

Likes

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 30, 2022 May 30, 2022

Copy link to clipboard

Copied

No but if there is an easy fix i ll take it

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

I see no immediate, realistic option except Scripting and that is best done with JavaScript, but Visual Basic and AppleScript could also work. 

 

What is the exact relationship of the file’s position and the target location? 

What is the target file format? 

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

AFAIK, you don't/can't do so with an action... Where are you using the absolute path in the action? In a save step, elsewhere?

 

You can turn on the modal control for an interactive override in the action.

 

Or you can use the "override action step" in Batch for recorded open or save commands.

 

Or you can use the "Insert menu item" command to place a generic open or save step into an action.

 

Otherwise, this is available via scripting, however it depends on the context of the step in the action on where/how you would use a scripted step recorded into the action.

Likes

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 30, 2022 May 30, 2022

Copy link to clipboard

Copied

I only use it during save yes.
So whats the way of doing that without code (if possible)? thanks

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Will you please explain the exact scenario already? 

Save a Copy or Save As (or even Export …), file format, target position relative to original file, …? 

Likes

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 30, 2022 May 30, 2022

Copy link to clipboard

Copied

I usually wanna do something like:
- open file
- Modify size
- Modify 16/8bit etc
- Close
and either
1. Save on the file that I am same format/same location or 2. Save as a different format/same location

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied


1. Save on the file that I am same format/same location 

So File > Save? That should not be a problem in an Action.  

 

Please try to describe what you are actually trying to automate that plain Actions cannot handle already. 

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

This Script would save a jpg in the same Folder as the active Document (and if that has no path yet to the Desktop). 

Save the code as a txt-file, change the extension to .jsx and copy it into Photoshop’s Presets/Scripts-Folder; after restarting Photoshop it should be available under File > Scripts and can be assigned a Shortcut or used in an Action. 

// saves jpg into same folder;
// be advised: this  overwrites existing jpgs of the same name without prompting. 
// 2010, use it at your own risk;
#target photoshop;
if (app.documents.length > 0) {
var thedoc = app.activeDocument;
// getting the name and location;
var docName = thedoc.name;
if (docName.indexOf(".") != -1) {var basename = docName.match(/(.*)\.[^\.]+$/)[1]}
else {var basename = docName};
// getting the location, if unsaved save to desktop;
try {var docPath = thedoc.path}
catch (e) {var docPath = "~/Desktop"};
// jpg options;
var jpegOptions = new JPEGSaveOptions();
jpegOptions.quality = 9;
jpegOptions.embedColorProfile = true;
jpegOptions.matte = MatteType.NONE;
//save jpg as a copy:
thedoc.saveAs((new File(docPath+'/'+basename+'.jpg')),jpegOptions,true);
//that’s it; thanks to xbytor;
};

 

Likes

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 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Thanks so this is for writing specifically a jpeg?
It is not what I need though, I would need a script to just say "write whatever I define  in the relative path"

I would just need the "Save as" part but to a relative path. I use this for many different extensions. So i guess its not possible and requires different scripts each time?

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

The Script is for jpg-creation. 

 

I don’t seem to understand what you are trying to automate. 

If you want to give manual input in the Save As-dialog anyway what is the problem to begin with? 

Maybe you could to explain the issue, possibly post meaningful screenshots or sketches to illustrate? 

Likes

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 30, 2022 May 30, 2022

Copy link to clipboard

Copied

I understand that u dont understand. Since i never said i wanna save as JPEGs but u assumed it.
I said multiple times already the same thing with different wording:
I wanna save as various formats in their folder for whatever reason. My 2 previous posts were super descriptive. Doesnt need any further explanation. So its not possible to save relative paths.

Likes

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 Professional ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied


@thanulee wrote:

I understand that u dont understand. Since i never said i wanna save as JPEGs but u assumed it.


Is jpg not a file format and as such perfectly fitting as one of »various formats«? 

 


So its not possible to save relative paths.

Naturally it is possible to save copies (or a new file) to a position relative to the active document (edit: with Scripts).

As the example for jpg should have made clear. 

 


Doesnt need any further explanation. 

Not if you don’t actually want to automate the task, otherwise it does as far as I am concerened. 

What is »various formats« supposed to mean exactly? 

How is this supposed to happen in your workflow, do you expect a dialog or an instantaneous saving/exporting? 

Likes

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 Professional ,
May 31, 2022 May 31, 2022

Copy link to clipboard

Copied

LATEST

Please post a screenshot of the fully expanded Action in the Actions Panel and describe what you want it to achieve differently. 

Likes

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