Your First Program

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Your First Program

#1 Post by Lobster »

UPDATE: Go to the third post in this thread for an easier example

Image
YAP is designed to be altered so you can support your interest
I will take you through the steps required to change it for your needs
If you are a complete noob, try the LIT program (3rd post in this thread)
which has no sub-directories and is even simpler to follow . . .
Look at the code and see if it makes sense.
code is separated by <beginning> and <end beginning blocks>
eg. <action> </action>
YAP will enable you to have a program with sound and flash files
and info (help) all with pull down menus . . .
It really is easy . . .
LIT is even simpler and allows you to customise each puppy and puplet

You can download YAP here
http://tmxxine.com/wik/wikka.php?wakka=YapInfo
and the complete code is in the YAP file which you can edit
by right clicking on it and selecting 'open as text'


1. Everything after a # is a comment - so we will leave that
2. We are going to change a menu item (in this case a wav file
in the directory sound - the file is called cyberspace_1.wav
In the menu we can change Cyberspace Blessing 1
to my_rant.wav (that is your wav file which you put in the sound directory which the package comes with)

Code: Select all

         <menuitem>
             <label>Cyberspace Blessing 1</label>
              <action>wavplay sound/cyberspace_1.wav &</action>
         </menuitem>
3. You can do the same with all the wav files, add news or have fewer
(I used wav because it is most reliable over the max number of Puppy versions)

Now we are going to look at changing a swf (flashfile) in the second menu
This is the code:

Code: Select all

     <menuitem>
            <action>defaultbrowser file://`pwd`/videos/mudra.swf &</action>
            <label>Mudra meditation</label>
            <action>exit</action>
         </menuitem>
1. We can easily change the label from

Code: Select all

       <label>Mudra meditation</label>
to

Code: Select all

 <label>My flash file</label>
2. the mudra.swf can be changed to your file myfile.swf
from

Code: Select all

<action>defaultbrowser file://`pwd`/videos/mudra.swf &</action>
to

Code: Select all

<action>defaultbrowser file://`pwd`/videos/myfile.swf &</action>
3. Your myfile.swf file is placed in the videos subdirectory

this will get you off to a good start . . .

==========

Code: Select all

#! /bin/bash
# YinYana Alter Program GPL v3 License
# YAP v 1.8 March 21 008
# created by Lobster for Tmxxine Vision and Sentient Beings Everywhere 
# With thanks to Barry Kauler, Team Puppy, Mark Ulrich, mcewanw, Warren
###################

export Vision='
<window title="YAP" window-position="1">
<vbox>
  <menubar>
    <menu>
        <menuitem>
             <label>Cyberspace Blessing 1</label>
               <action>wavplay sound/cyberspace_1.wav &</action>
         </menuitem>
          <menuitem>
             <label>Cyberspace Blessing 2</label>
               <action>wavplay sound/cyberspace_2.wav &</action>
         </menuitem>
         <menuitem>
             <label>Bell</label>
               <action>wavplay sound/tinsha.wav &</action>
         </menuitem>
         <menuitem>
              <label>Gong Burmese</label>
                 <action>wavplay sound/gong-burmese.wav &</action>
         </menuitem>
         <menuitem>
               <label>Gong Chinese</label>
                   <action>wavplay sound/gong-chinese.wav &</action>
         </menuitem>    
          <menuitem stock="gtk-quit">
                <action>echo You selected the quit menu item</action>
                <action type="exit">exit by menu</action>
          </menuitem>
              <label>Sounds</label>
          </menu>       
      <menu>
         <menuitem>
            <action>`Xdialog --wrap --screencenter --left --title "5 Element Meditation" --msgbox "This will start a simple twenty five minute elemental meditation suitable for universal usage. It is a simple technique. Only regular use will develop mind skills. Used for centuries as an esoteric warrior meditation, it is particulary suited to balance energies and focus and harmonise ones internal component elements. Keep your back straight and your mind attentive. \n\n OM YA HA HUM" 600x0`</action>
            <action>defaultbrowser file://`pwd`/videos/elements.swf &</action>
            <label>Elemental meditation</label>
            <action>exit</action>
         </menuitem>
           <menuitem>
            <action>defaultbrowser file://`pwd`/videos/mudra.swf &</action>
            <label>Mudra meditation</label>
            <action>exit</action>
         </menuitem>
         <menuitem>
               <label>Vajrasattva</label>
                <action>`Xdialog --wrap --screencenter --left --title "Vajra" --msgbox "Vajrasattva. vajrasattva samayam anup
Last edited by Lobster on Sun 30 Mar 2008, 07:53, edited 4 times in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Aitch
Posts: 6518
Joined: Wed 04 Apr 2007, 15:57
Location: Chatham, Kent, UK

#2 Post by Aitch »

Hey Lobster

nice idea, but from a noobie perspective, though I didn't try
that is your wav file which you put in the sound directory
was where you lost me

I don't know where the directories you are talking about, are

bit more basic info, perhaps?

other than that, noble effort

Aitch :)

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

#3 Post by Lobster »

Hi Aitch,

Look at the below code and see if that makes more sense
(no subdirectories) :)
  • Right click with Rox
    Create a new script and replace with the enclosed code
    Click on the file to run
Image
Transmogrified the program to change the usage . . .
"LIT" is basically an installer of popular packages for the Pupeee puplet
http://www.murga-linux.com/puppy/viewto ... 844#185844

Lit should also work with Lassie and Dingo with minor mods
which are easy to do :)

Code: Select all

#! /bin/bash
# Light Installer Tmxxine GPL v3 License
# LIT v 0.3 March 28 008
# created by Lobster
###################

export LIT='
<window title="Light Installer" window-position="1">
<vbox>
 <menubar> 
  <menu>
    <menuitem>
       <label>Welcome Wizard</label>
       <action>sh welcome &</action>
    </menuitem>
    <menuitem>
       <label>Standard Wizards</label>
       <action>wizardwizard &</action>
    </menuitem>
    <label>Wizards</label>
   </menu>   
   <menu>
         <menuitem>
           <action>defaultbrowser http://tmxxine.com/wik/wikka.php?wakka=Wine &</action>
           <label>Wine</label>
           <action>exit</action>
         </menuitem>
         <menuitem>
           <action>defaultbrowser http://tmxxine.com/wik/wikka.php?wakka=EZpup &</action>
           <label>Ezpup</label>
           <action>exit</action>
         </menuitem>
         <menuitem>
           <action>defaultbrowser http://puppylinux.org/wikka/Compiling &</action>
           <label>Developer Module</label>
           <action>exit</action>
        </menuitem>
        <menuitem>
     <action>defaultbrowser http://tmxxine.com/wik/wikka.php?wakka=OpenOffice &</action>
     <label>OpenOffice Suite</label>
     <action>exit</action>
         </menuitem>
         <menuitem>
          <label>Kompozer HTML composition</label>
          <action>defaultbrowser http://tmxxine.com/wik/wikka.php?wakka=Kompozer &</action>
          <action>exit</action>
        </menuitem>        
        <menuitem>
         <action>defaultbrowser http://tmxxine.com/wik/wikka.php?wakka=GimpShop &</action> 
         <label>Gimpshop graphics editor</label>
        </menuitem>
        <menuitem>
            <label>Xara LX vector editor</label>
             <action>defaultbrowser http://puppylinux.org/wikka/XaraLX &</action>          
         </menuitem>   
         <menuitem>
           <action>defaultbrowser http://tmxxine.com/wik/wikka.php?wakka=YapInfo &</action>
           <label>YAP Buddhist Practice</label>
           <action>exit</action>
         </menuitem>    
      <label>Add Programs</label>
    </menu>
    <menu> 
        <menuitem>
           <label>Glint Online Programs</label>
           <action>defaultbrowser file://`pwd`/online.html &</action>
         </menuitem>
         <menuitem>
 <label>Tmxxine Light Wiki</label>
 <action>defaultbrowser http://tmxxine.com/wik/wikka.php?wakka=LinuxTmxxineLight &</action>
         </menuitem>
         <menuitem>
           <label>Puppy Forum</label>
           <action>defaultbrowser http://www.murga-linux.com/puppy/ &</action>
         </menuitem>
         <menuitem>
           <label>Puppy In-built help</label>
             <action>defaulthtmlviewer file:///usr/share/doc/index.html &</action>
         </menuitem>
     <label>Help</label>
   </menu>   
 </menubar>
  <frame>
       <pixmap>
         <input file>/root/puppy-reference/images/linuz.gif</input>
       </pixmap>
       <text><label>LIT ~ Light Installer Tmxxine</label></text>
       <text><label>March 28 2008</label></text>
   </frame>
   <hbox>
        <button cancel></button>
  </hbox>
</vbox>
 </window>'

gtkdialog3 --program LIT 
unset LIT
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

Post Reply