Pictures viewer
Code written by ^silk
Choose a file -> displays info and picture into the dialog.Please note that the file type must be of the following: jpg,bmp,png,ico,jpeg,or gif. /picv to open this script. You can also double click the image to get a larger preview. Once in the preview, right-click the pic and click close if you wish to exit.
Click Set directory and set your pictures directory. Click Open picture and it opens the pic through your default pictures editor.
Thanks,
^silk
; Pictures viewer
; Code written by ^silk
; Choose a file -> displays info and picture into the dialog.
; Please note that the file type must be of the following: jpg,bmp,png,ico,jpeg,or gif.
; /picv to open this script
; You can also double click the image to get a larger preview
; Once in the preview, right-click the pic and click close if you wish to exit.
; Thanks,
; ^silk
alias picv dialog $iif($dialog(picv),-v,-m) picv picv
dialog picv {
title "Pictures viewer"
size -1 -1 207 248
option pixels
icon 1, 2 29 200 144
edit "<file name>", 2, 3 5 152 21, read autohs
button "Choose:", 3, 155 3 50 23, flat
text "Width: 0", 4, 12 180 72 17
text "Height: 0", 5, 117 179 72 18
edit "<filepath>", 6, 4 202 198 20, read autohs
button "Open picture", 7, 3 222 75 25, disable
button "Set directory", 8, 78 222 75 25
button "Close", 9, 153 222 51 25
}
on *:dialog:picv:sclick:3:{
%current.pic.disp = $$sfile($iif(%pic.directory,$($v1,2),$mircdir),Choose picture to display)
if ($($+(%,current,.,pic,.,disp),2) && $regex($gettok($nopath(%current.pic.disp),2,46),/^[.]?[jpg|bmp|png|gif|ico|jpeg]/)) {
did -ra $dname 2 $nopath(%current.pic.disp)
did -ra $dname 4 Width: $+($pic($+(",%current.pic.disp,")).width,w)
did -ra $dname 5 Height: $+($pic($+(",%current.pic.disp,")).height,h)
did -g $dname 1 $+(",%current.pic.disp,")
did -ra $dname 6 $($+(%,current,.,pic,.,disp),2)
did -e $dname 7
}
}
on *:dialog:picv:close:0:unset %current.pic.disp
on *:dialog:picv:dclick:1:{
window -pdhka +b @pic 1 1 $pic($+(",%current.pic.disp,")).width $pic($+(",%current.pic.disp,")).height
drawpic @pic 0 0 $+(",%current.pic.disp,")
}
on *:dialog:picv:sclick:9:{
if ($window(pic)) window -c @pick
dialog -x $dname $dname
}
on *:dialog:picv:sclick:8:{
var %sd = $$sdir($mircdir,Select directory)
if (%sd) set %pic.directory %sd
}
menu @pic {
close:window -c @pic
}