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

Using a Script in an Action without seeing a dialog box

Participant ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

===================

var doc = activeDocument
doc.resizeCanvas(Math.min(doc.width,doc.height),Math.min(doc.width,doc.height))

===================

I have run the above two line script on individual landscape and portrait photos and it works. It crops the photos to a square using the dimension of the shortest side. No Canvas Size dialog box appears.

 

However, if I integrate the Script into an Action and start a batch of photos the Canvas Resize dialog box appears needing an OK confirmation for each photo.

 

Is there anyway I can stop the Canvas Resize dialog box appearing?

 

Any help would be appreciated. Thanks in advance.

TOPICS
Actions and scripting

Views

2.2K

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

LEGEND , May 24, 2020 May 24, 2020

Maybe try with following line at beginning:

 

displayDialogs = DialogModes.NO

 

Votes

Translate

Translate
Adobe
Community Expert ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

I had no problem and had no dialog.  I created a one step action and batched it via Image Processor Pro.  I'm sure Adobe's script Image Processor could also be used.  I find these Script are more flexible than Automate Batch.  I may use that it I want to replace the source images with square replacements. I tend not to batch replace image files.
Capture.jpg

 

image.png

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
Participant ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

Thanks JJMack. I don't have Image Processor Pro. The Image Processor looks like it should work. However, I prefer to highlight files in Bridge and then run Tools > Photoshop > Batch. If I can't save a script in an Action I will have to try the Image Processor.

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

Copy link to clipboard

Copied

LATEST

Whay doe you perfer to iset  Bridge menu Tools>Photoshop>Batch the when there are also menu intems in that photoshop menu for Image Processor... and Image Processor Pro... as well as Batch...

image.png

 

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
LEGEND ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

Maybe try with following line at beginning:

 

displayDialogs = DialogModes.NO

 

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
Participant ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

Thanks, I used a simlar line and it worked but I now have another problem recording the script in the Action.

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

Copy link to clipboard

Copied

Please post a screenshot of the expanded Action in the Actions Panel. 

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
Participant ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

Thanks for the replies. I was getting somewhere using these extra lines:

app.displayDialogs = DialogModes.NO;
var doc = activeDocument
doc.resizeCanvas(Math.min(doc.width,doc.height),Math.min(doc.width,doc.height))
app.displayDialogs = DialogModes.YES;

 

It worked. I had saved the script in an action which I deleted. I then tried to repeat the process but I cannot get the Action to record the script. Have I toggled something on or off that is making the recording of an action behave differently? I noticed there is no tick next to the title of the Action.

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

Copy link to clipboard

Copied

Have you tried »Insert Menu item«? 

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
Participant ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

I'm not familiar with that command! I can't find it!

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

Copy link to clipboard

Copied

See the Actions Panel’s pop-up menu. 

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
Participant ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

Thanks for that suggestion. YES YES YES that's worked. I didn't know about that function to add menu items to an Action. Thanks again. I've added two scripts to the action, one to crop to a square and the other to save the photo as a JPG with STANDARDBASELINE. Very happy. Cheers.

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
Participant ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

A big "THANK YOU" to everyone. With everyone's help I've got two scripts working in one action so I'm now ready to batch all the photos that need cropping and saving as squares. Cheers everyone.

 

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
LEGEND ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

I marked my answer as correct, as you didn't while I understand that was right solution?

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