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 Mon 22 Sep 2014, 00:17
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Your First Program
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
Lobster
Official Crustacean


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

PostPosted: Wed 26 Mar 2008, 06:19    Post_subject:  Your First Program
Sub_title: Modifying an existing program ("hacking")
 

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


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:
         <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:
     <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:
       <label>Mudra meditation</label>
to
Code:
 <label>My flash file</label>


2. the mudra.swf can be changed to your file myfile.swf
from
Code:
<action>defaultbrowser file://`pwd`/videos/mudra.swf &</action>

to
Code:
<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:
#! /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ālaya \n om Vajrasattva! Preserve the bond! \n\n Vajrasattvatvenopati ha \n As Vajrasattva stand before me. \n\n dridho me bhava \n Be firm for me. \n\n sutoshyo me bhava \n Be greatly pleased for me. \n\n suposhyo me bhava \n Deeply nourish me \n\n anurakto me bhava \n Love me passionately \n\n sarva siddhi ma me prayaccha \n Grant me siddhi in all things, \n\n sarvakarmasu ca me citta śreya kuru hūm \n And in all actions make my mind most excellent. hūm \n\n ha ha ha ha ho \n ha ha ha ha ho \n\n bhagavan sarvatathāgatavajra mā me muñka \n Blessed One! Vajra of all the tathāgatas! Do not abandon me. \n\n vajrī bhava mahāsamayasattva āh (hūm phat) \n Be the Vajra-bearer, Being of the Great Bond! āh (hūm phat)" 600x0`</action>
            <action>defaultbrowser file://`pwd`/videos/vajra.swf &</action>
               <action>exit</action>
         </menuitem>       
         <menuitem>
                <action>defaultbrowser file://`pwd`/html/chant.html &</action>
                <action>defaultbrowser file://`pwd`/sound/tarafast.swf &</action>
            <label>21 Tara Praise Scroller</label>
         </menuitem>
         <menuitem>
            <label>Tara Mantra of Joy</label>
               <action>defaultbrowser file://`pwd`/videos/taraom.swf &</action>         
         </menuitem>   
         <menuitem>
                 <label>Shingon Chant</label>
                      <action>flite "Welcome to Shingon"</action>
                     <action>`Xdialog --wrap --screencenter --left --title "Shingon Chant" --msgbox "Shingon. Keep your back straight and your mind attentive. \n\n OM YA HA HUM" 600x0`</action>
                      <action>defaultbrowser file://`pwd`/videos/shingon.swf &</action>
                      <action>exit</action>
              </menuitem> 
         <label>Programs</label>
    </menu>
    <menu>
        <menuitem>
           <label>Basic Buddhism</label>
              <action>defaultbrowser file://`pwd`/html/basics.html &</action>
        </menuitem>
        <menuitem>
           <label>Shrine Building</label>
               <action>defaultbrowser file://`pwd`/html/shrine1.html &</action>
        </menuitem>
            <menuitem>
            <label>Meditation</label>
              <action>`Xdialog --wrap --screencenter --left --title "Meditation" --msgbox "Info on Meditation practice. Requires internet connection to view. Keep your mind attentive. \n\n OM YA HA HUM" 600x0`</action>
              <action>defaultbrowser http://buddhism.kalachakranet.org/meditation_practice.html &</action>
        </menuitem> 
        <menuitem>
                    <action>`Xdialog --wrap --screencenter --left --title "Meditation" --msgbox "Info on Meditation practice. Requires internet connection to view. Keep your mind attentive. \n\n OM YA HA HUM" 600x0`</action>
            <label>On Meditation</label>
              <action>defaultbrowser http://www.youtube.com/watch?v=F3g4cNJgVwo &</action>
                 <action>exit</action>
        </menuitem>   
        <menuitem>
           <label>FAQS</label>
               <action>defaultbrowser file://`pwd`/html/faqs.html &</action>
         </menuitem>
                    <label>Help</label>
   </menu>   
  </menubar>
  <frame>
       <pixmap>
         <input file>videos/animrainbow.gif</input>
       </pixmap>
       <text><label>YinYana Alter Practice</label></text>
       <text><label>March 21 2008</label></text>
   </frame>
   <hbox>
        <button cancel></button>
  </hbox>
</vbox>
 </window>'

gtkdialog3 --program Vision
unset Vision

_________________
Puppy WIKI

Edited_times_total
Back to top
View user's profile Send_private_message Visit_website 
Aitch


Joined: 04 Apr 2007
Posts: 6825
Location: Chatham, Kent, UK

PostPosted: Wed 26 Mar 2008, 15:26    Post_subject:  

Hey Lobster

nice idea, but from a noobie perspective, though I didn't try

Quote:
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 Smile
Back to top
View user's profile Send_private_message 
Lobster
Official Crustacean


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

PostPosted: Fri 28 Mar 2008, 15:07    Post_subject:  

Hi Aitch,

Look at the below code and see if that makes more sense
(no subdirectories) Smile

    Right click with Rox
    Create a new script and replace with the enclosed code
    Click on the file to run



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/viewtopic.php?p=185844#185844

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

Code:
#! /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 WIKI
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 » HOWTO ( Solutions )
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.1124s ][ Queries: 12 (0.0140s) ][ GZIP on ]