Jump to content

smarg19

Member
  • Posts

    505
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by smarg19

  1. This workflow isn't functioning for me. In trying to figure out why, I also found that the workflow has no way to report errors in the only "real" step, the shell script. That aside, I tried simply to run this shell command in Terminal:

    sudo kextunload -bundle-id com.apple.driver.AppleUSBTCKeyboard
    
    And I got this error:

    (kernel) Kext com.apple.driver.AppleUSBTCKeyboard not found for unload request.
    Failed to unload com.apple.driver.AppleUSBTCKeyboard - (libkern/kext) not found.
    
    How can I fix this and thus fix the workflow?
  2. Not sure exactly how you get new cards into Anki, but I was thinking, giving the scripting support, that you could automate it. So, the process would be:

    [1] open Alfred

    [2] type card data

    [3] workflow appends that to a text file

    [4] (later) open text file

    [5] edit cards (1 per line) with any desired Close Deletions

    [6] script iterates over lines of file and sends each one to Anki as individual card.

    That was what I was imagining, tho again, I know nothing about how Anki works.

  3. The best cards are generally short and to the point, and Alfred may be useful for creating them. Using Anki correctly requires that the cards not cover more than a topic or two. After a card is presented you tell Anki if you knew the topic, if it was "fuzzy" remembering it, or if you flat out had no idea. Based on your input Anki calculates when to show you the card again based on the algorithm.

     

    I love that Alfred never gets in the way. Its always there, but like a silent friend ready to spring into action at a moments notice. I'm always reading something, and consequently most of my cards are just copy/paste. If I could call up Alfred and input some text into Anki without making the Cloze Deletions, it would still save abundant time. I wouldn't skip a beat, and later I could go in and add some brackets with little effort.

    Why not just have a simple workflow that allows you to add text to a file, line by line. You pop up Alfred, enter the appropriate keyword, then your text, then enter and Alfred disappears. Once you are done with whatever you were doing, you open the text file, edit the lines however you like with the Cloze Deletions, then send that to Anki. That seems like close to what you want, but also insanely simple (I know there is already a log to text file workflow out there).

  4. Is it possible? Yes, basically. Evernote cares nothing about note titles. You could have every single one of your notes have the same title, and Evernote wouldn't bat an eye. It assigns unique note-ids to every note for uniqueness, so titles aren't important. This is why the script creates a new note, because the fact that it has the same title is of no importance (you could also change the title in the editing). My basic idea was to make the script as lightweight as possible (thus as bug-free as possible), so that users could use it however they deemed best. To get the functionality you want, you would need to tweak the AppleScript to check for a note in the specified notebook with the specified title, delete it, then create the new note.

    Not overly complicated. You could use the Evernote AppleScript examples to guide you: https://dev.evernote.com/doc/articles/applescript.php

    Right now, I'm swamped with school and other big projects, so I can't do it anytime soon. If you want the functionality tho, you could def add it yourself. Otherwise, you could remind me again and hopefully I'll be free then :)

    stephen

  5. Hi Stephen,

     

    I updated to the 3.2 but it seems like I cant change the highlight colors and the textual category from the Help PDF. It was easy to do it on the previous version (2.1)

    In 3.2, the help PDF is not a Skim PDF but a regular PDF, so you will need to "File -> Convert Notes..." first, then alter the highlight colors and text categories.

  6. UPDATE: I have just pushed version 2.0 to Packal. This is a total rewrite, but it keeps the essential UI. Use a keyboard shortcut or the Script Filter to get parsing options. Then, either [1] directly copy that parsing info, [2] copy a nicely formatted version of the parsing info, or [3] (this is the newest part) look up that lemma in a lexicon.

    The lexicon lookup with show a webview with a cleaned-up, well-formatted version of the lexicon entry. This text is selectable and copyable, and is much easier to read than on Perseus' website.

    This is a great update. Hope you like it,

    stephen

  7. Hmm... Is something like this possible? Sure, but it will need to be built and structured by you. You won't get any help from Alfred directly. Since I don't know what language you are working with, I can't be specific, but I can talk through how I did something similar in Python.

    I have a workflow (Pandoctor) that works as an interface for pandoc. One of the things I needed to do was to grab and store the user's pandoc installation info. Basically, I knew that there was a lot of information that the workflow would require. Instead of grabbing it each time the workflow runs, I wanted to grab it on the first run and then store it for quick retrieval on all other runs. To do this, I create a Python Object for all of the data about pandoc I would need. The initialization of this object includes a self-reference:

    def __init__(self, wf):
    """Initialize [font=courier new,courier,monospace]pandoc[/font] object.
    """
    self.wf = wf
    self.me = self.pandoc()
    
    self.me contains all of the data that I need about a user's pandoc installation. To get that data, I use a method called pandoc(). The logic is fairly simple:
    • Check to see if the data is already stored,
    • If it is, just return it immediately.
    • If it isn't, run all the property methods and save the results as a JSON file
    I had a number of methods for grabbing each of the relevant pieces of information (version, path, options, etc). I made each of these methods properties and had a primary method that would run them all on first run. Here's that method (PS, I'm using the great Alfred-Workflow Python library):

    def pandoc(self):
    pandoc_data = self.wf.stored_data('pandoc')
    if pandoc_data == None:
        data = {
            'path': self.path,
            'version': self.version,
            'outputs': self.outputs,
            'inputs': self.inputs,
            'options': self.options,
            'arg_options': self.arg_options
        }
        self.wf.store_data('pandoc', data, serializer='json')
        pandoc_data = data
    return pandoc_data
    
    Now, each of the property methods I made accessible as well (so instead of calling Pandoc().pandoc['inputs'], I can call Pandoc().inputs). To make this also fast, I used the same logic. Here's an example:

    @property
    def path(self):
    """Find path to [font=courier new,courier,monospace]pandoc[/font] executable.
    """
    try:
        return self.me['path']
    except AttributeError:
        if os.path.exists('/usr/local/bin/pandoc'):
            return '/usr/local/bin/pandoc'
        else:
            from distutils.spawn import find_executable
            pandoc_path = find_executable('pandoc')
            if pandoc_path:
                return pandoc_path
            else:
                raise RuntimeError("Pandoc is not installed!")
    
    The property itself checks to see if it can just read the data from the stored file. If it can't, it will generate it.

    So, how does this work as a whole? On the very first run of the workflow, when I initialize the Pandoc() object, it will set self.me to the result of the pandoc() method. This means that the pandoc() method has to run. When it runs, it will try to read the stored JSON file and find that it doesn't exist. When it sees that it doesn't exist, it will start forming the JSON dictionary of all the relevant data I need. First, it will execute the self.path property method I have above. When that runs (here on the first run), it will try to read the info from the stored file, but that doesn't exist, so it will raise the AttributeError. I catch that error, and proceed with manually grabbing the path to the pandoc executable and returning it to the pandoc() method above. This is the same logic for all of the other property methods. Now, once pandoc() runs all of the property methods, it stores the data in JSON format to a file and then returns the data.

    But, on every other subsequent run of the workflow, whenever I call the Pandoc() object and it sets the self.me attribute, it will simply immediately read the data from the stored file. This means that the first run will be a bit slower (hide that in a configuration script), but every other run will be blazingly fast.

    So, that was a bit indepth, and I don't know if it makes any sense to you (if you don't know Python, I'm sorry, it's all I got). But, the basic underlying point is that it is indeed possible to set a workflow up such that you have an automatically self-generating set of data for use in the workflow. No matter what you do, you will need to use this kind of self-referential logic to achieve this type of result, but it should get you where you want to go.

  8. I am seeing no errors. It would appear that my workflow needs to change its logic. It appears that my code no longer returns all results when the {query} is ''. I thought this was how my old code was, but I think there was a regression in an external library that I use.

    All that to say, these tests lead me to believe that the problem exists in my code, and not in Alfred. Sorry for the false alarm, but thank you so much for the quick and thorough response.

  9. I do like Papers3, but it just tries to do too much for my tastes. As you can tell from my Skimmer workflow, I really only want to use Skim for reading and annotating my PDFs. My biblio manager should be only that. Plus, I like Zotero's setup better. But I do agree, Papers3 looks infinitely better.

    And, the Citations helper was my primary inspiration for ZotQuery's core functionality actually.

  10. This is a somewhat odd question, but the newest build of Alfred (295) seems to have broken this functionality. Previously, it was possible to have an empty Script Filter (one where no input has yet been entered) display all possible results by selecting these options in the Script Filter:

    • uncheck with space
    • select Argument Optional
    I was using this functionality in my Pandoctor workflow. Now, these Script Filters display nothing until some input is given. I would really like to get the old functionality back. How can I do this?
  11. Also, I've just tested it, and there is a bug. If you have an article with ' in the title, it will break the XML output. If you want to stay with AppleScript, you should really check out qWorkflow as a backend. This will ensure clean XML no matter what. Your current setup is highly susceptible to bugs.

  12. I'm not a Papers3 user, but this seems like a great idea. I wrote the ZotQuery workflow and the BibQuery workflow, and I think that Alfred workflows are perfect for bibliography searching. I'm happy that you've now added Papers3 to the fold.

    I know from my extended development of ZotQuery that these types of workflows can be a bit tricky. I'm not certain about your data structure on the backend (how Papers3 stores its information, how you read it, how you parse it), but I have been thinking about these issues with Zotero for a long time. If you are interested, you could check out my GitHub repo or shoot me some questions about speeding things up and adding more search features.

    Anyways, sounds like a great workflow.

    stephen

  13. Update: Version 3 is now live on Packal. It includes a major update to the annotation exporting feature. Now, you can export as either HTML or Markdown, to either Evernote or the Clipboard. Plus, highlights are now grouped together by color (and thus by whatever text tag you give said color), and these groups are sorted alphabetically. User-customization of export is also rebuilt, making it more customizable where it needs to be, but less customizable where it doesn't.

    Also, a new option under sk:help to launch the URL Handler app so that Skimmer's custom URL scheme is registered with the OS (you might need to alter you Gatekeeper settings for this, as this is an "unsigned app").

    All in all, this is a great update. Hope you enjoy.

    stephen

  14. I will have to add more beers, because I have another problem!

    When I try to click on the PDF link from Evernote:

    link.png

     

    I get the error -10810 telling me that "the application "_skimmer" can't be opened.

    CoreServicesUIAgent.png

     

    CoreServicesUIAgent.png

    I did not change the path for the PDF, so I sincerely do not have any idea what the problem is about

     

    Any solution? :)

    This is unfortunately an unknown error. So, we need to learn more about what's happening when. Does this happen everytime you click a Skimmer link? What are your Gatekeeper settings? When you open the workflow folder and double click the _skimmer.app, what happens?
×
×
  • Create New...