quicksilver / Quicksilver

Quicksilver Project Source
http://qsapp.com
Apache License 2.0
2.74k stars 286 forks source link

[Bug]: Run as AppleScript command returns "Undefined" to the first pane in some instances #2922

Closed abstractrealism closed 11 months ago

abstractrealism commented 2 years ago

Before submitting your bug report, please confirm you have completed the following steps

Bug description

In certain cases when I run a text command as AppleScript in Quicksilver, the QS interface will pop back up after the command is done running with "undefined" in the first pane. The only program I really use this functionality with is Photoshop, so I'm not sure if it happens with other programs. Additionally, it doesn't always happen, it seems like it's particularly if I use AS to tell Photoshop to run Javascript, whether a file or a typed snippet. (The reason I'm doing this is that it's an easy way to use QS triggers to make keyboard shortcuts that PS doesn't allow, such as with just the control or option key, no Command). The QS interface popping back up is a mild inconvenience, but losing what I'd typed if I forgot to copy it before running is more annoying. I don't know when this bug started, as I've been on Windows for the last two years (a dark time..), and previously was on Mojave with a different machine, different QS version, different PS version, so I have no idea whether it's MacOS, QS, or Adobe causing the issue, but back then I used this same technique without a problem so something changed, somewhere.

Steps to reproduce

  1. Enter the text entry mode in QS by hitting . (period key)
  2. Type/paste in an AppleScript command for photoshop, such as tell application "Photoshop" to do javascript "alert('hello world')"
  3. Hit enter to run the script, which will run just fine
  4. The QS interface will re-open, saying "undefined" in the first pane, and with the Large Type command selected

Expected behavior

The command to run, as it does, and that's it, no need for QS to re-open, and the next time I invoke it I'd expect the AS snippet to still be there (barring some other reason for it to not be).

MacOS Version

macOS 12

Quicksilver Version

2.4.0 (4039)

Relevant Plugins

I have the Extra Scripts and Terminal plugins installed, though I don't believe either should be making a difference here.

Crash Logs or Spindump

No response

Screenshots

Screen Shot 2022-08-19 at 12 30 46 PM Screen Shot 2022-08-19 at 12 30 53 PM Screen Shot 2022-08-19 at 12 30 56 PM

Additional info

No response

n8henrie commented 2 years ago

Do you have any other examples of this behavior? I don't have Photoshop, and I'm not sure whether or not it's necessary to reproduce this issue. It would be helpful if you could give an example with some Apple-provided software (or something open source like FIrefox -- which doesn't seem to support do javascript) so I can test on my end.

For example, Safari supports do javascript as long as you "tell" a specific tab (and enable "Allow JavaScript from Apple Events" in the "Develop" menu):

tell application "Safari" to do JavaScript "alert('hello world')" in current tab of first window

Running this reliably gives me a hello world in Safari and no undefined window in QS.

abstractrealism commented 11 months ago

Apologies for never replying, I thought I had. Photoshop is the only program I've experienced this in.

If anyone stumbles upon this who's having the same issue, I just discovered that adding "return" at the end of the AppleScript fixes it, so it returns nothing instead of the "undefined" that it was sending. Everything works fine that way!

n8henrie commented 11 months ago

Thanks for the followup!