Jump to content

jarhead

Member
  • Posts

    59
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by jarhead

  1. You don't need to go to tinypng_config in the workflow... just start typing tiny into Alfred and you will be provided with three options. One option will be "Enter/Change API Key". Choose this option and it will prompt for your API key. Paste your key, hit return and you should be good to go.

     

    Hi,

     

    I'm a newbie with workflows and don't know where to put the API code.

    I go to: tinypng_config within the workflow and see /bin/bash

     

    key="{query}"
     
    #Storage directory for API key
    PREFS="$HOME/Library/Application Support/Alfred 2/Workflow Data/carlosnz.tinypng"
     
    #Create storage folder
    mkdir -p "$PREFS"
     
    #Save user's key to storage file
    echo "$key">"$PREFS/api_key"
     
    #Notify
    echo "New API key applied:"$'\n'"$key"
     
     
    Where can I put the API?
     
    Best regards,
    Hendrik

     

  2. See Carlos' post above regarding upgrading for Alfred 3...

     

    http://www.alfredforum.com/topic/3922-screenshots-11-capture-save-to-dropbox-get-link-and-manage-files-and-past-links/page-2#entry43776

     

    Hi. I'm trying to install this on Alfred 3. I am able to install it, but am confused as to how to set it up. 

     

    I type in "setupss" in Aflred, and it brings up this:

     

    PDoiP39.png

     

    When I hit "Return", it then shows a Mac notification that says "Start typing to select a folder" and that is it. Nothing happens.

     

    7MKAkag.png

  3. Anderson County:http://www.assessment.cot.tn.gov/re_assessment/SelectCounty.aspx?map=true&SelectCounty=001
    
    Note that there's more than one colon in there.

     

    When you split the string on a colon, you end up with 3 columns. Your first column is the county name, the second is "http" and the third is "//...".

    Use tab or some other character that won't appear in the name or URL as the delimiter.

     

     

    Figured this out playing with further. Thanks. Missed the obvious.

  4. I'm attempting to setup a workflow that allows you to enter a county name and then hit the Enter key to open the website assigned to that county.

     

    I have the terms along with their corresponding websites stored in a text file and separated by a colon like the following example:

     

    Anderson County:http://www.assessment.cot.tn.gov/re_assessment/SelectCounty.aspx?map=true&SelectCounty=001

    Davidson County:http://www.padctn.org/prc/#/search/1

    Hickman County:http://hickman.capturecama.com

     

    I have the following Input Script Filter setup but cannot figure out how to launch the website. I've tried using both an Open URL action and Run Script action with no luck.

    IFS=$'\n' 
    
    match=($(grep -i {query} counties.txt))
    
    echo '<?xml version="1.0"?>'
    echo '<items>'
    echo ''
    
    for i in ${match[@]}; do
    	tncty=($(echo "$i" | cut -d\: -f1))
    	ctyw=($(echo "$i" | cut -d\: -f2))
    
    	echo "<item arg=\"$tncty\" valid=\"yes\">"
    	echo "<title>$tncty Property Records</title>"
    	echo "<subtitle>Enter → Search $tncty Property Records</subtitle>"
    	echo "<icon>search.png</icon></item>"
    	echo ""
    done
    
    echo "</items>"
    

    property_search.png

     

    Any point in the right direction would be appreciated. Thanks.

  5.  

    Fantastic workflow (not surprising really coming from you Vitor)...

     

    I'm having an issue where I followed the steps to keep video & audio and it works. For some reason, it creates a second version of both the video & audio. For example, using the workflow, it downloaded a video called "Best DIY GoPro Mounts.mp4"... it also created another version entitled "Best DIY GoPro Mounts.f136.mp4". It does the same with the audio... two m4a versions one including .f141.m4a.

     

    I just added --extract-audio --keep-video --quiet

     

    The script I'm using for dv following the instructions...

    export PATH="/usr/local/bin:$PATH"
    
    # deal with special characters
    export LANG=en_GB.UTF-8
    
    IFS=$'\n'
    
    # set notifications
    notification() {
      ./_licensed/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "DownVid" -message "${1}"
    }
    
    # update youtube-dl if it's more than 15 days old
    if [[ $(find youtube-dl -mtime +15) ]]; then
      python youtube-dl --update
    fi
    
    gettitle() {
      # file location
      filename=$(python youtube-dl --no-playlist --extract-audio --keep-video --quiet --output "${downdir}/%(title)s.%(ext)s" --get-filename "${link}")
    
      # title
      title=$(basename ${filename%.*})
    
      # check if url is valid
      if [[ -z "${filename}" ]]; then
        notification "The url is invalid"
        exit 1
      else
        notification "Downloading “${title}”"
      fi
    }
    
    getfile() {
      progressfile="/tmp/downvidprogress"
    
      python youtube-dl --no-playlist --extract-audio --keep-video --quiet --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"
    
      # add metadata
      xmlencodedurl=$(echo "${link}" | perl -MHTML::Entities -CS -pe'$_ = encode_entities($_, q{&<>"'\''})')
      xattr -w com.apple.metadata:kMDItemWhereFroms '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array><string>'"${xmlencodedurl}"'</string></array></plist>' "${filename}"
    
      rm "${progressfile}"
    }
    
    # download
    printf "{query}" > "/tmp/downvidcurrentquery"
    
    if [[ "{query}" == "addToWatchList"* ]]; then
      link=$(cat "$(echo {query} | sed 's/addToWatchList //')")
      downdir="${HOME}/Downloads"
      gettitle
      getfile
      osascript -e "tell application \"Alfred 2\" to run trigger \"add_to_watchlist\" in workflow \"com.vitorgalvao.alfred.watchlist\" with argument \"${filename}\""
    else
      link="$(cat {query})"
      downdir="${HOME}/Desktop"
      gettitle
      getfile
    fi
    
    notification "Downloaded “${title}”"

     

    Per Scott's suggestion, adding -f 137/22/18/17 to the workflow got rid of the numbered versions and the workflow is now working correctly.

  6. Fantastic workflow (not surprising really coming from you Vitor)...

     

    I'm having an issue where I followed the steps to keep video & audio and it works. For some reason, it creates a second version of both the video & audio. For example, using the workflow, it downloaded a video called "Best DIY GoPro Mounts.mp4"... it also created another version entitled "Best DIY GoPro Mounts.f136.mp4". It does the same with the audio... two m4a versions one including .f141.m4a.

     

    I just added --extract-audio --keep-video --quiet

     

    The script I'm using for dv following the instructions...

    export PATH="/usr/local/bin:$PATH"
    
    # deal with special characters
    export LANG=en_GB.UTF-8
    
    IFS=$'\n'
    
    # set notifications
    notification() {
      ./_licensed/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "DownVid" -message "${1}"
    }
    
    # update youtube-dl if it's more than 15 days old
    if [[ $(find youtube-dl -mtime +15) ]]; then
      python youtube-dl --update
    fi
    
    gettitle() {
      # file location
      filename=$(python youtube-dl --no-playlist --extract-audio --keep-video --quiet --output "${downdir}/%(title)s.%(ext)s" --get-filename "${link}")
    
      # title
      title=$(basename ${filename%.*})
    
      # check if url is valid
      if [[ -z "${filename}" ]]; then
        notification "The url is invalid"
        exit 1
      else
        notification "Downloading “${title}”"
      fi
    }
    
    getfile() {
      progressfile="/tmp/downvidprogress"
    
      python youtube-dl --no-playlist --extract-audio --keep-video --quiet --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"
    
      # add metadata
      xmlencodedurl=$(echo "${link}" | perl -MHTML::Entities -CS -pe'$_ = encode_entities($_, q{&<>"'\''})')
      xattr -w com.apple.metadata:kMDItemWhereFroms '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array><string>'"${xmlencodedurl}"'</string></array></plist>' "${filename}"
    
      rm "${progressfile}"
    }
    
    # download
    printf "{query}" > "/tmp/downvidcurrentquery"
    
    if [[ "{query}" == "addToWatchList"* ]]; then
      link=$(cat "$(echo {query} | sed 's/addToWatchList //')")
      downdir="${HOME}/Downloads"
      gettitle
      getfile
      osascript -e "tell application \"Alfred 2\" to run trigger \"add_to_watchlist\" in workflow \"com.vitorgalvao.alfred.watchlist\" with argument \"${filename}\""
    else
      link="$(cat {query})"
      downdir="${HOME}/Desktop"
      gettitle
      getfile
    fi
    
    notification "Downloaded “${title}”"
  7. Does it work if you remove the javascript: part? What if you run the code in the console?

     

    Still does not work if I remove the javascript: portion. Chrome console references the following:

    Uncaught ReferenceError: ajaxurl is not defined

    That is in reference to some portion of jQuery being used in the Wordpress theme and not the bookmarklet javascript being run.

     

    I can just keep running the bookmarklet from my bookmarks bar since I run everything else using your workflow. Just wasn't sure if you new of a fix. Thanks.

  8. Hey Vitor-

     

    Use this workflow daily. Thanks.

     

    I've run into an error with one bookmarklet that I use to post to Wordpress. The Linkmarklet Wordpress plugin generates a bookmarklet depending on the options selected in the plugin. The javascript generated looks like this:

    javascript:var d%3Ddocument,w%3Dwindow,e%3Dw.getSelection,k%3Dd.getSelection,x%3Dd.selection,s%3D(e%3Fe():(k)%3Fk():(x%3Fx.createRange().text:0)),f%3D%27http://prodougtivity.com/wp-content/plugins/linkmarklet%27,l%3Dd.location,e%3DencodeURIComponent,u%3Df%2B%27%3Fu%3D%27%2Be(l.href.replace(new RegExp(%27(https%3F:%5C/%5C/)%27,%27gm%27),%27%27))%2B%27%26t%3D%27%2Be(d.title)%2B%27%26s%3D%27%2Be(s)%2B%27%26v%3D4%26m%3D%27%2B(((l.href).indexOf(%27https://%27,0)%3D%3D%3D0)%3F1:0)%3Ba%3Dfunction()%7Bif(!w.open(u,%27t%27,%27toolbar%3D0,resizable%3D1,scrollbars%3D1,status%3D1,width%3D720,height%3D570%27))l.href%3Du%3B%7D%3Bif (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0)%3B else a()%3Bvoid(0)
    

    And when run through your _cleanbookmarklet script:

    javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://prodougtivity.com/wp-content/plugins/linkmarklet',l=d.location,e=encodeURIComponent,u=f+'?u='+e(l.href.replace(new RegExp('(https?:\/\/)','gm'),''))+'&t='+e(d.title)+'&s='+e(s)+'&v=4&m='+(((l.href).indexOf('https://',0)===0)?1:0);a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570'))l.href=u;};if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();void(0)
    

    Tried it with both Chrome & Safari unsuccessfully using your bookmarklet workflow. When running from bookmarks bar, the bookmarklet generates a new window with information pre-filled like so:

     

    linkmarklet.png

    Any ideas? Thanks.

  9. EDIT: A more thorough write-up can be found here...

     

    While attempting to find ways to implement Alfred Remote into my workflow, I learned that Photoshop supports Applescript (can't believe it took me this long to find out).

     

    Combining Alfred Remote & Photoshop is cool. Among other things, you can launch Photoshop Actions.

     

    As an example, I use Photoshop actions to highlight portions of a document and then create a tear effect that I use in Keynote presentations. Before, I had to remember the keyboard shortcuts I assigned to the various actions and run them at various times. This worked okay.

     

    Now, with Alfred Remote, it is a much easier process.

     

    I can make a selection (or selections) using the marquee tool in Photoshop and with the press of a button in Alfred Remote, the selection is highlighted. I then begin the tear effect action. I can then apply a brush to the top, left, right and bottom each with a separate button. I have buttons for decreasing and increasing brush size (although I still primarily use the bracket keys) and a final action that saves the image to my desktop and closes it in Photoshop.

     

    ar.png

     

    Example Applescript for running an action in Photoshop...

    on alfred_script()
      tell application "Adobe Photoshop CC 2014"
    do action "cool action" from "Main Action"
      end tell
    end alfred_script

    Example Applescript for pressing a key on the keyboard (left bracket key)...

    on alfred_script()
      tell application "Adobe Photoshop CC 2014"
    tell application "System Events" to key code 30
      end tell
    end alfred_script

    Now, using my left hand, I run the various actions from Alfred Remote on my iPhone/iPad while applying the brushes with my right hand using my mouse/trackpad. I've used this setup to the point that I can do it all without looking at my iPhone/iPad to press buttons.

     

    Video demonstration (I performed the actions slower in the video so the button presses in Alfred Remote can be seen)...

     

     
  10. Tim, i still can't get this script to work for me.  I have cut and paste the recommended script for this workflow and it does not populate Omnifocus 2. 

     

    For those having issues, download this version of the workflow: New OmniFocus Inbox Task.alfredworkflow

     

    It is the same version provided by khit but with the modified Applescript provided above.

     

    If you still encounter issues, make sure to delete the prior version of the workflow before installing this version.

  11. I'd just like to second what Vítor said.

    Best to use the default Markdown editor in a distributed workflow. There's no reason to expect that other users have Byword installed, or that they prefer it if they do.

    Hard-coding an editor that most users probably don't have installed is a recipe for endless support requests.

     

    I really don't see what the problem is. I simply shared MY workflow (per the forum name). It is not hard at all to replace Byword with your editor of choice. You literally replace the text Byword with the name of your editor OR you can modify it to your liking.

  12. Why open -a "Byword" ~/jekyll/_posts/"$file" and not simply open ~/jekyll/_posts/"$file"? Not specifying an app would work much better, as users would simply have their default Markdown editor open by default.

     

    I prefer Byword for my Jekyll posts. All other Markdown files I edit via Sublime Text. You can obviously edit it to your liking.

  13. Still learning my way around Terminal so I know I'm missing something.

     

    I've tried adding

    | tr " " "-"

    after

    touch ~/folder/_posts/$( date '+%Y-%m-%d-' )"$file"

    which clearly is not correct. I'm not sure how the echo command would be used here.

     

    To have the file opened in my editor, I just had to point it to the path.

    open -a "Byword" ~/folder/_posts/"$file"
  14. I have a simple bash file to create a new markdown file named with the current date as well as the file name I input via {query} which works correctly...

     

    file="{query}".md
    touch ~/folder/_posts/$( date '+%Y-%m-%d-' )"$file"

    Is there an easy way to add code to replace spaces in the file name with dashes? Obviously, the date is formatted correctly. It would be so much easier to just type "this is the name of my file" versus "this-is-the-name-of-my-file".

     

    Also, how would I then have the file opened in my editor of choice? Usually the following works but for some reason is not. Probably the way I'm referencing $file.

    open -a "Byword" "$file"

    Thanks.

     

  15. What would be the best way for this to work with grabbing screenshot for Responsive Web Pages. I tried it with duplicating the script a few times for the different widths and adding it below in the Alfred prefs so there are numerous actions.

     

    Check out this article over at Nettuts on capturing responsive web pages.

×
×
  • Create New...