I recently added the ability 3shrink content that has no URL, such as a photo, PDF or sound clip. I was itching to get this working on Android, and here's why. Consider this sketch:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-p_xYBIVqP51HEWuwLGBPHyrONFMMw2-N4ZeSKmowplDkZC397H-DYdqv5Ub7tD6e4Mpz7v8hCDxDvHN6FRUGRTXWXNGGXeGgz5_RfdDiuea14Ml2oBu7FHw8qrsptXeTYuYx/s640/20170502_120820.jpg)
It seems reasonable that I'd want to associate a photo of the scene so I could compare them later. After sketching the scene I snapped a photo and used the new 3shrink capability to automatically turn it into a code. I then scribbled the code on the photo, QU3. At a future date, I can visit: http://benjisimon.3shrink.com/qu3 and see my the photo that inspired this sketch:
In other words, I now the ability to seamlessly go from a photo to a 3 digit code on my Android device.
To make this functional, I needed to enhance the AutoShare'ing 3shrink solution I previously created. The first step was to enhance the top level 3shrink Tasker action:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_bLjthoxwJ6yCCRBBqupz9HtSBebzYsM2cw9LC_jcJhXlluOwjye8R9VZpsKzK9HZNYs3NTwk3tIY-imy_d21M7ndEuHHukaUP_7XoQ1I9ijBRNcqSQ5B3k7YnOHYSidQb2Wb/s400/Screenshot_2017-05-02-11-48-07.png)
I've added a new leading 'If' condition that checks to see if %asfile1 is set. If it is, then I know that the AutoShare command was invoked with at least one file. %asfile1 contains a full path to the file, which is exactly what I need later on in the process.
I then updated the low level 3shrink action to check to see if the content being shared is a file that exists:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1fwBjyTwof0ih_Z1E4U7GRvf6dsYXMU2iEZNAZMbV9n0bglEezuDJiHQ8t7uAhIwD6FYsZO7rkkuk35nq9PPbgWJ-8BUIkXZaLkOPhA0GsrAjpn4tM3aMCNDM4hYauiXEKnT2/s400/Screenshot_2017-05-02-12-24-27.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd_W7FHAIsYOJMUaNl-byOB1aQUsv3sKhXaxaSDF7ZTgYzxgzh6T9rg3yhVXpWzbj7KzxhUR8Co4WZ64eobcT8vZS4LVffEKcs4X10fZng3sVLCp9-RYZkNN9b0JhyphenhyphenkjcKBBqG/s400/Screenshot_2017-05-02-11-46-14.png)
If it is, I do a Tasker HTTP POST of the content. One gotcha I found with the HTTP POST is that %HTTPD doesn't appear to be set. I overcame this by storing the result of the POST in a text file and then reading that text file into a variable. Incidentally, the content returned by the POST is the 3 letter code that corresponds to this file.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmnRbbZ4pFavZAXN8hP26xpbh1eac4PehHMfEbrUXnMaE_ic707OA43jaWoHbBXbDvZKbO0RxzBsZ6SPyP_GQILtmJiFn0NiRnUvPhF5XPWke7nhq_XHGqNjqsHk1pi0UNFDCO/s400/Screenshot_2017-05-02-11-46-40.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8WSBq1lhkozx4LxzA9XjKvFKdXeUz5uwBzj9Qn5BAA5SofBZTIoH58CmBxJILIThyphenhyphenAJtaoNUpYgExRNjI2ewQ21rW_6ueJDwDJ-RnddN9SD2rR4ZRzfL3ak8PS0CCsAxZXPWF/s400/Screenshot_2017-05-02-11-46-54.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgdtdlTTbqwqoi6_dEvdw1qZXbbhIqlfK1MLPuTDTSbEZomgnuiun1ivKG1Hup74LWgEV24fRbF_YGPBAe5Jd1sMecQ8ktmme72FV98LeXJ9wFueKXvbII-h_b7es9TRkhOmKP/s400/Screenshot_2017-05-02-11-47-25.png)
And that's pretty much all there is to it. I snap a photo, hit the share button and a few moments later, I see my magic code:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf1BKeEkfLMnL_w1e26XDRMRHCmTLNec5TAVcK_Y5WXG_vWd23yAWqELqVryl8lX6Kt6EIrvlCtW8zPh-fRjJ-j8OaJgIIss-ie1fUplkvyYN1dIhI8IrM7UEMcu6EYLFMCXYI/s200/Screenshot_2017-05-02-12-31-53.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxokaPqa23AVmszMm7ILDwEeUz1lQU-Wpv1tW8WnUpAYmHDH9b3qXkedSi9Vuia2PRXdJXi3MbjXvZwLqS8Ndb8XF97cJVZUhrAhWkMUUu98z01XhcpcGmwRo6CxoqU1oBq5wA/s200/Screenshot_2017-05-02-12-31-25.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMVODEVZ4dT1lnMrnyG1YKMGKSdrxiABPgbkKHzlUXfkFyOhb9FJOjtTkwdNOgm4FgBdhZ-FpIFY-bf-1LZ-jJlDHiNEzrxXk_I8nPNXfpeBZfFEbR3VOp5iWMSLBIwppiJuY3/s200/Screenshot_2017-05-02-12-31-35.png)
See the original photos over at http://blogbyben.3shrink.com/ck4.
No comments:
Post a Comment