Skip to content

Instantly share code, notes, and snippets.

@kokoye2007
Created September 23, 2017 10:54
Show Gist options
  • Save kokoye2007/c459ce5f68177c81ae098ed9514ab2ee to your computer and use it in GitHub Desktop.
Save kokoye2007/c459ce5f68177c81ae098ed9514ab2ee to your computer and use it in GitHub Desktop.
QR Code Create test bash zenity and qrencode
#!/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