Page 36 of 76

Posted: Wed 26 Sep 2012, 20:27
by smokey01
Alternative to the above, all I need is some indication that the remote computer is online. I don't really need a chat client. When both computers are online each should be visible to each other. I guess a poke function would be useful just to let the other party know you want to communicate.

Thanks

Posted: Wed 26 Sep 2012, 22:42
by disciple
ping?
nbtscan?

Posted: Wed 26 Sep 2012, 23:15
by technosaurus
smokey01 wrote:Can anyone offer a simple gtkdialog GUI for netcat.
Goingnuts adapted my irc client to use netcat, I was just using Xdialog, but he may have used something else as well.

make string of argements for scrot-program

Posted: Mon 29 Oct 2012, 21:59
by sklimkin
Please help to master script.
There can be somebody collected a string of arguments from the program gtkdialog?

Here that I can't master in bash-gtkdialog:
#!/bin/bash
GTKDIALOG=gtkdialog

if [ "$COMBOBOX1" == "All" ]; then
COMMAND1=
##sprintf( COMMANDSTRING, "scrot -d %s -e 'mv $f ~%s'", COMBOBOX2, FILE );
else COMMAND1="-s"
##sprintf( COMMANDSTRING, "scrot -d %s -s -e 'mv $f ~%s'", COMBOBOX2, FILE );
echo "COMMAND1= $COMMAND1"
COMMAND2="$COMBOBOX2"
echo "COMMAND2= $COMMAND2"
COMMANDSTRING="-d $COMMAND2 $COMMAND1 -e 'mv $f ~'"
export COMMANDSTRING
echo "COMMANDSTRING= $COMMANDSTRING"
echo "End of export variables."
fi

export MAIN_DIALOG='
<window title="SCReenshOT screen-grabber">
<vbox>
... ... ...
I pass the insignificant
... ... ...
It is necessary to connect variable COMMANDSTRING here to what:
<button>
<label>ACCEPT</label>
<variable>GOMMANDSRING</variable>
<action>echo "Start of scrot:"</action>
<action>cat [ echo $COMMANDSTRING ] | scrot </action>
</button>

That is to transfer to function <action> a string of arguments for scrot (SCReen-shOT).

All other works: the directory for saving is selected, setting selected by the user are stored to an output from the program.

Commented out in the beginning of a file of a line ## sprintf (...) it that works in bash, but isn't accepted in gtkdialog and SO it would be desirable...

Corrected data to my previous post

Posted: Mon 29 Oct 2012, 22:24
by sklimkin
1. Script

Code: Select all

#!/bin/bash
GTKDIALOG=gtkdialog

if [ "$COMBOBOX1" == "All" ]; then
COMMAND1= 
##sprintf( COMMANDSTRING, "scrot -d %s -e 'mv $f ~%s'", COMBOBOX2, FILE );
else COMMAND1="-s"
##sprintf( COMMANDSTRING, "scrot -d %s -s -e 'mv $f ~%s'", COMBOBOX2, FILE );
echo "COMMAND1= $COMMAND1"
COMMAND2="$COMBOBOX2"
echo "COMMAND2= $COMMAND2"
COMMANDSTRING="-d $COMMAND2 $COMMAND1 -e 'mv $f ~'"
export COMMANDSTRING
echo "COMMANDSTRING= $COMMANDSTRING"
echo "End of export variables."
fi

export MAIN_DIALOG='
<window title="SCReenshOT  screen-grabber">
	<vbox>
		<frame Command button EXIT>
			<hbox>
				<button cancel></button>
			</hbox>
		</frame>

		<frame User-settings>
			<hbox>
				<vbox>
					<text>
						<label>Select grab-mode</label>
					</text>
					<combobox>
						<variable>COMBOBOX1</variable>
						<item>All</item>
						<item>Window</item>
						<item>Area</item>
						<action>save:COMBOBOX1</action>
						<variable>COMMAND1</variable>
					</combobox>
				</vbox>
				<vbox>
					<text>
						<label>Time-delay-sec</label>
					</text>
					<combobox>
						<variable>COMBOBOX2</variable>
						<item>0</item>
						<item>1</item>
						<item>2</item>
						<item>5</item>
						<item>10</item>
						<item>20</item>
						<action>save:COMBOBOX2</action>
						<variable>COMMAND2</variable>
					</combobox>
				</vbox>
				<button>
					<label>ACCEPT</label>
					<variable>GOMMANDSRING</variable>
					<action>echo "Start of scrot:"</action>
					<action>cat [ echo $COMMANDSTRING ] | scrot </action>
				</button>
			</hbox>
		</frame>

		<frame Select DIR for save screenshot>
			<chooser>
				<height>200</height>
				<width>200</width>
				<variable>FILE</variable>
				<default>/home/</default>
				<action>cat [ echo $FILE ] | zenity --text-info  --width=250 --height=250 --title $FILE</action>
			</chooser>
		</frame>
	</vbox>
</window>
'

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
2. Screenshot with "head"

Posted: Wed 31 Oct 2012, 17:58
by zigbert
sklimkin
I have read your post some times to get the grip of the problem....
Is it this line that won't work?

Code: Select all

<action>cat [ echo $COMMANDSTRING ] | scrot </action>
If you find gtkdialog sensitive to your bash code, remember, you can always place bash code in an external function. Like:

Code: Select all

call() {
 cat "$COMMANDSTRING" | scrot
}

[...]

<action>call </action>

Sigmund

Posted: Wed 31 Oct 2012, 19:46
by sklimkin
zigbert wrote:sklimkin
... ...
If you find gtkdialog sensitive to your bash code, remember, you can always place bash code in an external function. Like:

Code: Select all

call() {
 cat "$COMMANDSTRING" | scrot
}
[...]
<action>call </action>
Sigmund
Thanks for attention, Sigmund.
I read some hours about bash-scripting successively.
After that has corrected the program text:

Code: Select all

#!/bin/bash
GTKDIALOG=gtkdialog

funccommand () {
if [ "$COMBOBOX1" == "All" ]; then
COMMAND1= 
else COMMAND1="-s"
echo "COMMAND1= $COMMAND1"
COMMAND2="$COMBOBOX2"
echo "COMMAND2= $COMMAND2"
COMMANDSTRING="-d $COMMAND2 $COMMAND1 -e 'mv $f ~'"
echo "COMMANDSTRING= $COMMANDSTRING"
echo "End of export variables."
fi
}

export MAIN_DIALOG='
... ... ...

	<button>
		<label>ACCEPT</label>
		<variable>GOMMANDSRING</variable>
		<action>echo "Start of scrot:"</action>
		<action>funccommand $COMBOBOX1 $COMBOBOX2</action>
		<action>echo "COMMANDSTRING= $COMMANDSTRING"</action>
		<action>cat [ echo $COMMANDSTRING ] | scrot </action>
				</button>
In bash-script it works:

Code: Select all

sklimkin@sklimkin-desktop:~$ funccommand () {
> if [ "$COMBOBOX1" == "All" ]; then
> COMMAND1= 
> else COMMAND1="-s"
> echo "COMMAND1= $COMMAND1"
> COMMAND2="$COMBOBOX2"
> echo "COMMAND2= $COMMAND2"
> COMMANDSTRING="-d $COMMAND2 $COMMAND1 -e 'mv $f ~'"
> echo "COMMANDSTRING= $COMMANDSTRING"
> echo "End of export variables."
> fi
> }
sklimkin@sklimkin-desktop:~$ COMBOBOX2="5"
sklimkin@sklimkin-desktop:~$ COMBOBOX1="Window"
sklimkin@sklimkin-desktop:~$ GOMMANDSRING=""
sklimkin@sklimkin-desktop:~$ funccommand $COMBOBOX1 $COMBOBOX2
COMMAND1= -s
COMMAND2= 5
COMMANDSTRING= -d 5 -s -e 'mv  ~'
End of export variables.
sklimkin@sklimkin-desktop:~$
And in gtkdialog isn't works:

Code: Select all

Start of scrot:
sh: funccommand: command not found
COMMANDSTRING= 
sh: scrot: command not found
cat: [: file or dir missing
cat: echo: file or dir missing
cat: ]: file or dir missing
COMBOBOX1="Window"
COMBOBOX2="5"
FILE="/home/sklimkin/projects/gtkdialog/scrotdlg-bash2/dialog"
GOMMANDSRING=""
EXIT="Cancel"
sklimkin@sklimkin-desktop:~/projects/gtkdialog/scrotdlg-bash2$ 
gtkdialog doesn't find my new function funccommand ()

Code: Select all

sh: funccommand: command not found

Problem in this string:

Code: Select all

<action>funccommand $COMBOBOX1 $COMBOBOX2</action>
I want to understand how correctly to cause external functions from gtkdialog.
Probably such calls are inaccessible in prior versions gtkdialog
At me now:

Code: Select all

sklimkin@sklimkin-desktop:~$ gtkdialog -v
gtkdialog version 0.8.0 (C) 2003-2007 Laszlo Pere, 2011 Thunor
Also isn't works:

Code: Select all

#!/bin/bash
GTKDIALOG=gtkdialog

call() {
funccommand $COMBOBOX1 $COMBOBOX2
echo "call_COMMANDSTRING= $COMMANDSTRING"
cat "$COMMANDSTRING" | scrot
}

funccommand () {
if [ "$COMBOBOX1" == "All" ]; then
COMMAND1= 
else COMMAND1="-s"
echo "COMMAND1= $COMMAND1"
COMMAND2="$COMBOBOX2"
echo "COMMAND2= $COMMAND2"
COMMANDSTRING="-d $COMMAND2 $COMMAND1 -e 'mv $f ~'"
echo "COMMANDSTRING= $COMMANDSTRING"
echo "End of export variables."
fi
}

export MAIN_DIALOG='

	<button>
		<label>ACCEPT</label>
		<variable>GOMMANDSRING</variable>
		<action>echo "Start of scrot:"</action>
		<action>call </action>
	</button>
Thankful in advance for the correct helps.

Posted: Wed 31 Oct 2012, 22:52
by technosaurus
export -f func_name

Posted: Thu 01 Nov 2012, 19:04
by sklimkin
technosaurus wrote:export -f func_name
export -f
This that magic word of which didn't suffice for the question decision.
Thanks for the help, mr technosaurus!

Posted: Tue 06 Nov 2012, 22:27
by oldyeller
Hello Everyone

Has anyone used the fontbutton widget yet?

I have tried to use it to increase the font in the reader that I am making with the edit widget.

Don't know if you can use it in the edit widget or not.

This is my code so far
#!/bin/bash

GTKDIALOG=gtkdialog

WORKDIR="/usr/local/Manna"
NOTES_DIR="$WORKDIR/notestxt"

funcbtnCreate() {
echo '<button image-position="'$2'">
<label>"'"$3"'"</label>
<input file stock="'$4'"></input>
<action>echo "'"$5"' '$1'"</action>
<action type="'"$3"'">'$1'</action>
</button>'
}
export TMPDIR=/tmp/notes
mkdir -p "$TMPDIR"

echo "$TMPDIR"/reading

export MAIN_DIALOG='
<window title="Notes" icon-name="Com">

<frame>
<vbox spacing="0">
<menubar>
<menu use-underline="true">
<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
<action>exit:Quit</action>
</menuitem>
<label>"_File"</label>
</menu>
<menu label="_Edit" use-underline="true">
<menuitem stock-id="gtk-home" label="Send to Abiword">
<action>abiword '"$TMPDIR"'/reading &</action>
</menuitem>
</menu>
</menubar>
</vbox>
<hbox>
<vbox width-request="120">
<table>
<label>Notes</label>
<variable>ITEM</variable>
<input>ls '"$NOTES_DIR"'</input>
<action>ln -sf "/usr/local/Manna/notestxt/$ITEM" '"$TMPDIR"'/reading</action>
<action>refresh:EDITOR</action>
</table>
</vbox>
<edit editable="true" accepts-tab="true" indent="" justification="0" left-margin="12" right-margin="15" wrap-mode="1">
<variable>EDITOR</variable>
<height>600</height>
<width>350</width>
<input file>'"$TMPDIR"'/reading</input>
<output file>'"$TMPDIR"'/reading</output>
</edit>

</hbox>

<hbox homogeneous="true" spacing="28" width-request="350">
'"$(funcbtnCreate EDITOR 0 Refresh gtk-refresh Refreshing)"'
'"$(funcbtnCreate EDITOR 0 Save gtk-save Saving)"'

<fontbutton font-name="Sans 14" use-font="true" use-size="true">
<variable>$EDITOR</variable>
<input file>'"$TMPDIR"'/reading</input>
<output file>'"$TMPDIR"'/reading</output>

<action>refresh:EDITOR</action>
</fontbutton>
</hbox>
</frame>
</window>
'

case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --center --program=MAIN_DIALOG ;;
esac


GtkDialog + scrot = Graphic-interface

Posted: Sat 10 Nov 2012, 17:36
by sklimkin
sklimkin wrote:
technosaurus wrote:export -f func_name
export -f
This that magic word of which didn't suffice for the question decision.
Thanks for the help, mr technosaurus!
There was a task to make the graphic interface with the program scrot.
It is for this purpose convenient and pleasant to use gtkdialog and bash.
The variant with a call of additional function works.

Here that has turned out:

Code: Select all

#!/bin/bash 
## or /bin/sh 

funccommand () {
if [ "$COMBOBOX1" == "All" ]; then
COMMAND1="-m"
else COMMAND1="-s"
fi
## !!! Attention: This works in scrot ver. >= 0.8 only !!!
if [ "$COMBOBOX1" == "Window" ]; then
COMMAND1="-u"
fi
COMMAND2="$COMBOBOX2"
COMMANDSTRING="$COMMAND1-b-d $COMMAND2"
cd "$FILE"
scrot "$COMMANDSTRING"
}

export MAIN_DIALOG="
<window>
	<vbox>
		<text>
			<label>SCReenshOT  screen-grabber</label>
		</text>
		<frame Command button EXIT>
			<hbox>
				<button cancel></button>
			</hbox>
		</frame>
		<frame User-settings>
			<hbox>
				<vbox>
					<text>
						<label>Select grab-mode</label>
					</text>
					<combobox>
						<variable>COMBOBOX1</variable>
						<item>All</item>
						<item>Window</item>
						<item>Area</item>
						<action>save:COMBOBOX1</action>
					</combobox>
				</vbox>
				<vbox>
					<text>
						<label>Time-delay-sec</label>
					</text>
					<combobox>
						<variable>COMBOBOX2</variable>
						<item>0</item>
						<item>1</item>
						<item>2</item>
						<item>3</item>
						<item>5</item>
						<item>10</item>
						<item>20</item>
						<action>save:COMBOBOX2</action>
					</combobox>
				</vbox>
				<button>
					<label>ACCEPT</label>
					<action>$0 func</action>
				</button>
			</hbox>
		</frame>
		<frame Select DIR for save screenshot>
			<chooser>
				<height>200</height>
				<width>200</width>
				<variable>FILE</variable>
				<default>/home/</default>
				<action>save:FILE</action>
				<action>$2= $FILE</action>
			</chooser>
		</frame>
	</vbox>
</window>
"

case $1 in
	func) funccommand $2 ;;
	*) gtkdialog --program=MAIN_DIALOG ;;
esac
And it is variant of usage gtkdialog for C-lang:
http://www.mediafire.com/download.php?el5ruubgov613qg

ScreenShot of "SreenShoter":[/img][/code]

Posted: Mon 12 Nov 2012, 06:19
by recobayu
hi everyone,
i want to make a startmenu in puppy linux like "unity" in ubuntu or something like "metro start menu" in windows8. below, i make a button and scroll in vbox and gtkdialog desklet. but i want more..
i want to a textbox (an entry), that can search every program by change (key-pressed). can anyone help me, please?
thanks in advance

Posted: Mon 12 Nov 2012, 07:06
by smokey01

tag for closewindow

Posted: Thu 15 Nov 2012, 16:48
by sklimkin
I read old authoring gtkdialog help:
6.2 Widget manipulation
6.2.1 'Closewindow:NAME'
The command closes the named window opened by the 'Launch:' command. The program remain active if there are more windows active.
6.2.2 'Launch:NAME'
The command opens a new window using the environment variable 'Widget'.
For some reasons I can't use tags:

Code: Select all

<action type="launch">DIALOG1</action>
<action type="closewindow">DIALOG1</action>
I use and It works:

Code: Select all

<action>Launch:DIALOG1</action>
And it isn't works:

Code: Select all

<action>Closewindow:DIALOG1</action>
Why?
Who can help?

yaf-splash tip

Posted: Sat 22 Dec 2012, 18:55
by don570
Here's a tip....

Code: Select all

<action>yaf-splash -border false  -center -close box -bg orange -fontsize large -text "  John's  message
here   "  & </action>
The above code isn't allowed for the action of a button in a gtkdialog script,
because the text is on two lines.

A way around this problem is to define a variable at beginning of script
such as

Code: Select all

export MESSAGE=" John's message 
here "
Then the button's action becomes one line...

Code: Select all

<action>yaf-splash -border false  -center -close box -bg orange -fontsize large -text " $MESSAGE  "  & </action>

Image

_______________________________________________

I found that if Zigbert's localisation method is used then
MESSAGE=" John's message
here "

is all that is needed. In other words the exporting of the
variable isn't needed.

________________________________________


EDIT: I couldn't get this method of using yaf-splash in a button action
to work when there was a gettext text string :cry:

.

newbe question

Posted: Mon 31 Dec 2012, 07:35
by mavrothal
Happy New Year "dialoguers" :D

I'm trying to make a simple GUI for pet installation (below), but I can not find the way to pass the fileselect choice to petget (apparently did not study enough :oops: )

I appreciate any suggestions

Code: Select all

export INSTALL_PET_GUI='<window title="Pet installer GUI">
 <vbox>
   <frame>
   <text use-markup="true"><label>"Sellect a pet to install"</label></text>
     
   <hbox>
    <text><label>Sellect pet</label></text>
    <entry fs-action="file" fs-folder="/root" 
	tooltip-text="Drag or type the pet path here or use the file select button">
     <default>pet</default>
     <variable>EXEC</variable>
    </entry>
	<button>
     <input file stock="gtk-directory"></input>
     <action>fileselect:EXEC</action>
    </button>
   </hbox> 
   <hbox homogeneous="true">
   <button>
     <label>"Install"</label>
     <action>/usr/local/petget/petget ??? </action>
     <action>exit:apply</action>
   </button>
   <button cancel></button>
  </hbox>  
  </frame>
 </vbox>
</window>'
gtkdialog -p INSTALL_PET_GUI

Posted: Mon 31 Dec 2012, 09:14
by Geoffrey
Hi mavrothal,

This works

Code: Select all

<button>
     <label>"Install"</label>
     <action>/usr/local/petget/petget $EXEC</action>
     <action>exit:apply</action>
   </button>
or better yet, the full path isn't needed,

Code: Select all

<button>
     <label>"Install"</label>
     <action>petget $EXEC</action>
     <action>exit:apply</action>
   </button>
Cheers, ☃HaPpy NeWyEaR☘

Geoffrey

Posted: Mon 31 Dec 2012, 10:46
by mavrothal
Geoffrey wrote:This works

Code: Select all

<button>
     <label>"Install"</label>
     <action>/usr/local/petget/petget $EXEC</action>
     <action>exit:apply</action>
   </button>
Indeed it does.
Thanks and a Happy New Year to you

Posted: Mon 07 Jan 2013, 15:47
by thunor
Here's a nice tip:

Activating a menuitem processes the actions within the menuitem immediately and then returns to the activater.

Activating a button returns to the activater and then processes the actions within the button later when the button has finished animating.

So, a hidden menuitem is a good place to store lots of code that can be called (activated) from multiple places -- it can be thought of as a subroutine of gtkdialog pseudo-XML.

Here's an example that demonstrates the speed difference and the processing order (watch stdout in terminal):

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

RandomGet="od -An -N2 -tu2 < /dev/urandom"

MAIN_DIALOG='
<window title="Activate Test" window-position="1" resizable="false"
	border-width="0">
	<vbox spacing="0">
		<menubar>
			<menu use-underline="true" label="_File">
				<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
					<action>exit:Quit</action>
				</menuitem>
			</menu>
			<menu use-underline="true" label="_Code">
				<menuitem stock-id="gtk-refresh">
					<variable>muiMenuitemRoute</variable>
					<action>echo MenuitemRoute 2</action>
					<action>refresh:entMenuitemRoute</action>
					<action>echo MenuitemRoute 3</action>
				</menuitem>
			</menu>
		</menubar>
		<vbox border-width="50">
			<hbox>
				<button image-position="1">
					<label>Activate</label>
					<input file stock="gtk-go-forward"></input>
					<action>echo ButtonRoute 0</action>
					<action>activate:btnButtonRoute</action>
					<action>echo ButtonRoute 1</action>
				</button>
				<button image-position="1">
					<variable>btnButtonRoute</variable>
					<label>Refresh</label>
					<input file stock="gtk-go-forward"></input>
					<action>echo ButtonRoute 2</action>
					<action>refresh:entButtonRoute</action>
					<action>echo ButtonRoute 3</action>
				</button>
				<entry>
					<variable>entButtonRoute</variable>
					<input>"'$RandomGet'"</input>
				</entry>
			</hbox>
			<hbox>
				<button image-position="1">
					<label>Activate</label>
					<input file stock="gtk-go-forward"></input>
					<action>echo MenuitemRoute 0</action>
					<action>activate:muiMenuitemRoute</action>
					<action>echo MenuitemRoute 1</action>
				</button>
				<text label="Refresh"></text>
				<pixmap stock-icon-size="3">
					<input file stock="gtk-go-forward"></input>
				</pixmap>
				<entry>
					<variable>entMenuitemRoute</variable>
					<input>"'$RandomGet'"</input>
				</entry>
			</hbox>
		</vbox>
	</vbox>
</window>
'
export MAIN_DIALOG

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
Regards,
Thunor

Posted: Mon 07 Jan 2013, 16:38
by RSH
Hi.

I wanted to test the above posted script but it gives me an gtkdialog error in gtkdialog3, gtidialog4 and gtkdialog5.

Which version is used for this script?

RSH