Linux Lite Forums

Development => Scripting and Bash => Topic started by: anon222 on October 02, 2014, 09:38:09 PM

Title: Preview and download images and files with zenity dialog
Post by: anon222 on October 02, 2014, 09:38:09 PM
I've experimented with --text-info, I've discovered it is possible to view and download images and any other files with it with just drag and drop.
Hrere we go, with this it's easy to quick grab images.
This script opens Scot(0)'s image from imgur.com in zenity dialog
Image can be dragged to the Desktop.
It will copy the image to the Desktop.
--checkbox can be removed here :)
Code: [Select]
#!/bin/bash
zenity --text-info --title="Forums" --width=1000 --height=800  --html --url="http://i.imgur.com/7izQZgD.jpg" --checkbox="I'm sure I want to remove Windows"
if [ "$?" -eq "0" ];then
      zenity --info --text="You clicked OK,\nWindows destroyed. :)"
else
       exit 0
fi

This script opens /github.com/linuxlite/litesoftware
Find a button 'Download ZIP', drag it to the desktop
It will copy master.zip on the Desktop
Code: [Select]
#!/bin/bash
zenity --text-info --title="Forums" --width=1000 --height=800  --html --url="https://github.com/linuxlite/litesoftware"
if [ "$?" -eq "0" ];then
      zenity --info --text="You clicked OK"
else
       exit 0
fi

This oone opens www.linuxliteos.com/forums/ and does nothing special :)
No link can be used or clicked.
Code: [Select]
#!/bin/bash
zenity --text-info --title="Forums" --width=850 --height=800  --html --url="http://www.linuxliteos.com/forums/"
if [ "$?" -eq "0" ];then
      zenity --info --text="You clicked OK"
else
       exit 0
fi

The last one opens a local index.html file but doesn't load any images.
Code: [Select]
#!/bin/bash
zenity --text-info --title="Forums" --width=850 --height=800  --html --filename="/usr/share/doc/litemanual/index.html"
if [ "$?" -eq "0" ];then
      zenity --info --text="You clicked OK"
else
       exit 0
fi
Anyway the script can be used instead of --question dialog
Just need to replace  'zenity --info --text="You clicked OK"' with a command.