Jump to content

Applescript ignores the arguments


Recommended Posts

Posted

I have a "Script Filter" which only has this line....

   osascript test.scpt "{query}"

and test.scpt has this

 

on run argv
  set query to argv as text

  if query is "hi" then
    set query to "hi"
  else if query is "hello" then
    set query to "hello"
  else
    set query to ""
  end if

  display dialog query
end run

When I type the following in the Alfred search bar, "test hi", the dialog box shows nothing (it seems Alfred does not wait for the entire argument).

But if I run this script on the command line, it works correctly.

Posted

Try to pause between finishing typing and pressing . As Alfred re-runs the Script Filter on every keystroke, if you type too fast and hit too soon, it might still catch your old query.

 

Which leads us to: why are you using a Script Filter instead of a Keyword? A Script Filter is meant to show results dynamically, not for this type of operation.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...