Copy link to clipboard
Copied
Hi, I wonder if the following is possible in the script:
if ("file-scripts-myscript"click + f.ex. Option key){ do this} else {do that}
Can't find any hints.
I see, yes it's possible. You can use ScriptUI keyboard state even if there's no actual UI.
place this at the beginning of your script to test for Shift or Alt keys
if(ScriptUI.environment.keyboardState.shiftKey) {
alert ('Shift Key pressed...')
// do your thing
}
if(ScriptUI.environment.keyboardState.altKey) {
alert ('Alt Key pressed...')
// do your thing
}
Copy link to clipboard
Copied
can you please elaborate? I'm not sure what you're trying to do
Copy link to clipboard
Copied
Hi Carlos
It's probably not possible, but the dream scenario is:
if you navigate to a script from the Illustrator file menu and press Option (or Shift or Command) while clicking on it, it will open one pop -up window, but if you just click, it opens another window.
Does it make sense?
Copy link to clipboard
Copied
I don't know how to do that. If your script first opens a ScriptUI window you might have a better chance. See https://creativepro.com/files/kahrel/indesign/scriptui.html section on "Listening to the keyboard". Maybe? Sounds like it isn't quite what you want. I wondered if you could check for option (.altKey) during a scriptUI window.onShow event?
Copy link to clipboard
Copied
I see, yes it's possible. You can use ScriptUI keyboard state even if there's no actual UI.
place this at the beginning of your script to test for Shift or Alt keys
if(ScriptUI.environment.keyboardState.shiftKey) {
alert ('Shift Key pressed...')
// do your thing
}
if(ScriptUI.environment.keyboardState.altKey) {
alert ('Alt Key pressed...')
// do your thing
}
Copy link to clipboard
Copied
Thank you Carlos.
Works exactly the way I wanted 🙂