Jump to content

Passing variable to app


Recommended Posts

Dear, all, As recent Alfred convert, I am enthusiastically exploring the options. One thing I cannot find out is how to run a WORKFLOW for the following use case: I am using Foxtrot Personal Search intensively to work with ~1M documents. To start a search I use Alfred. However, currently, I only trigger an existing AppleScript I created through an Alfred hotkey to open a search in FoxTrot. As a result, when I press the hotkey, AppleScript opens a non-Alfred window to provide the search field, which is then passed to the app. The AppleScript is as follows:

on alfred_script(q)
set FS to display dialog "Search for?" default answer ""

set query to text returned of FS tell application "FoxTrot Personal Search"     

search {query}

end tell
end alfred_script

 

It would be great if I could use the default Alfred input window for this, but I don’t seem to be able to pass my search input to the app other than by using the AppleScript. 

 

Can anyone please help me with a sample workflow? Thank you!

Link to comment

I can't test it with FoxTrot, but if you use a Run script (recommended over Run NSAppleScript) object, this below should achieve what you want. 

on run argv
	tell application "FoxTrot Personal Search" to search for (first item of argv)
end run

image.thumb.png.e542ed0015834babf001803f4935daaa.png

Link to comment
Posted (edited)

Hi Giovanni,

Thank you and I tried it immediately. It opens the app but with a blank search field, no search results on the keyword :-(.

I think the missing link is to capture and pass the input to the script/FoxTrot.

 

Here’s the workflow I have - can you see / tell me what I do wrong?

 

1. OVERVIEW

1003155614_Screenshot2021-05-16at12_04_05.png.8076a0d483f93ec5877df22cbc74791e.png

 

2. INPUT KEYWORD

988584728_Screenshot2021-05-16at12_04_16.png.6c83c823f4953143a83093ce71e04664.png

 

3. SCRIPT

1928995737_Screenshot2021-05-16at12_04_28.png.1be3f3026c0964b7865e20fab94bcf0a.png

 

Thank you!

Screenshot 2021-05-16 at 12.04.05.png

Edited by JimBol
Link to comment

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...