Page 1 of 1
Yad -- Update textinfo from file stdin-input
Posted: Tue Nov 24, 2020 3:49 pm
by arivas_2005
Greetings
will it be possible to update the text-info with yad?
sample
Code: Select all
yad --geometry=20x40+500+400 --fontname="Arial Bold 15" --wrap --justify="center" --margins=1 --tail --editable --fore=green --back=yellow --listen --auto-close --auto-kill --monitor --text-info </tmp/tempo.txt &
## based on-->: https://www.mankier.com/1/yad#Options-Text_info_options
for i in {1..5};do
echo $i >/tmp/tempo.txt
sleep 3
done
in this script the text-info is not updated.
will it be possible to make it update?
too, (geometry options not works!)
thanks for your support
Re: Yad -- Update textinfo from file stdin-input
Posted: Mon Nov 30, 2020 5:34 pm
by arivas_2005
After searching .. searching and searching
I found a little script suggested by MochiMoppel
is at http://murga-linux.com/puppy/viewtopic. ... &start=285
and is the following:
Code: Select all
#!/bin/bash
export PIPE_03=/tmp/yadpipe03
mkfifo $PIPE_03
exec 3<> $PIPE_03
yad --icons --single-click --height=300 --width=500 --listen < $PIPE_03 &
echo -e "Name\nTooltip\ngtk-ok\nbeep\nFALSE" > $PIPE_03
sleep 1
echo -e "Yes\nTooltip\ngtk-yes\nbeep\nFALSE" > $PIPE_03
sleep 1
echo -e "No\nTooltip\ngtk-no\nbeep\nFALSE" > $PIPE_03
------------------------
I must explain that there are several elements of the script that I do not know and do not understand how they are used and what they are used for in each case
But...
------------------------
After experimenting again and again, I was able to rebuild and thus I found the answer to what I was looking for.
"how to insert data in yad after the window is opened." I had something like that.
Code: Select all
#!/bin/bash
export PIPE_03=/tmp/yadpipe03
mkfifo $PIPE_03
exec 3<> $PIPE_03
#yad --icons --single-click --height=300 --width=500 --listen < $PIPE_03 &
yad --title "unodostrescuatro" --text-info < $PIPE_03 > /tmp/yadpipe04 --editable --listen --monitor --height=220 --width=70 &
for i in {1..2}
do
echo -e "PASS ""$i" > $PIPE_03
sleep 2
done
sleep 2
echo -e "FIN " > $PIPE_03
###--------------
#Now my problem is how to retrieve the content.
#I have experimented with these lines and cannot capture the content of the yad
echo "----------------------1"
tail -f $PIPE_03
echo "----------------------2"
cat >$PIPE_03 &
cat $PIPE_03
echo "----------------------3"
tail -F /tmp/yadpipe04
echo "----------------------4"
# I need to retrieve that content from the PIPE or /tmp/yadpipe04
.
Now my problem is how to retrieve the content.
I need to retrieve that content from the PIPE or /tmp/yadpipe04
I'm sure this little script can be done better or corrected unnecessarily
--------------------
Thanks
Re: Yad -- Update textinfo from file stdin-input
Posted: Mon Nov 30, 2020 7:01 pm
by fredx181
Not sure what exactly you want to accomplish, but to update text-info, I would just pipe it to yad like this:
Code: Select all
(
for i in {1..5};do
echo $i
sleep 3
done
) | yad --geometry=20x40+500+400 --fontname="Arial Bold 15" --wrap --justify="center" --margins=1 --tail --editable --fore=green --back=yellow --listen --auto-close --auto-kill --monitor --text-info &
Fred
Re: Yad -- Update textinfo from file stdin-input
Posted: Mon Nov 30, 2020 9:06 pm
by arivas_2005
thanks for the reply, Fred
my dilemma is that the yad must receive different inputs, (because the script is lengthened and the yad receives the inputs)
that is why I have placed the yad first and the script after.
was what attracted me to the MochiMoppel version
So that's my dilemma.
If the script goes later and will fill up with several entries, in the end, how do I collect everything at once
that's what i tried to do with him $PIPE_03 > /tmp/yadpipe04
but when running a 'cat /tmp/yadpipe04'
it doesn't work for me (as if the file /tmp/yadpipe04 is trapped).
The file /tmp/yadpipe04 does battle everything that is entered and edited, but I cannot access it ! ..
with cat nothing comes out (/tmp/yadpipe04) but when I see the file with leafpad it is filled with everything I enter the yad box
So ... how do I read (/tmp/yadpipe04) it during the process?
(or it is not possible what I am trying to do?)
Thanks!
Re: Yad -- Update textinfo from file stdin-input
Posted: Tue Dec 01, 2020 3:09 am
by MochiMoppel
arivas_2005 wrote: Mon Nov 30, 2020 9:06 pm
that's what i tried to do with him $PIPE_03 > /tmp/yadpipe04
This should work, however you probably attempt to read the file when it still has no data.
When you start the yad command is creates an empty /tmp/yadpipe04
The yad command ends with a trailing '&', which means that the dialog window pops up and the script continues
When the script reaches a tail or cat comand while the dialog is still open, your tail or cat command will fail because there are still no data to read.
After you close the yad dialog with the "OK" button all data will be written to /tmp/yadpipe04 and you should be able to read the file.
Re: Yad -- Update textinfo from file stdin-input
Posted: Wed Dec 02, 2020 2:04 am
by arivas_2005