Jump to content

frevo

Member
  • Content Count

    10
  • Joined

  • Last visited

About frevo

  • Rank
    Newbie

Contact Methods

  • Twitter
    frederikvoigt
  • Website URL
    http://frederikvoigt.de

Profile Information

  • Location
    Germany
  1. v.6 added: New link post draft command (only for modified Jekyll sites - please the Link and video postssection) added: New video post draft command (only for modified Jekyll sites - please the Link and video postssection) added: Tweet article command (requires Tweetbot for Mac) change: added a sed line to the Publish draft action that replaces the date: line in the post's YAML front matter with a line containing current date and time to ensure the correct order of multiple posts from the same date change: the current date is now added to the front matter of new drafts and pages change: added lowercase conversion for new filenames throughout the workflow Please refer to the following articles for more information about post formats: Link posts for Jekyll sites Video posts for Jekyll sites
  2. Solved it. AppleScript writes CRs where Jekyll expects LFs. I added the following line and substituted "return" with "lf" throughout the script: set lf to (ASCII character 10)
  3. Hello, my Jekyll workflow creates plain text files containing YAML frontmatter templates for the posts. So far the shell script actions work great, but I'm working on new commands that require AppleScript. I've basically finished one to create link posts, but... The file written by the script looks like a regular file in the text editor, but the frontmatter is not correctly recognized by Jekyll. Strange thing: if I just copy the content, paste it into a new file in the editor and then save the file, it works flawlessly. Since the content is exactly the same I guess it must have to do something with the way the file is written by the script, but I have no idea how to solve that. I tried using do shell script "echo " & quoted form of..." too, but it also didn't work. Any hint would be greatly appreciated! Here's the script: -- on alfred_script(q) set draftsPath to (path to home folder as text) & "path:to:Jekyll:_drafts:" set postExtension to "md" set q to "This is a test draft" -- Remove in Alfred set postTitle to q set postFilename to findReplace(space, "-", postTitle) set postFilepath to draftsPath & postFilename & "." & postExtension set postDate to todayISOformat() if application "Safari" is running then tell application "Safari" set linkTitle to name of front document set linkUrl to URL of front document set linkQuote to (do JavaScript "(''+getSelection())" in document 1) end tell if (linkQuote is not "") then set linkQuote to return & ">" & space & linkQuote end if set frontMatter to "---" & return & "title: " & postTitle & return & "date: " & postDate & return & "layout: post" & return & "categories: []" & return & "tags: []" & return & "link: " & linkUrl & return & "---" & return & return & linkTitle & return & linkQuote as «class utf8» set af to open for access file postFilepath with write permission set eof af to 0 write frontMatter to af as «class utf8» close access af tell application "Sublime Text" activate open postFilepath end tell else display notification "Please open a page in Safari first." with title "Safari is not running!" end if -- end alfred_script on findReplace(findText, replaceText, sourceText) set ASTID to AppleScript's text item delimiters set AppleScript's text item delimiters to findText set sourceText to text items of sourceText set AppleScript's text item delimiters to replaceText set sourceText to "" & sourceText set AppleScript's text item delimiters to ASTID return sourceText end findReplace on todayISOformat() set theDate to current date set y to text -4 thru -1 of ("0000" & (year of theDate)) set m to text -2 thru -1 of ("00" & ((month of theDate) as integer)) set d to text -2 thru -1 of ("00" & (day of theDate)) return y & "-" & m & "-" & d end todayISOformat
  4. That was it. Thank you very much! I'm new to Apple Script as well as to more complex Alfred workflows. Now that you pointed it out it's so obvious it hurts.
  5. Hi, I'm working on a link post command for my Jekyll workflow. It's an AppleScript that reads the a URL, its title and the selected text from Safari and then creates a Jekyll draft with this information filled in. It works fine from the AppleScript editor, but when I run it from Alfred, I get the following error: [ERROR: alfred.workflow.action.applescript] { NSAppleScriptErrorBriefMessage = "Expected \U201cend\U201d but found \U201con\U201d."; NSAppleScriptErrorMessage = "Expected \U201cend\U201d but found \U201con\U201d."; NSAppleScriptErrorNumber = "-2741"; NSAppleScriptErrorRange = "NSRange: {1002, 2}"; Here's the script as I run it in the AppleScript editor: set draftsPath to (path to home folder as text) & "jekyll:site:_drafts:" set q to "This is a test draft" set linkpostTitle to q set linkpostFilename to findReplace(space, "-", linkpostTitle) set newDraft to draftsPath & linkpostFilename & ".md" set af to open for access file newDraft with write permission set eof af to 0 tell application "Safari" activate set linkpostURLTitle to name of front document set linkpostUrl to URL of front document set linkpostQuote to (do JavaScript "(''+getSelection())" in document 1) end tell write "---" & return & "title: " & linkpostTitle & return & "date:" & return & "layout: post" & return & "categories: []" & return & "tags: []" & return & "link: " & linkpostUrl & return & "---" & return & return & "> " & linkpostQuote & return & "from: " & linkpostURLTitle to af as «class utf8» close access af tell application "Sublime Text" activate open newDraft end tell on findReplace(findText, replaceText, sourceText) set ASTID to AppleScript's text item delimiters set AppleScript's text item delimiters to findText set sourceText to text items of sourceText set AppleScript's text item delimiters to replaceText set sourceText to "" & sourceText set AppleScript's text item delimiters to ASTID return sourceText end findReplace Can anyone help me with that? Thanks!
  6. v.5 renamed and shortened keywords changed action descriptions changed "blog" to "site" throughout the workflow corrected typos
  7. Should have watched my kids climbing trees. Made an Alfred workflow instead...

  8. v.4 renamed keywords to better fit my workflow moved to GitHub
  9. v.3 Mr. Poole now uses variables for user dependent values throughout all scripts and script filters to facilitate customisation
  10. I've just tweaked the workflow a little bit, updated the documentation and made my post more readable with Vítor's MarkdownBulletin workflow - it's incredible that when I googled the infinite interwebzzz for a Markdown to BBCode converter I found the solution right here in this forum.
  11. Mr. Poole - Dr. Jekyll's Butler Overview Mr. Poole is an Alfred workflow for Jekyll sites. He is Dr. Jekyll's butler and tries to take the drudgery out of running a static site. Mr. Poole will assist you by... creating, opening and publishing drafts of regular as well as link and video posts opening existing posts for editing opening existing pages for editing starting a local server with the site including drafts opening the site folder in Sublime Text for development plus the above deploying the site to your server with rsync tweeting about (new) posts Details and Download For a general introduction please head over to my blog post about Mr Poole For all the details, the requirements and the changelog please take a look at the ReadMe on GitHub Download it on GitHub
×
×
  • Create New...