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 Thu 19 Oct 2017, 16:28
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GTK
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
slavvo67

Joined: 12 Oct 2012
Posts: 1424
Location: The other Mr. 305

PostPosted: Sat 27 Jun 2015, 23:48    Post subject:  GTK  

Can anyone help me pass the directory choice in the script below to a variable? The language below came with the GTK Dialog examples in one of the puppy distros. I just want to pull out the directory choice into a variable and cd to that variable.

#!/bin/sh

GTKDIALOG=gtkdialog

funcbtnCreate() {
echo '<button>
<input file stock="gtk-'$2'"></input>
<action>fileselect:ent'$1'</action>
</button>'
}

MAIN_DIALOG='
<window title="Fileselect Advanced" resizable="false" width-request="500">
<vbox>
<vbox border-width="20" spacing="10">
<hbox>
<text label="folder" width-request="80"></text>
<entry fs-title="Select an existing folder" fs-action="folder">
<variable>ent3</variable>
</entry>
'"`funcbtnCreate 3 open`"'
</hbox>
</vbox>
<hseparator></hseparator>
<hbox homogeneous="true">
<button ok></button>
</hbox>
</vbox>
</window>
'

export MAIN_DIALOG

case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1366
Location: Japan

PostPosted: Sun 28 Jun 2015, 00:31    Post subject:  

The easiest way is to remove the trailing case statement.
You don't have to assign the directory choice to a variable because it is already assigned (to variable ent3):
Code:
.
.
.
export MAIN_DIALOG

eval $($GTKDIALOG --program=MAIN_DIALOG)
cd "$ent3"
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
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.0524s ][ Queries: 11 (0.0041s) ][ GZIP on ]