Scripts run when "Enter" is pressed in edittext

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

ddbell

Scripts run when "Enter" is pressed in edittext

Post by ddbell »

I've noticed that scripts will run when a user presses the enter key after entering text in the edittext box. Is there a way to prevent this from happening?

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

Mike Hale

Scripts run when "Enter" is pressed in edittext

Post by Mike Hale »

ScriptUI will make a button the default button if it has the text of 'Ok' or the name 'ok'. With a default button in the dialog enter is handled by the default button's onClick callback. Even if the button does not have focus.

To prevent the dialog from closing when the user presses enter just rename or relabel the Ok button.

If you really wanted the button name/text to stay Ok you could add a keyboard event handler to the onClick callback to trap the enter key.
ddbell

Scripts run when "Enter" is pressed in edittext

Post by ddbell »

I'll just rename the button since that's all it takes.
Thanks