Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 19 Sep 2018, 05:36
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
YAD - Tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 23 of 35 [512 Posts]   Goto page: Previous 1, 2, 3, ..., 21, 22, 23, 24, 25, ..., 33, 34, 35 Next
Author Message
misko_2083


Joined: 08 Nov 2016
Posts: 55

PostPosted: Sat 27 Jan 2018, 22:47    Post subject:  

stemsee wrote:
Here is an idea I would like to get working.
Code:
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
exec 9<> /tmp/PIPE9

function scan (){
PATTERN='
s/^.*ESSID://p'
MENU=`iwlist wlan2 scan | sed -rn "$PATTERN" | tac | tr '\n'  '|'`
list=`echo $MENU >/tmp/scan`
echo "menu:$MENU" >&9 &
}
export -f scan

yad --notification --icon=/usr/share/pixmaps/wireless.png --listen --text="Scanner" --command="geany /tmp/scan" <&9 &
while true
do
bash -c scan
sleep 4
done


This uses yad --notification --listen to change menu items. In this usage the menu items are the APs found from iwlist scan. The APs are one per line, "AP1"|"AP2"|"AP3" how to interpolate
Code:
!bash -c connect1!/usr/share/pixmaps/wireless.png|
"AP1"|bash -c connect1|/usr/share/pixmaps/wireless.png|"AP2"!bash -c connect2!/usr/share/pixmaps/wireless.png|


The problems I need to help to solve are 1) only scan on click.
2) click on menu item to select AP to connect with
3) show an icon next to each AP entry

This is an example that opens a text-info dialog when you click the item in the notification dialog's popup menu.
Code:
#!/bin/bash
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
trap "rm -f /tmp/PIPE9" EXIT

exec 9<> /tmp/PIPE9

function scan (){
PATTERN='
s/^.*ESSID://p'
iwlist wlan2 scan | sed -rn "$PATTERN" | tac >/tmp/scan
MENU="$(while read -r line ;do
   printf "%s" "Connect $line!bash -c \"yad --text-info --width=400 --height=300 <<<$(echo $line)\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/scan)"

echo "icon:/usr/share/pixmaps/wireless.png" >/tmp/PIPE9
echo "tooltip:Tooltip" >/tmp/PIPE9
echo "menu:Refresh!bash -c scan!gtk-refresh|About!bash -c 'yad --about'!gtk-about||$MENU|Quit!quit!gtk-quit" >/tmp/PIPE9
}
export -f scan

yad --notification --listen --text="Scanner" --command="geany /tmp/scan" <&9 & NOTIF_ICON=$!
sleep 1
bash -c scan

wait $NOTIF_ICON
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1084

PostPosted: Sun 28 Jan 2018, 13:43    Post subject:  

slavvo67 wrote:
Thanks, Step. So I gather passing the button values in your example would require an awk command? We're not numbering the buttons like in my YAD example.

Hi slavvo67, I'm sorry but I haven't got enough time and courage Smile to read your entire script. I thought you were asking how to make a button grid. You can only make it with a --form dialog. Before you do, read the yad manual to understand if the capabilities of form buttons suit your needs.
yad manual wrote:

BTN - button field. Label may be in form text in a form LABEL[!ICON[!TOOLTIP]] where `!' is an item separator. LABEL is a text of button label or gtk
stock id. ICON is a buttons icon (stock id or file name). TOOLTIP is an optional text for popup help string. Initial value is a command which is running
when button is clicked. A special sympols %N in command are replaced by value of field N. If command starts with @, the output of command will be parsed
and lines started with number and colon will be treats as a new field values. A quoting style for value when sh -c is used - a single quotes around com‐
mand and double quotes around -c argument
FBTN - same as button field, but with full relief of a button.

Will this work for your script? Or will you need to change the way your script handles a button click?

_________________
Fatdog64-721|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2262
Location: In The Way

PostPosted: Sun 28 Jan 2018, 21:10    Post subject:  

misko_2083 wrote:

This is an example that opens a text-info dialog when you click the item in the notification dialog's popup menu.


This is fantastic magic!
I have adapted your code a bit. removed the bashism '<<<' so more portable > '/bin/sh'
Seems to be working well.
I call the script netmenu

netmenu-0.1-alpha
Code:
#!/bin/sh
#

depsfn () {        # check dependencies
   dhclu=`busybox which udhcpc`
   dhcld=`busybox which dhcpcd`
   if [[ ! -z "${dhclu}" ]]; then
      dhl1="udhcpc -A 8 -p /var/run/udhcpc.pid -s /usr/share/udhcpc/default.script -i"
      dhl2="/usr/share/udhcpc/default.script deconfig"
      dhl3="udhcpc"
   elif [[ -z "${dhclu}" ]]; then
      dhl1="dhcpcd -z"
      dhl2="dhcpcd -k"
      dhl3="dhcpcd"
   elif [[ -z "${dhclu}" && -z "${dhcld}" ]]; then
      zenity --info --text "$dhclu and $dhcld not found"
      echo "$dhclu and $dhcld not found"
   fi
   export dhl1
   export dhl2
   export dhl3
}
depsfn
interfacefn () {
for wit in `ls /sys/class/net`
do
   case $wit in
      wl*) int=${wit};;
      eth0|eth2|eth4|eth6|enp2s0f2) eth=${wit};;
      eth1|eth3|eth5|eth7) eths=${wit};;
      enp0s20u3|usb0|usb1) usb0=${wit};;
   esac
done
}
interfacefn
if [[ "$1" = eth0-u ]]; then
   ifconfig ${eth} up
   ${dhl1} ${eth}
   exit
fi
if [[ "$1" = eth0-d ]]; then
   ifconfig ${eth} down
   ${dhl2} ${eth}
   exit
fi
if [[ "$1" = usb0-u ]]; then
   ifconfig ${usb0} up
   ${dhl1} ${usb0}
   exit
fi
if [[ "$1" = usb0-d ]]; then
   ifconfig ${usb0} down
   ${dhl2} ${usb0}
   exit
fi
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
exec 9<> /tmp/PIPE9
if [[ -z "$int" ]]; then
   int=`ls /sys/class/net/ | grep -v lo | grep -v eth | grep -v usb | head -1`
fi
export int
ifconfig $int up
touch /tmp/ap

function cleanfinish (){
   rm -f /tmp/PIPE9
   rm -f /tmp/netsel
   rm -f /tmp/scan
   rm -f /tmp/scan2
   rm -f /tmp/n
   ifconfig $int down
   "$dhl2" $int
}
trap cleanfinish EXIT

function connectfn (){
      details=$(yad --form --columns=2 --field="Password:H" -entry "" --field="ID" -entry "")
      password=`echo $details | cut -f1 -d'|'`
      id=`echo $details | cut -f2 -d'|'`
      
   while read line
   do
      ssid="$line"
   done < /tmp/ap

if [[ ! -z "$id" && ! -z "$password" ]]; then
   echo "ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1

network={
   ssid='$ssid'
   identity='$id'
   password='$password'
   key_mgmt=WPA-EAP
   eap=PEAP
   #ca_cert='$HOME/.wifi-connect/ca.pem'
   #phase1='peaplabel=0'
   phase2='auth=MSCHAPV2'
}
" | tr "'" '"' > /tmp/netsel
elif [[ ! -z "$password" && -z "$id" ]]; then
   wpa_passphrase "$ssid" "$password" > /tmp/netsel
elif [[ -z "$password" && -z "$id" ]]; then
      echo "ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1

network={
   ssid='$ssid'
   #bssid=$address
   key_mgmt=NONE
}
" | tr "'" '"'  > /tmp/netsel
fi
CURRENTIPS=$(ip addr show | grep $int | grep inet | awk '{print $2}')
ifconfig $int down
for I in ${CURRENTIPS}; do ip addr del $I dev ${int}; done 2> /dev/null
ip route flush dev $int 2> /dev/null
killall -9 $dhl3 2> /dev/null
killall -9 wpa_supplicant 2> /dev/null
rm -f /var/db/$dhl3-${int}.lease 2> /dev/null
rm -f /var/lib/$dhl3/$dhl3-${int}.lease 2> /dev/null
rm -f /var/run/wpa_supplicant/$int 2> /dev/null
ifconfig $int up 2> /dev/null
wpa_supplicant -Dwext -i$int -c/tmp/netsel -B
$dhl1 $int
}
export -f connectfn

function inotify (){
while inotifywait -e close_write /tmp/ap
do
   bash -c connectfn
   sleep 10
done
}
export -f inotify
bash -c inotify &

function scan (){

PATTERN='s/^.*key:([onf]*)/~\1~/p
s/^.*ESSID://p'
iwlist $int scan | sed -rn "$PATTERN" >/tmp/scan2
cat /tmp/scan2 | grep -v [onf] > /tmp/scan
cat /tmp/scan2 | grep -e'~on~' -e '~off~' > /tmp/encryption

MENU="$(while read -r line ;do
   printf "%s" "$int ${line}!bash -c \"echo "$line" > /tmp/ap\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/scan)"
sixth="Ethernet connect!netmenu eth0-u!/usr/share/icons/oxygen/22x22/devices/network-wired.png|"
seventh="Ethernet disconnect!netmenu eth0-d!/usr/share/icons/oxygen/22x22/devices/network-wiredx.png|"
tenth="Connect mobile!netmenu usb0-u!/usr/share/icons/oxygen/22x22/devices/phone.png|"
eleventh="Disconnect mobile!netmenu usb0-d!/usr/share/icons/oxygen/22x22/devices/phonex.png|"
echo "icon:/usr/share/pixmaps/wireless.png" >/tmp/PIPE9
echo "tooltip:$int" >/tmp/PIPE9
echo "menu:Refresh!bash -c scan!gtk-refresh|About!bash -c 'yad --about'!gtk-about||$MENU|$sixth$seventh$tenth$eleventh||Quit!quit!gtk-quit" >/tmp/PIPE9
}
export -f scan

yad --notification --listen --text="Scanner" --command="geany /tmp/encryption" <&9 & NOTIF_ICON=$!
sleep 1
bash -c scan

wait $NOTIF_ICON
netmenu.png
 Description   
 Filesize   5.58 KB
 Viewed   656 Time(s)

netmenu.png

netmenu-0.1-alpha.png
 Description   
 Filesize   16.28 KB
 Viewed   668 Time(s)

netmenu-0.1-alpha.png

netmenu-0.1-alpha.png
 Description   
 Filesize   21.08 KB
 Viewed   650 Time(s)

netmenu-0.1-alpha.png

netmenu.png
 Description   
 Filesize   25.52 KB
 Viewed   644 Time(s)

netmenu.png


Last edited by stemsee on Tue 30 Jan 2018, 06:19; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger 
stemsee

Joined: 27 Jun 2013
Posts: 2262
Location: In The Way

PostPosted: Tue 30 Jan 2018, 05:47    Post subject:  

The MENU portion of this code preserves spaces for the yad menu, but when printed to the /tmp/ap file the space within quoted AP name disappears! i have tried variations of echo, printf, tee, redirections, bracketing, quoting ... but nothing I have tried works. There is one way that prints the desired format "My Way Cafe" but it does not print the selected item, just the first one slips through. Here is the suspect code that loses the space
Code:
MENU="$(while read -r line ;do
   printf %s "${line}!bash -c \"echo "$line" > /tmp/ap\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"

this is the variation that prints a line, not the selected line, in correct format
Code:
MENU="$(while read -r line ;do
   printf %s "${line}!bash -c \"$(echo "$line" > /tmp/ap)\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"


/tmp/ap is being watched by inotifywait -e close_write which triggers 'bash -c connectfn'. It connects after first scan without selecting AP, because one slips through! I know this is more of a coding issue than a yad issue, although it is in a yad menu, but any further help appreciated.
xscreenshot-20180130T103717.png
 Description   menu
 Filesize   36.85 KB
 Viewed   564 Time(s)

xscreenshot-20180130T103717.png

xscreenshot-20180130T094053.png
 Description   missing spaces
 Filesize   1.33 KB
 Viewed   582 Time(s)

xscreenshot-20180130T094053.png

xscreenshot-20180130T094038.png
 Description   correct spacing
 Filesize   1.78 KB
 Viewed   575 Time(s)

xscreenshot-20180130T094038.png

Back to top
View user's profile Send private message MSN Messenger 
misko_2083


Joined: 08 Nov 2016
Posts: 55

PostPosted: Tue 30 Jan 2018, 15:52    Post subject:  

stemsee wrote:
The MENU portion of this code preserves spaces for the yad menu, but when printed to the /tmp/ap file the space within quoted AP name disappears! i have tried variations of echo, printf, tee, redirections, bracketing, quoting ... but nothing I have tried works. There is one way that prints the desired format "My Way Cafe" but it does not print the selected item, just the first one slips through. Here is the suspect code that loses the space
Code:
MENU="$(while read -r line ;do
   printf %s "${line}!bash -c \"echo "$line" > /tmp/ap\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"

this is the variation that prints a line, not the selected line, in correct format
Code:
MENU="$(while read -r line ;do
   printf %s "${line}!bash -c \"$(echo "$line" > /tmp/ap)\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"


/tmp/ap is being watched by inotifywait -e close_write which triggers 'bash -c connectfn'. It connects after first scan without selecting AP, because one slips through! I know this is more of a coding issue than a yad issue, although it is in a yad menu, but any further help appreciated.

The problems are with escaping quotes and spaces.

As a workaround you can use print %q
printf %q "$line" escapes quotes and spaces
\"MC\ cm\"\ ~on~
later when you use echo -e
Code:
$ echo -e  \"MC\ cm\"\ ~on~

it will return
"MC cm" ~on~

Code:
MENU="$(while read -r line ;do
   WIFI="$(printf %q "$line")"
   printf "%s" "${line}!bash -c 'echo -e ${WIFI} > /tmp/ap'!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"

Works for echo too.
Code:
MENU="$(while read -r line ;do
   WIFI="$(printf %q "$line")"
   echo -ne "${line}!bash -c 'echo -e ${WIFI} > /tmp/ap'!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"

Note that special characters in the hotspot name like "!" and "|" will make a mess in the righ-click popup because they are used as the splitters in yad --notification dialog.

One more thing I spoted in the script. No need for opening pipe and extra cat command.
Code:
cat file | grep "something" > file2

grep has built in that can read files
Code:
grep "something"  file > file2
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2262
Location: In The Way

PostPosted: Wed 31 Jan 2018, 06:35    Post subject:  

Thanks @ misko_2083

'cat grep' novice error. I now know 'grep -v -e' for multiple inversions, after some research. grep --help yields only '-v, --invert-match select non-matching lines'

Your code now works perfectly. A great lesson in itself!

I had already implemented a workaround, in the pop up gui for password/id input, I simply listed scan results selector.

Thanks again
stem
netmenu.fake.gz
Description 
gz

 Download 
Filename  netmenu.fake.gz 
Filesize  10.11 KB 
Downloaded  53 Time(s) 
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 3353
Location: holland

PostPosted: Sun 04 Feb 2018, 07:46    Post subject:  

Hello,
I'm having a similar problem as stemsee had above (space not showing), but for me it's the underscore not showing in the yad notification menu.
For example, I have filenames in /root/test contaning underscores
Code:
root@live:~/test# ls
my_file_1  my_file_2  my_file_3

My goal is to list these files in the yad menu and process them further, however the processing works fine (open the files with leafpad, for example), the filenames are missing underscores in the menu (see screenshot)
Anyone understands what's happening here? When I uncomment "set -x" in the create_menu function, I see all names displayed correctly, here's simplified script:
Code:
#!/bin/bash

on_click() {
# Help text
echo -en " Helptext \n\n text" | yad --title="Help" --text-info --wrap --fore=white --back="gray26" --fontname=Bold --height=350 --width=500 --button="gtk-close"
}
export -f on_click

quit_tray () {
pidnoti="`ps -eo pid,cmd | grep -v grep | grep "yad --notification --text=$POPUP_TEXT" | awk '{ print $1 }'`"
kill $pidnoti 2> /dev/null
rm -f $PIPE
}
export -f quit_tray

exec_file () {
leafpad "$DIR/$file"
# and/or more stuff to do with $file
}
export -f exec_file

create_menu () {
# set -x
export DIR="/root/test"
LISTFILES="$(ls "$DIR" 2> /dev/null)"
MENU=$(
while read -r file; do
[ -n "$LISTFILES" ] && echo -n "${file}! bash -c 'export file=$file; exec_file'!gtk-ok|"
done <<< "$LISTFILES")
}
export -f create_menu

TRAY_ICON="gtk-directory"
POPUP_TEXT="Menu"
export PIPE=$(mktemp -u --tmpdir ${0##*/}.XXXXXXXX)
mkfifo $PIPE

# attach a file descriptor to the file
exec 3<> $PIPE

create_menu
GET_MENU="${MENU}|Exit! bash -c quit_tray!gtk-quit"
echo menu:"${GET_MENU}" 2> /dev/null >&3
 
GUI=$(yad --notification --text="$POPUP_TEXT" --listen \
--image="$TRAY_ICON" \
--text="$POPUP_TEXT" \
--command="bash -c on_click" <&3 ) & NOTIF_ICON=$!
wait $NOTIF_ICON  #misko_2083
2018-02-04-124146_257x244_scrot.png
 Description   yad notification menu not showing underscores
 Filesize   77.96 KB
 Viewed   452 Time(s)

2018-02-04-124146_257x244_scrot.png


_________________
Dog Linux website
Back to top
View user's profile Send private message 
some1

Joined: 17 Jan 2013
Posts: 81

PostPosted: Sun 04 Feb 2018, 13:00    Post subject:
Subject description: use double underscore
 

fredx181
Yad/the gui probably interpretes a single underscore - as an indication of an accellerator-key/shortcut.

Replace:
Code:
[ -n "$LISTFILES" ] && echo -n "${file}....

with
Code:
[ -n "$LISTFILES" ] && echo -n "${file//_/__}....

and you will see the filenames with underscore(s) in the tray-menu.

Please observe that file is also a command-name.
You may want to use a different varname.
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3353
Location: holland

PostPosted: Sun 04 Feb 2018, 14:03    Post subject:  

some1 wrote:
Replace:
Code:
[ -n "$LISTFILES" ] && echo -n "${file}....

with
Code:
[ -n "$LISTFILES" ] && echo -n "${file//_/__}....

and you will see the filenames with underscore(s) in the tray-menu.


Great !! Works perfectly, didn't expect the solution would be that simple, many thanks, some1 !

Quote:
Please observe that file is also a command-name.

Yeah, good advice, better be safe.

EDIT: Here's the program I made with the concept of a file list in the menu and processing them further (in this case by loading or unloading a .squashfs or .sfs module)
http://murga-linux.com/puppy/viewtopic.php?p=982262#982262
I'm pretty excited about what y'all can do with the yad tray icon menu Very Happy
Thanks stemsee and misko_2083 !!

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
matchpoint

Joined: 26 Jan 2018
Posts: 169

PostPosted: Thu 08 Feb 2018, 11:04    Post subject:  

Hey Puppers,

Since I'm not yet too familiar with YAD, I'm hoping someone here can show me what this might look like piped into YAD. TIA.
Code:
#!/bin/bash

echo "*** Temperature scale conversion ***"
echo "1. Convert Celsius to Fahrenheit"
echo "2. Convert Fahrenheit to Celsius"
echo -n "Select 1 or 2, then Enter:"
read choice

if [ $choice -eq 1 ]
then
  echo -n "Enter temperature (C) : "
  read tc
  # formula Tf=(9/5)*Tc+32
  tf=$(echo "scale=2;((9/5) * $tc) + 32" |bc)
  echo "$tc C = $tf F"
elif [ $choice -eq 2 ]
then
  echo -n "Enter temperature (F) : "
  read tf
  # formula Tc=(5/9)*(Tf-32)
  tc=$(echo "scale=2;(5/9)*($tf-32)"|bc)
  echo "$tf F = $tc C"
else
  echo "Please select 1 or 2 only"
  exit 1
fi

echo -n "
-->  Press any key to exit "
read echoice

exit 0
Back to top
View user's profile Send private message 
april

Joined: 14 Sep 2013
Posts: 1241
Location: Green Island baby!

PostPosted: Sat 10 Feb 2018, 02:44    Post subject:  

What command would you like to see . Same result yad first or last
capture27172.png
Description 
png

 Download 
Filename  capture27172.png 
Filesize  52.86 KB 
Downloaded  50 Time(s) 
Back to top
View user's profile Send private message Yahoo Messenger 
matchpoint

Joined: 26 Jan 2018
Posts: 169

PostPosted: Sat 10 Feb 2018, 10:57    Post subject:  

Hi April, and thanks. What I'm asking for is an example for having YAD handle the exchange. Then, maybe it's not YAD I'm after but GtkDialog. There's a nice example here, several here, and an intro by zigbert here. As not to spend much time trying to reinvent the wheel, and considering the amount of user input remains the same, I assigned an icon to my script and placed it on the launch bar for easy-peasy access.
cel2fah-launch.jpg
 Description   
 Filesize   8.19 KB
 Viewed   251 Time(s)

cel2fah-launch.jpg

Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3353
Location: holland

PostPosted: Sat 10 Feb 2018, 11:07    Post subject:  

Hi matchpoint, something like this maybe ?

Code:
#!/bin/bash

SETUP=`yad --title="Temperature scale conversion" --center --text="   <b>*** Temperature scale conversion ***</b>" \
--width=400 \
--window-icon="preferences-system" --form  \
--field=" Select: :CB" "Convert Celsius to Fahrenheit!Convert Fahrenheit to Celsius" \
--field=" Set temperature: :NUM" "1!1..500!1" \
--button="gtk-cancel:1" --button="gtk-ok:0"`
[[ $? -ne 0 ]] && exit 1

export CHOICE=$(echo $SETUP | cut -d "|" -f 1)
export TEMP_=$(echo $SETUP | cut -d "|" -f 2 | cut -f1 -d".")

case $CHOICE in
"Convert Celsius to Fahrenheit")
  tc=$TEMP_
  # formula Tf=(9/5)*Tc+32
  tf=$(echo "scale=2;((9/5) * $tc) + 32" |bc)
  echo "$tc C = $tf F" | yad --title="Celsius to Fahrenheit" --center --text-info --width=300 --button="gtk-close:0"
;;
"Convert Fahrenheit to Celsius")
  tf=$TEMP_
  # formula Tc=(5/9)*(Tf-32)
  tc=$(echo "scale=2;(5/9)*($tf-32)"|bc)
  echo "$tf F = $tc C" | yad --title="Fahrenheit to Celsius" --center --text-info --width=300 --button="gtk-close:0"
;;
esac


EDIT: Removed "--text-align=center" from above script for compatibility with older yad version

Fred

_________________
Dog Linux website

Last edited by fredx181 on Sat 10 Feb 2018, 12:54; edited 2 times in total
Back to top
View user's profile Send private message 
matchpoint

Joined: 26 Jan 2018
Posts: 169

PostPosted: Sat 10 Feb 2018, 12:08    Post subject:  

Maybe Fred, it didn't open anything though.

It looks like your intention was for me to save it as a script and have it open a kind of message box, correct?

What's the "esac" on the end? YAD lingo?
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3353
Location: holland

PostPosted: Sat 10 Feb 2018, 12:16    Post subject:  

matchpoint wrote:
It looks like your intention was for me to save it as a script and have it open a kind of message box, correct?

What's the "esac" on the end? YAD lingo?


Yes, save it for example as "tempconv" and make excutable:
Code:
chmod +x tempconv

And run it.

The esac in not yad code, it's builtin bash code, "case ... in", should be finished with esac, just like if ....; fi
Only where it shows "yad ......." is yad code.

edit: hopefully you have higher yad version than 0.12 (which is included in some Puppies), probably works only with version higher than 0.12 (or maybe needs some adjustments to make it work with 0.12)
edit2: edited the script above slightly so there's better chance it works with older yad.

Fred
2018-02-10-171517_402x176_scrot.png
 Description   Convert temperature
 Filesize   26.13 KB
 Viewed   247 Time(s)

2018-02-10-171517_402x176_scrot.png


_________________
Dog Linux website
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 23 of 35 [512 Posts]   Goto page: Previous 1, 2, 3, ..., 21, 22, 23, 24, 25, ..., 33, 34, 35 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1818s ][ Queries: 12 (0.0977s) ][ GZIP on ]