Created
September 23, 2017 10:54
-
-
Save kokoye2007/c459ce5f68177c81ae098ed9514ab2ee to your computer and use it in GitHub Desktop.
QR Code Create test bash zenity and qrencode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
me=`whoami` | |
outpath=`zenity --entry --title="Save path?" --text="What folder would you like to save the QR image to? Default of /home/$me/Pictures will be used if one is not entered."` | |
button0=$? | |
if [ $button0 -eq 0 ];then | |
if [ -z $outpath ];then | |
outpath=/home/`whoami`/Pictures | |
fi | |
pname=`zenity --entry --title="What filename?" --text="What name should be used for the output? ex: filename > filename.png"` | |
button1=$? | |
if [ $button1 -eq 0 ];then | |
if [ -z $pname ];then | |
zenity --info --title="Failure" --text="You failed to enter a filename. Exiting." | |
else | |
content=`zenity --entry --title="Content --" --text="What do you want your QR code to say?"` | |
button2=$? | |
if [ $button2 -eq 0 ];then | |
if [ -z $content ];then | |
zenity --info --title="Failure" --text="You failed to enter any content. Exiting." | |
else | |
qrencode -o "$outpath"/"$pname".png "$content" | |
zenity --info --title="Finished --" --text="Your QR code is located at : $outpath/$pname.png" | |
fi | |
else | |
zenity --info --title="Canceled" --text="QR code generation canceled - content" | |
fi | |
fi | |
else | |
zenity --info --title="Canceled" --text="QR code generation canceled - filename" | |
fi | |
else | |
zenity --info --title="Canceled" --text="QR code generation canceled - file path" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment