Copy link to clipboard
Copied
I have a simple UI for my artists that does some modifications to his files then saves it to the folder of his choice.
However it gets quickly tedious to re-enter the path every time he uses the script.
I would like to remember the path he previously entered or use the path that Photoshop uses as a default.
How can that be done?
Here's the script if someone is interested, it allows you to save out your groups as PNG's with possible additional blurred versions:
Photoshop PNG Blur Save - Pastebin.com
Message was edited by: Jeremy Vansnick
Change beginning of your script to:
PTH = ""; displayDialogs = DialogModes.NO
var Path = $.getenv('pth') || PTH || "d/";
// for saving files
var doc = app.activeDocument;
And in the middle where you last time insterted new part, edit that to:
dlg.show();
$.setenv('pth', Path.slice(1))
if (PTH != ge = $.getenv('pth')) {
(fle = File($.fileName)).open('r'), jsxFile = fle.read()
.replace(/"(.*)"(?=;)/, '"' + ge + '"'), fle.close()
fle.open('w'), fle.write(jsxFile), fle.close()
}
Additionally what
...Copy link to clipboard
Copied
Create new script and put there only this line documents.add(1, 1, 1).close(). Then save and run.
Copy link to clipboard
Copied
Error again: https://i.imgur.com/JCxNmft.png
I checked his PS version he has the same as I do: 2017.0.1 Release
Copy link to clipboard
Copied
We can only dig deeper, so try now with only: documents.add(1, 1, 1)
If that works then: documents.add(1, 1, 1), activeDocument.close()
Copy link to clipboard
Copied
Same error with documents.add(1,1,1) only
Copy link to clipboard
Copied
Try this: documents.add()
Copy link to clipboard
Copied
Hahaha it actually worked when using: documents.add()
I tried it with the whole script and now it works great! Thanks dude
Copy link to clipboard
Copied
Try something else though:
documents.add(1, 1)
then:
documents.add(null, null, 1)
then:
preferences.rulerUnits = Units.PIXELS
documents.add(1, 1, 1)
then:
preferences.rulerUnits = Units.PIXELS
documents.add(100, 100, 72)
then:
documents.add(1, 1, 72)
then:
documents.add(100, 100)
then:
preferences.rulerUnits = Units.PIXELS
documents.add(1, 1, 72)
and then:
preferences.rulerUnits = Units.PIXELS
documents.add(100, 100)
and tell me which worked on his computer and which didn't.
Copy link to clipboard
Copied
Well it's a real mystery.
I tried a first time your list: the 1st one =>
And it gave me an error.
Then I tried the rest of your list, they all worked.
Then I tried the first one again and it worked!?! Then I tried documents.add(1,1,1) and it also worked.
Ah yes, now I know it's because of the prefs had changed and were set to pixels ofc.
Copy link to clipboard
Copied
I wanted to ask you what ruler units he has set, but it's too late to check it. Restarting Ps may result the same problem...
Copy link to clipboard
Copied
They've been overwritten by the script, I'll ask him tomorrow when he's awake. I think it's percentage but I'm not sure.
Copy link to clipboard
Copied
Yes they are. I thought so even. Now I tried it with percentages. So here's a bug. I remember I wanted to use ruler units in some code I wrote for you, but as far as I didn't see anything wrong happen I leave this idea. Now you should put at end of 1st line this: preferences.rulerUnits = Units.PIXELS
Copy link to clipboard
Copied
Yes it makes sense that it would be due to percentage.
Just as a curiosity, do you think there are still possibilities to make the script faster?
Copy link to clipboard
Copied
That 30 percentage faster performance you got today should be enough, or how many layers they use per one document?
Copy link to clipboard
Copied
They use documents of around 5-6k resolution with something like 200 layers. The last optmization was definitely a good one.
Copy link to clipboard
Copied
Hey Kukurykus,
I'm implementing the search path but I just realized that since I actually want to find a folder and not a file with extensions, the problem is not the exact same as the person who posted this on the forum.
So I'm using this line to create a dialog where I could select the path: myFile = File.openDialog ('Select a folder...');
But what can I do to allow the selection of FOLDERS as if they were a FILE?
Secondly: I'm trying to save the Prefix in the .jsx file the same way you did for the path. I need to replace the 2nd line of the script instead of the 1st in that case. What can I do to achieve this?
Copy link to clipboard
Copied
With alert, it never closes the groups down. Without alert: 3/4 closes the groups down.
What groups are you talking about? If about LayersSets, then in CC2018 you can use
executeAction( stringIDToTypeID("collapseAllGroupsEvent"), undefined, DialogModes.NO );
Copy link to clipboard
Copied
I meant ArtLayers yes, that's good but it's not as useful as Kukurykus's solution because it also allows to keep whichever groups were opened opened, thanks for pitching in r-bin. (and I'm on CC2017 right now ).
I updated the script to remove the chars " and ' from the folder path and if the folder is incorrect it won't execute the script now:
Photoshop:PngGroupSave - Pastebin.com
Copy link to clipboard
Copied
That was last 40 post (39 reply) of first page. It was resolved on second page theard, however when I get one day the newest version I'm going to use collapseAllGroupsEvent. It's the same with textToClipboard that works in later version. Anyway that's really ridiculous Adobe needed about 15 years to implemenet finnaly collapseAllGroupsEvent, if that was enough easy (of course with some advanced scripting understanding) to implement it for me in 1,5 hour. That shows their ignorance to users in some range of their utilities. They are probably focused on their marketing, so if something isn't worth to earn more money then even passion can't help to change things for better. Once again, 15 years for so simple thing, but making people mad when many layer sets in range of one document stays opened that users can't find anything in this mess untill they close all manually. Shame. I was only guessing how many years that took. I didn't know exactly, but then I searched for this information on google to be more precise and it seems I wasn't wrong even of 1 year (if CC18 was released in 2017). Just read this article about new feature of Photoshop 7 from March, 2002 (that wasn't even part of CS series yet):
Find more inspiration, events, and resources on the new Adobe Community
Explore Now