Jump to content

smarg19

Member
  • Posts

    505
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by smarg19

  1. Ok. It appears that the pandoc command created is wonky: 16:26:18 pandoctor.py:1092 DEBUG [u'/usr/local/bin/pandoc', u'--from=markdown', u'--to=docx', u'--parse-raw', u'--smart', u'--normalize', u'--standalone', u'--template=', u'--reference-docx=reference.docx', u'--output=/Users/skellis/Downloads/rose.docx', u'/Users/skellis/Downloads/rose.md'] pandoc: Could not find data file templates/.docx As you can see, there is no template specified. How are you choosing the template in the options?
  2. How odd. Can you try to run it normally and post the "All Information" output?
  3. What version of Evernote are you using? And can you run the script in Script Editor again and tell me the highlighted line?
  4. Change the package number to whatever is in the workflow directory.
  5. Open the script and paste this in. Then save and rerun. on run --get path to current directory set base_path to my get_base_path() --prepare path to Python converter script set satimage_pkg to base_path & "Satimage398.pkg" set sResult to do shell script "xattr -dr com.apple.quarantine '" & satimage_pkg & "'" do shell script "sleep 0.2" do shell script "open '" & satimage_pkg & "' -a Installer" end run on get_base_path() set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"} set _path to (text items 1 thru -2 of (POSIX path of (path to me)) as string) & "/" set AppleScript's text item delimiters to tid return _path end get_base_path
  6. In script editor, what line is highlighted on error?
  7. Can you try opening and running the pkg_installer.scpt within the workflow directory in Script Editor itself? What line does it highlight with the error?
  8. Derek, I plan on one day (hopefully sooner, rather than later) really revamping this workflow and making it world-class, but I just don't have the time right now. However, this is a feature that I've wanted to implement for a while, and you caught me at a great time. I don't have the time to update the whole workflow and all that jazz, but you can use this version of the export.applescript to have all annotation types sorted by page number, not by timestamp. Just copy the code from this Gist and paste it into that file in the workflow directory. I've tested it some, so hopefully it'll just work, but I can't promise debugging speeds at anything like what this was.
  9. I guess the best way to credit would be to alter the dialog box that pops up when you first run the app (to register the URL scheme). You could just put "Created by Stephen Margheim" there or something. I'm not really that picky. As to apps breaking workflows, I'd say very infrequently. Clearly it happens, but I've had very, very few times where a different version of the app was at fault. It is, though, one reason why you should always have people give you the workflow version, app version(s), and debug output when they report an error.
  10. I'm not 100% certain what exact usage you have in mind, but I use External Triggers extensively in my Pandoctor workflow to chain actions together. Look that up and see if that might work.
  11. Odd. I'm on the beta channel for Evernote, so I have version 6.0.6 Beta 1 (451237 Direct). What version exactly do you have? I've re-tested and it still works on my machine.
  12. Hmm... I'm on Yosemite, and the test code I posted above worked fine for me. Did you try that test script and it fail? Or did that simple example work and a more real-world test fail? And what version of Evernote do you have?
  13. My Spritzr workflow uses it extensively. But I can't get the Shift key thing to work right I guess. I have to press Shift + Enter and then Safari loads the HTML file. In this mode, Alfred dies. Is there some way to do it differently?
  14. Great workflow. One small suggestion, you could use the Viewer automator app to view the custom HTML page without opening a browser. You can download the app here.
  15. Ok. There's obviously a lot going on here, but I think it's all right headed. First, I would recommend you stay with your inclination and start dipping into Python. Once I moved from AppleScript to Python, I've never looked back. If I ever need Applescript specific functionality, I can invoke directly within a Python script. So, big vote for Python. On that same line, I think building things for and with Alfred is a great way to start, so I would also recommend that intuition. It has a number of limitations, which keep things fairly well within scope, but it's also incredibly flexible, so you can do crazy things (my own workflows are all over the map in terms of functionality and how they use Alfred's interface). I really think you should start by reading the documentation for the Alfred-Workflow Python library. It's a great introduction to writing workflows for Alfred in Python. And that library is (IMHO) the best for integrating a scripting language with Alfred. Then, I'd also read through the source code on GitHub to start getting a feel for how Python is written, especially for Alfred. Dean, who wrote the library, is a very gifted Pythonista and his code is an excellent example of Python code; very clear, very direct, very clean. Next, start topics in this forum for specific questions. The people here are here frequently enough and like to help. And having a specific question with a specific goal will likely get some good responses. I've learned so much from the people on this forum. Finally, on general advice, I'd remind you to keep refactoring. You will learn new things all the time; go back and put them into practice in a code base you know well. So, that's general advice, here's some specific thoughts on your questions. First, I answered the Evernote images question in your other thread response. The key are HTML image links with URLs to local files. The infer_spaces() algorithm is a bit much to take in on first read, but it looks pretty efficient as it. As for passing arguments to a Python script from Applescript and getting the results back, check out my Wikify workflow, and specifically the en2md.scpt, which calls to a Python script. Passing over numbers should be fairly simple, just add an if clause to the function, like if isinstance(character, int): continue (this is Python). This would likely go best here in the Python code linked above: # Backtrack to recover the minimal-cost string. out = [] i = len(s) while i>0: if isinstance(s[i], int): continue c,k = best_match(i) assert c == cost[i] out.append(s[i-k:i]) i -= k Finally, for word frequency of texts, you should really check out the NLTK Python package. For some idea of how to get word frequency from a text using that Python package, see section "3.1 Frequency Distributions" here.Those are my initial responses. Please do respond with any further questions... stephen
  16. Dude, can I just say that your website is gorgeous and there are some seriously cool and clever things added to Skimmer in your fork. I would def be interested in merging them at some point. Again, really great stuff. Onto the questions. First, I haven't been around this codebase in a while, so I may need to re-acquaint myself, but here are my original thoughts. First, you can use the _skimmer.app without the Alfred Workflow. The only requirement is that you run it once for it to register the URL scheme with OS X. As for the images problem, that required some research on my part, but I do think I have a solution. In short, you need to save the images to a temporary directory (as you do with your write_temp sub-routine, generate a URL to that file, and create an HTML image link with that URL. Then, you simply insert that image link in the appropriate place in the note HTML. As an example, here's some sample code: set posix_path_to_image to my en_import(page_index) set image_url to my encode_text(posix_path_to_image, false, false) set image_html to "<div><img src=\"" & image_url & "\"/></div>" Now you have plain HTML to add into the HTML note you are creating. It can go right after the annotation or wherever. This should give you enough to fix it up. For the sake of testing, here's the code I used to test that this image html link would work: tell application "Finder" to set sel to the selection as text set image_url to "file://localhost" & my path2url(POSIX path of sel) set image_html to "<div><img src=\"" & image_url & "\"/></div>" tell application "Evernote" to create note with html image_html title "IMAGE TESTING" notebook my en_inbox() on path2url(thepath) return do shell script "python -c \"import urllib, sys; print (urllib.quote(sys.argv[1]))\" " & quoted form of thepath end path2url on en_inbox() tell application "Evernote" to return name of (every notebook whose default is true) end en_inbox NOTE You should use the en_inbox() subroutine, since not everyone uses a notebook entitled "Inbox" as their default notebook. Hope this helps, and hopefully we can integrate all this cool stuff together at some point.
  17. If you want a full picture of what the workflow can do, check out my blog post on it: http://hackademic.postach.io/pandoctor-alfred-workflow It details all the cool nooks and crannies of the functionality.
  18. When you first download Pandoctor, you will need to configure a few settings. Luckily, Pandoctor takes care of this for you. All you need to do is use the dr:config keyword to get everything set up. Once you see the completion notification, you can start using Pandoctor for real. So just type dr:config into Alfred.
  19. What is the debug output when you run the dr:config command?
  20. All the workflows mentioned are great, but to take a step back and consider how Alfred is helpful in and of itself, I would say that you should think about it as an always accessible hub for using all the functionality of your computer. Alfred is always one key command away from being available, and once you're there, you can do anything directly from the keyboard. The great thing about workflows is that they bring even more functionality to the same hub. Why open Finder to search files; open Alfred. Why open Safari to look something up in Wikipedia; open Alfred. By collecting functionality in one place, it makes it easier and faster to get things done on the Mac. That's why I love Alfred, and the workflows just build on top of that basic usage.
  21. Sorry for any delay, I've been on the road. The issue appears to be the LibGen moved/updated/changed the base install site. In the past it was http://libgen.org/; it is not [font=courier new,courier,monospace]http://libgen.in/[/font]. But, it is also an easy fix. Simply go the "Open URL" action in the LibGen workflow and replace the URL with this: http://libgen.in/get.php?md5={query} That should fix the problem.
  22. Can you run Alfred's debugger and paste the results?
  23. Can you elaborate a bit? Do you mean a variable as a part of the templating? In addition to the {input_path}, {input_name}, {input_dir} variables? That does make sense, I guess I would need to rename them tho: {input_path_with_ext} {input_path_without_ext} {input_filename} {input_parent_dir} Would those four variables suffice for your needs? - - - FWIW, you can easily change the templating variables by editing the _format_template() method. Here is it's current state: def _format_template(self, args): """Format the variables in a Template. """ input_path = self._get_input_path()[0] input_name = os.path.splitext(input_path)[0] input_dir = os.path.dirname(input_path) for i, arg in enumerate(args): # Replace any and all variables with correct data arg = arg.replace('{input_file}', input_path) arg = arg.replace('{input_name}', input_name) arg = arg.replace('{input_dir}', input_dir) args[i] = arg return args All you would need to do is add a new variable name and supply the proper value. I say this because I plan on refactoring Pandoctor at some point, and will def make this addition then, but I can't say right now how soon that will be, so this will allow you to get the functionality you want without having to wait for me.
×
×
  • Create New...