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.
Maybe try with following line at beginning:
displayDialogs = DialogModes.NO
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.
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.
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
Maybe try with following line at beginning:
displayDialogs = DialogModes.NO
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.
Copy link to clipboard
Copied
Please post a screenshot of the expanded Action in the Actions Panel.
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.
Copy link to clipboard
Copied
Have you tried »Insert Menu item«?
Copy link to clipboard
Copied
I'm not familiar with that command! I can't find it!
Copy link to clipboard
Copied
See the Actions Panel’s pop-up menu.
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.
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.
Copy link to clipboard
Copied
I marked my answer as correct, as you didn't while I understand that was right solution?