Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This week's "superfluous" automation: quick screenshots from an Android device, to run with Alfred:

    #!/usr/bin/env bash

    if ! /usr/local/bin/adb devices | grep '\<device\>'; then
        echo "No phone connected!"
        exit 1
    fi

    phonemodel=$(/usr/local/bin/adb shell getprop ro.product.model | tr '-' '_')
    timestamp=$(date +"%Y_%m_%d_%Hh%Mm%Ss")
    output_file="Screenshot_${phonemodel}_${timestamp}.png"
    /usr/local/bin/adb exec-out screencap -p >$output_file

    #open -R $output_file # select in finder
    open -a Yoink $output_file # show in yoink


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: