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

Using a Script in an Action without seeing a dialog box

Participant ,
May 24, 2020 May 24, 2020

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

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
2.6K
Translate
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

 

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

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
Translate
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

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.

Translate
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
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
Translate
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

Maybe try with following line at beginning:

 

displayDialogs = DialogModes.NO

 

Translate
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

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

Translate
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

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

Translate
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

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.

Translate
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

Have you tried »Insert Menu item«? 

Translate
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

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

Translate
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

See the Actions Panel’s pop-up menu. 

Translate
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

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.

Translate
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

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.

 

Translate
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

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

Translate
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