Hi Deanishe,
Sorry, but I wonder if you can help a bit more. I'm sorry for the newbie question. I am working with a python script that output an XML (using your Workflow library). It prepares a dictionary like this, where the values have been extracted previously from a text file, etc.
<EDIT>: after digging around a bit more, I suspect that I am using a Workflow library that is too old. I guess I need the V2 branch. I'll try to figure out how to add it...
</EDIT>
_dict = {'title': title,
'uid': _arg,
'valid': True,
'arg': _arg,
'subtitle': sub
}
After your previous suggestion, I found the example XML file for a script filter of this kind, which recommends using something like this:
<item uid="home" arg="~/" valid="NO" autocomplete="Home" type="file">
<title>Home Folder</title>
<icon type="fileicon">~/</icon>
<subtitle>Home folder ~/</subtitle>
<subtitle mod="fn">Subtext when fn is pressed</subtitle>
<subtitle mod="ctrl">Subtext when ctrl is pressed</subtitle>
<subtitle mod="alt">Subtext when alt is pressed</subtitle>
<subtitle mod="cmd">Subtext when cmd is pressed</subtitle>
<quicklookurl>https://www.alfredapp.com/</quicklookurl>
<mod key="shift" subtitle="New subtext when shift is pressed" valid="yes" arg="shiftmod"/>
<text type="copy">Text when copying</text>
<text type="largetype">Text for LargeType</text>
</item>
But I can't seem to figure out to properly add additional items to _dict.
When I use, for example:
_dict = {'title': title,
'uid': _arg,
'valid': True,
'arg': _arg,
'subtitle': sub,
'subtitle mod=\"cmd\"' : "whatever",
}
I get an error "unexpected keyword argument ". It is ultimately sent to Alfred like, this, with prep_res being the array of _dict(s), I think. What generates the error is the add_item.
for item in prep_res:
wf.add_item(**item)
wf.send_feedback()
I'm sure I'm not constructing the dict properly, but I'm afraid I'm in over my head. The entire script is here: https://dl.dropboxusercontent.com/u/565419/bibquery.py.
Ideas? Many thanks.