What language is Lobster's welcome script and how to do that

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
RayTomes
Posts: 28
Joined: Thu 27 Oct 2005, 00:01
Location: Auckland, New Zealand

What language is Lobster's welcome script and how to do that

#1 Post by RayTomes »

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
#!/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/

Rich
Posts: 278
Joined: Wed 04 May 2005, 19:00
Location: Middlesbrough - UK

#2 Post by Rich »

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 <<

User avatar
RayTomes
Posts: 28
Joined: Thu 27 Oct 2005, 00:01
Location: Auckland, New Zealand

#3 Post by RayTomes »

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/

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post by GuestToo »

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)

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

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

User avatar
RayTomes
Posts: 28
Joined: Thu 27 Oct 2005, 00:01
Location: Auckland, New Zealand

#6 Post by RayTomes »

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. :P

Ray
Ray Tomes
http://ray.tomes.biz/

Guest

#7 Post by Guest »

Have you tried making it executable either in rox or using chmod.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

rute guide

#8 Post by Lobster »

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: Select all

/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: Select all

<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 Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
isntfunny
Posts: 57
Joined: Wed 26 Oct 2005, 05:06
Location: London, UK
Contact:

#9 Post by isntfunny »

Thanks Lobster for the tip. This is what I wanted to easily start coding for Linux!
Don't miss the train, go Puppy now

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

wicked-cool-shell-scripts

#10 Post by Lobster »

G2 is our "scriptician" this might be of interest . . .
http://www.intuitive.com/wicked/wicked- ... rary.shtml
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
isntfunny
Posts: 57
Joined: Wed 26 Oct 2005, 05:06
Location: London, UK
Contact:

#11 Post by isntfunny »

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. :D
Don't miss the train, go Puppy now

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Simple script example

#12 Post by Lobster »

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

Code: Select all

#!/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: Select all

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 Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#13 Post by MU »

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

Post Reply