Skip to main content
Participant
August 17, 2014
Question

sendkeys to PS via .js script

  • August 17, 2014
  • 1 reply
  • 1363 views

Hello,

I want to call a recorded action thru a custom panel button (the action to call is a plugin-function, which I cant access thru the panel configurator) .So I assigned shortcut-keys for this action and these should be send to PS thru a .js script.

This is my code for testing:

var WshShell = WScript.CreateObject("WScript.Shell");

WshShell.AppActivate("PS");

WScript.Sleep(300);

WshShell.SendKeys("{F1}");

When I run the script with cscript.exe (WINDOWS 8), then the PS Window gets activated, but apparently no "F1" Key is sent, because no new window opens.

Can you help me, please?

This topic has been closed for replies.

1 reply

c.pfaffenbichler
Community Expert
Community Expert
August 18, 2014

Wouldn’t it be more convenient to trigger the Action via

app.doAction()

?

Participant
August 18, 2014

it would be, but this does not work in this case.

I cant record the action  - which is a plugin-function - whithout its instant execution - that is - i want the action just to open the menu of the plugin, but not its instant excecution - when replaying the action.

Your plan works with some functions, but not in any case.

So I added shortcuts for these and these shortcuts just open the menu of the plugins - so sending keys with a script would probably do it.

c.pfaffenbichler
Community Expert
Community Expert
August 18, 2014

Have you tried using the AM code?

Or checking »Toggle dialog on/off« in the Actions Panel?

Or using app.runMenuItem()?