Align+Offset Active Layer

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

JokerMartini

Align+Offset Active Layer

Post by JokerMartini »

Does anyone know of a solution to the problem of the bugging out of the script.

It bugs out when the user makes the selection and then changes the active layer and tries to run the script.

Bug:
setup:Canvas = 800 x 800; Layer 1 = 400 x 400; Layer 2 = 60 x 60; Layer 3 = 20 x 20

1. Layer 1 is the active layer. Ctrl click this layer to make the selection
2. Then make Layer 2 the active layer and run the script and choose top left
3. Then make Layer 3 the active layer and run the script and choose top left


No Bug:
1. Layer 2 is the active layer. Ctrl click Layer 1 to make the selection
2. Then make sure Layer 2 the active layer and run the script and choose top left

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

JokerMartini

Align+Offset Active Layer

Post by JokerMartini »

Is there some way to have it recalculate the selection and the active layer when the button is clicked....maybe that will fix it.
JokerMartini

Align+Offset Active Layer

Post by JokerMartini »

I've got two questions for this.
So I've nearly got this entire script complete. I've got two final tweaks.

1. Does anyone know of a way in which I can either include the images into the script so there is no seperate install or is there a clever way I could use a dummy image or ui item if the images are not valid, rather than the script failing entirely?

2. Is there a way I can make the keyInput function accept "-" (minus) signs so users can put in a negative value into the px offset field?


Thanks you guys for all your help on this so far.

John
Mike Hale

Align+Offset Active Layer

Post by Mike Hale »

1. I think it depends on the image. There are some resource images you can use with a dialog but they are rather limited. You can also create a small panel and give it a background color to make simple solid-color rectangle 'images'. But really the answer is you need to have an installer to make sure the image is on the system or at least check to see if the image is there and a if statement that add the image if it exists or a spacer( or statictext ) the size of the image if it is not.

2. Add event.keyName == 'Minus' to the if statement in the keyboard handler you are using.