Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Wait for user actions before completing script.

Engaged ,
Jul 04, 2019 Jul 04, 2019

Copy link to clipboard

Copied

Hi,

I've seen similar questions asked regarding this without a clear answer.

I am creating a script which should create several shapes.

Once the shapes are completed it should alert the user to move them and transform (one or all layers) as he sees fits and when this process is complete the script should continue to stage 2.

Is it possible to halt the script after the creation of the shapes and continue after the user completes?

The idea i have it to create 2 script, 1 for the shape creation and one for stage 2. Later in PS i will create an action which will run the 1st  script, stop and wait while the user transforms the shapes and continue to stage 2.

If i do use 2 script will i have to manually continue the action after i insert "stop" action?

Still it would be more elegant to do in a single java script if possible.

Dan

TOPICS
Actions and scripting

Views

1.4K

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

correct answers 1 Correct answer

Adobe Community Professional , Jul 06, 2019 Jul 06, 2019
I have created run twice scripts for use in actions. They are more or less save and restore scripts. In the first run these script save some information about the document and may make some changes to he document.  On the second run the scripts remove the saved information and restore the document  state using the saved information. Adobe Broke these scripts when the added their designer Bug ins CC 2015.5.    I now Add Garbage to the Documents info metadata it its not there to work around Adobe'...

Likes

Translate

Translate
Enthusiast ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

I have done this in the past.

The script is one and each time it runs, it runs throw it all until is finished.

The script itself must check if there are any shapes created and run accordingly.

So you must run the same script twice.

if (shapes exist?) {

     run when shapes exist

} else {

     create shapes

}

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
Engaged ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

That means you invoke it twice, correct?

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
Enthusiast ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

Yes.

In terms of faster productivity, you can add the script to a Photoshop action and add a Key shortcut to 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 ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

Make it with standard methods in the script almost impossible or very difficult and unstable working. Also depends on the version of Photoshop.

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
Engaged ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

Sorry, i did not quite get what you mean.

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 ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

I believe I would try to design a single interactive script where the user only need to be involved with interacts steps that requite the user to do a single thing.  The use is not in control of Photoshop the script is the user only completes interactive the scripts initiates for the user to complete to tweak the way the script does things its work. An example of this can be seen in my Free Photoshop Photo Collage and Mockup Toolkit .   Its InteractivePopulateCollage.jsx script is a good example.  The script has a simple dialog where you select a  collage template you want to populate and optionally check and select some options. Then click create Collage.

The script can populate collage templates with up to 53 images and optionally stamp text file names on the populated images. The script works on one image area at a time interactive with the uses help.  The Script first open the Template PSD and make a copy it will populate with the users help. The Script highlights the Image area for the image area being worked in. Then the script puts the user into a select image file dialog.  When the user select an Image file the Script places in the images file and resizes the smart object layer to fill the image's area and position the layer to the image area and mask the layer to the image area shape, unlinks the layer mask from the layers content. Then script the put the use into an interactive transform on the smart object layer content so the user can tweak or accept the image's composition in the image area.  After that the script will stamp the file name on the image if the user checked that option any the use will be put into an interactive transform on the text layer so the user can tweak the  size and location of the text. Layer Styles can also be added by selecting the  script options  The Script will then move on to the next image area and repeat the processing till all template images area are populated with images. Other script automate the whole process

Ththe Following link may or may not work for you Interactivly Populate Collage dialog

JJMack

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 ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

I too have made scripts where it will stop and run again for user interaction. I made a it create a text file that recorded the step that the script was on, so that when started again, it would read the text file and go to that step.

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 ,
Jul 06, 2019 Jul 06, 2019

Copy link to clipboard

Copied

I have created run twice scripts for use in actions. They are more or less save and restore scripts. In the first run these script save some information about the document and may make some changes to he document.  On the second run the scripts remove the saved information and restore the document  state using the saved information. Adobe Broke these scripts when the added their designer Bug ins CC 2015.5.    I now Add Garbage to the Documents info metadata it its not there to work around Adobe's designed Bug.

Three RUN Twice scripts I made public, others are private.   
1.) orient.jsx The first time this script is used it records the documents orientation into its metadata and will rotate Portrait orientated images to Landscape.  The second time this script is run the script will retrieve and removed the recorded orientation and will rotate back images that it rotated during the first run. This is an updated orient.jsx script this new implementation removes limitation present in the old implementation and preserves anything that may be present in the document metadata info instruction field. 
2.)SaveAndRestoreColors.jsx This script records Photoshop's current Foreground and Background swatch colors into the images metadata on the first run.  During the second usage the script retrieves and removes from the documents metadata the saved colors and set Photoshop's Foreground and Background colors to the saved colors.  
3.)SaveAndRestoreResolution.jsx This script records the current Image resolution and Photoshop's preferences units into the images metadata on the first run.  During the second usage the script retrieves and removes from the documents metadata the resolution and units it stored in the metadata during the first run. Sets the images resolution to it original resolution by resizing the image without resampling to the saved resolution and set Photoshop's preferences units to be the same as the saved units.  An action can run this script then change the images size without resampling which just changes the images resolution example Image resize resample not checked and set the width to 8".  Running the script a second time will restore the images size to what it was. Handy when you creating actions that you want to work on documents that vary in size.  Temporary setting the documents size to a known print size enables one to add text and logos of approbate size regardless of what the document actual pixel size is. This script provides a way the original document unknown pixel resolution can be restored to what it was to begin with.

Photoshop CC 2015.5: Script Metadata assigment error | Photoshop Family Customer Community

Adobe's BS is they do  not know the difference  between Info and Copyright fields. The Adobe Photoshop Stripping of copyright data and Photoshop changing copyright info to anything any use want to change it to is fine  However, allowing my Scripts to restore the Info field back to it  default empty state is very bad and will not be allowed.  So it will now be restored to garbage which is fine by Adobe. Garbage wins.

If you want to script Photoshop you need to be able to work around Adobe bugs. Adobe does not fix all acknowledges bugs reported the are known bugs in Photoshop scripting.

A particular nasty bug  with  Suspend history when a active section exist and resize is done.  Photoshop: Script bug resize layer back document up one history state | Photoshop Family Customer Co...  That bug was also reported a year before my acknowledge bug resize layer report by r-bin as a suspent History bug  for both condition are required for the bug to bite.  r-bin bug report  comment  from Adobe was Interesting. Photoshop scripting: suspendHistory and resizeBoundary conflict | Photoshop Family Customer Communit...Adobe Support is very frustrating.

JJMack

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
Engaged ,
Jul 09, 2019 Jul 09, 2019

Copy link to clipboard

Copied

I'll adopt the 2 script option since, in my case the user does need to interact with PS.

Still I would like to save some data from the 1st part to be used in the 2nd.

What would be the best approach, in your opinion, o save some data to be used later on?

Should i simple create a text file and write it, or is there a more elegant way?

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 ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

I save and remove data for a document in the document Meta data info field. However, in CC 2015.5 Adobe engineered a bug into scripting they felt it was bad foe me to restore the Info field back to its default empty state. To get around this I now add Garbage to the info filed. Garbage is acceptable by Adobe.

JJMack

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 ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

I write xml files. This is mainly to save presets for UIs that I create.

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 ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

What information do you want to save?

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
Engaged ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

the default choices the user selected  i want the script to start with the last selected options

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 ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

Yes, that's what I do with many on my scripts. An example would be in the PS subfolders for the deco scripts _menu.jsx, I think. I help them with that.

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 ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

Check out this thread for a script that will record a UI's settings and apply them.

 

Memory Checkbox

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 ,
Aug 07, 2021 Aug 07, 2021

Copy link to clipboard

Copied

LATEST

Make one conditional script you call using some shortcut. When it's ran first time, the user is supposed to add shapes. When it's ran another time, the script checks if shpaes have been created. If not it does nothing. If they were created the script runs its second condition.

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