Jump to content

How to update List Filter?

Recommended Posts

Short version:

I have dropped a csv file in the List Filter. How to auto-update(without manuallly dropping the csv file again) it? 


Long version:

1. I have populated the List Filter with Customer names which were exported from a Filemaker table and then re-formatted to match Alfred's [title,subtitle,arg] syntax.


2. New customers will be added in the Filemaker table. The List Filter needs to be updated with those names.



Link to comment

Thanks for the help. Since you confirmed that I must edit the plist, I found a way to change the relevant entry. This is what it looks like:

tell application "System Events"
set plistFile to property list file "/Users/<myusername>/Sync/Alfred.alfredpreferences/workflows/user.workflow.A729E97A-5F14-41EF-9F29-77CEFDAB65BC/info.plist"

set itemNodes to value of item 1 of property list items of property list item 1 of property list item 3 of property list item "objects" of plistFile

set newentry to "{\"title\":\"NewName (Place)\",\"arg\":\"NewName (Place)\",\"subtitle\":\"\"}"
set newString to my str_replace("]", "," & newentry & "]", itemNodes)
set itemNodes to newString
set value of item 1 of property list items of property list item 1 of property list item 3 of property list item "objects" of plistFile to itemNodes
end tell

on str_replace(find, replace, subject)
end str_replace

Now, I will create a workflow "Update Customers" which shall get names from Filemaker and update the plist. 

Link to comment

This really isn't the right way to do it. You should use a Script Filter instead. That's what they're designed for.

Instead of editing info.plist, save the JSON data to a file and set your Script Filter script to:

cat /path/to/json_data.json
Can Filemaker export an Excel file? If so, you could use this workflow to display the contents of the Excel file in Alfred. It automatically picks up changes to the Excel file. Edited by deanishe
Link to comment

0. Demo works correctly.

1. Duplicated workflow

2. Changed bundle id

3. Replaced demo.xlsx with my .xlsx

4. Changed environemnt variable DOC_PATH

5. Changed keyword to isyn x

6. Open Alfred and typed isyn x

7. Fatal Error in workflow: array index out of range

8. All code in python, I can't do anything but post here:)


The other alternative of using json file. I have got that to work.

Edited by rounak
Link to comment

If yours works, then fine. There is a latent bug in the JSON generation, however, and it will explode if, say, a backslash or double quote pops up in one of your values (because you aren't escaping the strings before you add them to your JSON, as best as I can tell).

WRT the workflow I linked to, there was a bug that required there to be three columns. Fixed now. Redownload (version 0.1.1) and set SUBTITLE_COL and VALUE_COL to 0 (zero) in the config sheet.

There's no need to duplicate the workflow yourself: You can use the keyword isyn to search for and choose an Excel file. There's no need to put your excel file in the workflow (that's kind of the point). The workflow will notice whenever the file changes.


I'm afraid I haven't documented the workflow properly yet. You can download and watch the demo here (it's too big to view on GitHub).

You can also read the program's built-in help by running the isyn program in the workflow directory in your terminal with ./isyn -h

Edited by deanishe
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...