Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with three-pane AppleScript actions #2071

Closed
Sesquipedalian opened this issue Jul 3, 2015 · 0 comments
Closed

Problems with three-pane AppleScript actions #2071

Sesquipedalian opened this issue Jul 3, 2015 · 0 comments

Comments

@Sesquipedalian
Copy link

AppleScript actions that take an optional indirect object always end up receiving a randomly selected indirect object even if the user didn’t select anything in the third pane.

To reproduce, try the following:

using terms from application "Quicksilver"
 on process text thetext with args
 return "1. " & thetext & " 2. " & args
 end process text

 on get argument count
 return 3
 end get argument count

 on get direct types
 return {"NSStringPboardType"}
 end get direct types

 on get indirect types
 return {"NSStringPboardType"}
 end get indirect types
end using terms from

I have also found that the third pane will have random stuff in it for AppleScript actions that require a third pane selection, like so:

using terms from application "Quicksilver"
 on process text thetext with args
 return "1. " & thetext & " 2. " & args
 end process text

 on get argument count
 return 2
 end get argument count

 on get direct types
 return {"NSStringPboardType"}
 end get direct types

 on get indirect types
 return {"NSStringPboardType"}
 end get indirect types
end using terms from

It looks to me like there are two issues happening here:

  1. AppleScript actions that have an optional third pane should always have the third pane empty by default, but they don’t.
  2. For compiled three-pane actions, QS will pre-populate the third pane with the highest ranking catalog item that matches the action’s criteria for the third pane. This is possible because the compiled actions have to declare this criteria in their Info.plist (or somewhere like that), enabling QS to know it in advance. But for AppleScript-based actions, there is no way for QS to know the criteria in advance; it has to be discovered at run-time. So it just grabs something on the fly. (Perhaps the most recently indexed catalog item that matches the criteria, but who knows?) This affects all AppleScript actions that use the third pane, regardless whether the third pane is required or optional.

A good solution for the first problem would be to change the code to ensure that the third pane is always cleared the moment that an AppleScript-based action with an optional third pane is selected in the second pane.

The best solution to the second problem would be to ensure that QS always grabbed the top-ranked item for whatever criteria the AppleScript action defined for its third pane. Alternatively, a quick and dirty fix would be to clear the third pane any time any three-pane AppleScript action is selected in the second pane. That would be a bit less useful, since the user would always need to type something into the third pane. But since we have to do that anyway with the current situation, it would still be a step forward. At least we’d be forcing the user to make a good selection instead of suggesting a terrible selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant