Jump to content

cjcolyer

Member
  • Posts

    4
  • Joined

  • Last visited

cjcolyer's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. This works great for me. Thanks for the handy workflow James.
  2. Thanks for sharing. This tool is exactly what I was looking for.
  3. Carlos. Thank you! This is exactly what I wanted it to do. Comparing your code to mine, I now understand that if I wish to pass a string from Alfred to Applescript, I must: a. include "{query}" in the set command, and b. declare the variable as text. and c. Your code hooks into /usr/bin/osascript which is different from the Run NSAppleScript action baked into the Workflow Action list. I really appreciate your help.
  4. I am writing a paper with a fairly substantial lit review. I manage my citations in <a href="http://www.thirdstreetsoftware.com/site/SenteForMac.html>Sente</a>. Sente assigns a citation key to each reference in its database (usually the lead author's first name and the publication year). When writing, I can point to various references in the manuscript by embedding the citation key in curly brackets {Colyer 2013}. On compile, the software handles all the tedium of converting the reference to the proper citation format (APA, Chicago, MLA, etc) and generates a Bibliography page). There are various switches in the cite key that modify how Sente renders the citation in text. For instance {Colyer 2013@12} will be converted to a page number reference (Colyer 2013, pg 12); {%Colyer 2013} strips the author (2013), etc and so forth. I started using Smile's <a href="http://www.smilesoftware.com/TextExpander/index.html ">TextExpander</a> to insert these cite key permutations with a minimum of friction. [Yes, I know that Alfred2 has text expansion capabilities and I may be open to using them as a solution to my problem. But TextExpander's ability to embed a snippet in other snippets is fundamental to my workflow. TextExpander allows me to set one snippet containing the author & year and then embed that snippet in other snippets that generate standard citations, page number citations, and author omitted citations. In my current writing workflow, I manually modify the author year in the base snippet and it works great. It occurred to me that Alfred2 should be able to let me modify the Author Year Snippet through a keyword trigger further reducing my writing friction. I started teaching myself AppleScript and with the help of Smile's excellent tech-support, I now can populate the text of my root Cite Key through AppleScript. I tried to create a keyword workflow in Alfred2: ck foo 2012 which should pass the string foo 2012 to a variable _citekey which TextExpander will set to the plain text expansion of my root cite key. My workflow does not work. When I trigger the workflow the plain text expansion of the target snippet does not change. Can someone help me figure out what I've done wrong? on alfred_script(q) -- This script sets the cite key to a variable _cite key -- Next we want to try and populate the _citekey variable by Alfred. set _citekey to q on snippet_by_abbreviation(abrvStr) -- written by Smile Tech Support on 2013-05-09 set theSnippet to null tell application "TextExpander" repeat with theGroup in every group set theSnippets to (snippets of theGroup whose abbreviation is abrvStr) if (length of theSnippets > 0) then set theSnippet to item 1 of theSnippets exit repeat end if end repeat end tell return theSnippet end snippet_by_abbreviation set mySnip to my snippet_by_abbreviation("!CK!") if (mySnip ≠ null) then tell application "TextExpander" set (plain text expansion of mySnip) to _citekey end tell end if end alfred_script
×
×
  • Create New...