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 01 Oct 2014, 10:30
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
What language is Lobster's welcome script and how to do that
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
RayTomes


Joined: 26 Oct 2005
Posts: 28
Location: Auckland, New Zealand

PostPosted: Tue 01 Nov 2005, 19:00    Post_subject:  What language is Lobster's welcome script and how to do that  

Greetings, I got the little welcome script (is that the right name for it?) by Lobster so that I could learn about how this sort of menu making and stuff is done. It is a nice example - thanks Lobster - and I can easily follow what it does. I quote some of it below. I went to make a similar menu myself and the first problem was when I tried to use my new script it just came up as text and didn't get executed. So I saw that the info for welcome said it was:
Type: special/executable
Run action: Execute file
But I couldn't work out how to set these as I didn't know what to put in with "set run action". Help! What is the right thing to put in "run action"?

Anyway I got around this by copying Lobster's welcome and altering it and making my own menu. It worked. Next problem to work out what the "language" is so that I could read more about how to write it and do other fancy stuff.

It starts with "#!/bin/sh" so I went there and it seemed to be saying that busybox would be run so I looked at busybox but it isn't that. So I looked at ash because puppy says it uses that - no not ash either. Doh!

What is this "language"?
Is there help on it in puppy?
If not where do I get the help?
Thanks, Ray

Quote:

#!/bin/sh

# Lobster August 2005 Puppy Welcome version 0.0.8
# License Public Domain

export WelcomePuppy="

<vbox>

<hbox>
<text>
<label>Welcome</label>
</text>
<button>
<input file>/usr/local/lib/X11/mini-icons/mini-happy.xpm</input>
<action>wish /root/my-applications/welcome/Welcome-to-Puppy-6.tcl &</action>
</button>
</hbox>

... more buttons omitted ...

<hbox>
<button cancel></button>
</hbox>

</vbox>

"
gtkdialog --program WelcomePuppy

unset WelcomePuppy

_________________
Ray Tomes
http://ray.tomes.biz/
Back to top
View user's profile Send_private_message 
Rich

Joined: 04 May 2005
Posts: 278
Location: Middlesbrough - UK

PostPosted: Tue 01 Nov 2005, 20:09    Post_subject:  

From the looks of line 12.....it's a tcl code.
Click on Help in the start menu and look for tcl/tk.
There's a code editor in the Word Processing menu and loads of web resources

_________________
>> Puppy 1.0.4 Moz - LiveCD <<
Back to top
View user's profile Send_private_message 
RayTomes


Joined: 26 Oct 2005
Posts: 28
Location: Auckland, New Zealand

PostPosted: Tue 01 Nov 2005, 20:21    Post_subject:  

Rich wrote:
From the looks of line 12.....it's a tcl code.
Click on Help in the start menu and look for tcl/tk.
There's a code editor in the Word Processing menu and loads of web resources


Help does not seem to show anything on tcl/tk.

I can find nothing in pupget.

In dotpup it has applications for tcl/tk, but not tcl/tk so that presumably means it is already installed. But the help - where is it? I have tried help, info, man etc with tcl, tk, tcl/tk without success.

Ray

_________________
Ray Tomes
http://ray.tomes.biz/
Back to top
View user's profile Send_private_message 
GuestToo
Puppy Master

Joined: 04 May 2005
Posts: 4078

PostPosted: Tue 01 Nov 2005, 21:03    Post_subject:  

it is not tcl ... it is a shell script that uses the gtkdialog program to make the user interface window

the first place to look for documentation would be in
Puppy's Help: HOWTO write programs for Puppy

(Puppy has a desktop shortcut for Help, or you can click Help in the menu)
Back to top
View user's profile Send_private_message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Tue 01 Nov 2005, 21:06    Post_subject:  

It uses the "sh" shell-script -language.
To display the grafical part, it uses Gtkdialog, an Addon.

As shellscripts can be somewhat complicated, I adapted a Basic-dialect for Puppy:
http://www.murga.org/%7Epuppy/viewtopic.php?t=2457
That message has a link to the documentation.

It allows you to build tools like Lobsters Welcomedialog.
Search the Forum for "puppybasic" to find more example-applications.

Mark
Back to top
View user's profile Send_private_message Visit_website 
RayTomes


Joined: 26 Oct 2005
Posts: 28
Location: Auckland, New Zealand

PostPosted: Tue 01 Nov 2005, 22:05    Post_subject:  

GuestToo wrote:
it is not tcl ... it is a shell script that uses the gtkdialog program to make the user interface window

the first place to look for documentation would be in
Puppy's Help: HOWTO write programs for Puppy

(Puppy has a desktop shortcut for Help, or you can click Help in the menu)


Thank you GuestToo. The right answers!
Yes, it is gtkdialog. And there are docs from HOWTO write programs.
The others were just guessing. Razz

Ray

_________________
Ray Tomes
http://ray.tomes.biz/
Back to top
View user's profile Send_private_message 
Guest
Guest


PostPosted: Tue 01 Nov 2005, 22:07    Post_subject:  

Have you tried making it executable either in rox or using chmod.
Back to top
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Tue 01 Nov 2005, 22:48    Post_subject: rute guide  

check out the (HTML and PDF versions - you can even order a printed version)
scripting section of this great Linux book
http://rute.2038bug.com/index.html.gz

It is script calling a widget (mini prog with parameters)

for example wish activates the tcl (tool kit command language) which is a kind of very powerful macro language

this is the name of the tcl program

Code:

/root/my-applications/welcome/Welcome-to-Puppy-6.tcl


and the "&" is a carriage return (activating the command)

The tcl code was created with visual-tcl (just download and install - it is written in tcl I seem to remember - that means it is a piece of script which Puppy can run . . .

- I did practically no coding
Be nice to Ian (Foundation Treasurer - as if we had any funds . . .) and he may help you with tcl . . .

Code:
<input file>/usr/local/lib/X11/mini-icons/mini-happy.xpm</input>
<action>wish /root/my-applications/welcome/Welcome-to-Puppy-6.tcl &</action>


There is also PuppyBasic (built into Puppy) which calls the widget - but this needs some beginner tutorial work . . . there is something on the wiki that I gibbered a bit about - but is mixed up with the full version of wxbasic . . .

PS. as you are a Buddhist here is some Dharma (of sorts)
http://peace.wikicities.com/wiki/Empowerments

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
isntfunny


Joined: 26 Oct 2005
Posts: 57
Location: London, UK

PostPosted: Thu 03 Nov 2005, 22:44    Post_subject:  

Thanks Lobster for the tip. This is what I wanted to easily start coding for Linux!
_________________
Don't miss the train, go Puppy now
Back to top
View user's profile Send_private_message YIM MSNM 
ICQ 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Thu 03 Nov 2005, 23:32    Post_subject: wicked-cool-shell-scripts  

G2 is our "scriptician" this might be of interest . . .
http://www.intuitive.com/wicked/wicked-cool-shell-script-library.shtml

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
isntfunny


Joined: 26 Oct 2005
Posts: 57
Location: London, UK

PostPosted: Fri 04 Nov 2005, 07:26    Post_subject:  

Yes, it is, thank you Lobster.
I think my first proyect will be a automated internet hoover, so I don't have to download all the scripts manually. Very Happy

_________________
Don't miss the train, go Puppy now
Back to top
View user's profile Send_private_message YIM MSNM 
ICQ 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Fri 04 Nov 2005, 12:07    Post_subject: Simple script example  

well using one of the scripts here (random)
http://www.intuitive.com/wicked/wicked-cool-shell-script-library.shtml

Code:
#!/bin/sh

# randomquote - given a one-line-per-entry datafile, this
#   script will randomly pick one and display it. Best used
#   as an SSI call within a Web page.

awkscript="/tmp/randomquote.awk.$$"

if [ $# -ne 1 ] ; then
  echo "Usage: randomquote datafilename" >&2
  exit 1
elif [ ! -r "$1" ] ; then
  echo "Error: quote file $1 is missing or not readable" >&2
  exit 1
fi

trap "/bin/rm -f $awkscript" 0

cat << "EOF" > $awkscript
BEGIN { srand(); }
      { s[NR] = $0 }
END   { print s[randint(NR)] }
function randint(n) { return int (n * rand() ) + 1 }
EOF

awk -f $awkscript < "$1"

exit 0


and naming it quote and setting the permissions (with ROX) to an executible
I am all set to go.
I need one other file

this text file called random.txt

Code:
Puppy is smaller than Red Hat and faster
Puppy is more secure than Windows XP and better designed
Puppy is Linux gone Frisky
Puppy is friendly to ex-XP users and jumps over Gates
Puppy is Free as in Free to enjoy and have fun
Puppy puts the woosh in Tux
I came, I saw, it was a Puppy - ahhh . . .
Puppy runs when others crawl
The Puppy Forum answers more questions with "woof woof" than any other
The Puppy wiki contains more documentation and more information
Smaller, simpler, faster - just works - just Puppy
Paws up for Puppy treats . . .
Kind people like Puppy. Puppy is good to them.


Now I save both those files in a directory
and open rxvt (console)

Now if I type ./quote random.txt

the quote program calls a random line from random.txt

- so that is my simple hack (and just about the extent of my scripting skills)
BUT how do I run this program from a desktop icon
- should be easy but I was baffled . . .

Who has the answer?

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Fri 04 Nov 2005, 12:22    Post_subject:  

The problem is, you can not run rxvt executing commands in Puppy, it just disappears.

Create a desktop-entry
rxvt -e ls
to see what I mean.

Workaround:
the mrxvt -dotpup supports:
mrxvt -hold -e ls

But it crashes on X.org.

So I use xterm for that: http://noforum.de/dotpups/tierra/xterm.pup (313 kb)
xterm -hold -e ls


If it works, you may replace "ls" with your command:
xterm -hold -e "/where_your_script_is/quote /where_your_script_is/random.txt"

You must use absolute Pathnames for this.


If you don't want to mess around with xterms, you could use a small gui like I made it for "dict" http://www.murga.org/%7Epuppy/viewtopic.php?t=3222

The GUI just consists of quite short puppybasic-code.
Have a look at it. I you get stuck, I'll help you.

Mark
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0819s ][ Queries: 11 (0.0034s) ][ GZIP on ]