Skip to main content
Participant
February 9, 2014
Question

Dialog button, triggers keyboard key

  • February 9, 2014
  • 4 replies
  • 1592 views

Ok so I'm new to scripting and I hope this makes sense. I'm trying to write a script that works with adobe configurator 4 script button. It's a button on a dialog that runs a script on clicking the dialog button. Now all I'm trying to get it to do is trigger a specific keyboard key for me. It's used for a onscreen keyboard type panel allowing me to not use my keyboard. The script would trigger the keyboard key, that key is assigned to a keyboard shortcut. Click button -> trigger keyboard key or keys. Hope someone can help me figure this out.

This topic has been closed for replies.

4 replies

Inspiring
February 12, 2014

I think you can do this with a vb script or on mac with apple script.

this a vbscript code that press the ctrl+v keys:

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.SendKeys "^v"

and this is the .command  version for macos:

echo "

tell application \"System Events\" to keystroke \"g\" using command down

" | osascript

If you want to see this scripts in action you can check this panel I've developped, http://buliarcatools.blog.fc2.com/blog-entry-6.html, when you are clicking on a folder button the open file dialog apear in Photoshop, than a keystroke of ctrl+v and enter is triggered to paste the previous copyed path.

Inspiring
February 10, 2014

ExtendScript runs under Photoshop as it's host app. It has very little access to the OS. You can't access the keyborad buffer. As suggested you can create a script that does the same action as the shortcut you want to use then transfer the shortcut to the new script.

Chuck Uebele
Community Expert
Community Expert
February 10, 2014

I would agree with c.pfaffenbichler.  While someone may know a way to do this, as far as I know, most coding programs do not allow you to do this type of thing for security reasons: any keyboard input needs to come from the user and not from generated code.

c.pfaffenbichler
Community Expert
Community Expert
February 10, 2014

Why do you not perform whatever the Keyboard Shortcut triggers via the Script?

Participating Frequently
February 10, 2014

I have been trying to find a way to do this as well. There are MANY built in hotkeys that are at the system level that Photoshop does not provide customizable commands for. In my case, I really want to make a configurator panel with CTRL, ALT, SHIFT, and SPACEBAR toggle buttons for when I am using my laptop in tablet mode without a keyboard handy.

I would be very interested in knowing if it is possible to send a software keyboard event maybe without having to go all the way out to the system level.