Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Why do you not perform whatever the Keyboard Shortcut triggers via the Script?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.