Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: My first script, ... how do I translate this stuff ...< Next Oldest | Next Newest >
newby Offline

Group: Members
Posts: 171
Joined: June 2006
Posted: July 19 2006,04:04 QUOTE

I'm trying to figure out how to automate my setup with a script.  So far, I've been poking around to find the code associated with the buttons and menu items I click on.  For example:


Code Sample

# Button for 800x600x16 (ie. 16 bit color)

if strfind(data,"800x600x16") then
  b3 = Button{10,10+40*(i-1),130,30, "800x600x16"}
  i = i + 1
  function b3:callback()
     updateXserverrc(" 800x600x16")

QUESTION:  Would the command to put in a script be?

Code Sample
updateXserverrc(" 800x600x16")


Code Sample

# Color Selection

colorBtn = Button{190,window_height-35,50,25,"Color"}
function colorBtn.callback()
  ok,r,g,b = fl_color_chooser(nil,51,102,153)
  if ok then
     color_selected = format("%X%X%X",r,g,b)
     command = 'xsri --color=#'..color_selected

QUESTION:  Would the command to set a light-brown background color be?

Code Sample
xsri --color='99,66,60'

THIRD EXAMPLE:  The following appears to be the script for the "Minimal" style.

Code Sample
#   Minimal style

! Minimal © 2000 Jeff Raven
! Blackbox window manager resource defaults, with an
! eye towards consuming as little of an 8-bit palette
! as possible. As an additional bonus, with the changes
! as of Blackbox 0.60.3, it should also use very little
! memory.

toolbar:                        Flat Solid
toolbar.color:                  MidnightBlue

toolbar.clock:                  ParentRelative
toolbar.label:                  ParentRelative
toolbar.windowLabel:            ParentRelative

toolbar.button:                 ParentRelative
toolbar.button.pressed:         Flat Solid
toolbar.button.pressed.color:   SteelBlue
toolbar.button*picColor:        White

toolbar.textColor:              White
toolbar.justify:                center

window.title.focus:             Flat Solid
window.title.focus.color:       SteelBlue
window.title.unfocus:           Flat Solid
window.title.unfocus.color:     MidnightBlue

window.label.focus:             ParentRelative
window.label.focus.textColor:   White
window.label.unfocus:           ParentRelative
window.label.unfocus.textColor: Grey

window.button.focus:            ParentRelative
window.button.focus.picColor:   White
window.button.unfocus:          ParentRelative
window.button.unfocus.picColor: Grey
window.button.pressed:          ParentRelative

window.handle.focus:            Flat Solid
window.handle.focus.color:      SteelBlue
window.handle.unfocus:          Flat Solid
window.handle.unfocus.color:    MidnightBlue

window.grip.focus:              Flat Solid
window.grip.unfocus:            Flat Solid
window.grip*color:              Grey

window.frame.focusColor:        SteelBlue
window.frame.unfocusColor:      MidnightBlue

window.justify:                 center

menu.title:                     Flat Solid
menu.frame:                     Flat Solid
menu.hilite:                    Flat Solid

menu.title.color:               Black
menu.title.textColor:           White
menu.title.justify:             center

menu.frame.color:               MidnightBlue
menu.frame.textColor:           White
menu.frame.justify:             left

menu.hilite.color:              White
menu.hilite.textColor:          Black

menu.bullet:                    Triangle
menu.bullet.position:           Right

borderColor:                    Black

bevelWidth:                     1
borderWidth:                    1
handleWidth:                    4

*Font:                          -*-helvetica-*-r-*-*-12-*-*-*-*-*-*-*

rootCommand:                    bsetroot -solid SlateGrey

QUESTION:  Should I put this at the beginning of my script?
QUESTION:  Followed by the color command?
QUESTION:  Followed by the screen resolution command?

QUESTION:  What file extention should my script have?  
                    . sh

QUESTION:  Does it matter where I put it?
                    Could I run it from a floppy, for example?

Have I missed anything?
Back to top
Profile PM 
Zucca Offline

Group: Members
Posts: 524
Joined: Feb. 2006
Posted: July 19 2006,10:18 QUOTE

Damn with those happy-faces... Please paste that code inside CODE-tags.

Do you have it? -
Back to top
newby Offline

Group: Members
Posts: 171
Joined: June 2006
Posted: July 19 2006,14:59 QUOTE

Quote (Zucca @ July 19 2006,06:18)
Damn with those happy-faces... Please paste that code inside CODE-tags.

OK, figured one more thing out in DSL.  

How about my questions?
Back to top
Profile PM 
crusadingknight Offline

Group: Members
Posts: 65
Joined: Nov. 2005
Posted: July 19 2006,15:13 QUOTE

For the first two, yes, those are the actions performed in the given segments (Though, you seem to have the format wrong for the second?). However, the third isn't a script - it's a style file for fluxbox.

The first action you have there would have to be run by lua, in with the function definition loaded (which may be local to the file you got it from?), and the second could be run either from lua as execute('xsri --color=#996660') or from bash as xsri --color=#996660

eTower 566.12, 32MB RAM, 7GB HD, 200MB swap, 1x USB v.1, Intel 810GFX, Intel 810 Audio.
Recompiled so far: Pretty much everything. I think I'll have to do a remaster to cut the growing bloat off my system.
Back to top
Profile PM WEB MSN 
mikshaw Offline

Group: Members
Posts: 4856
Joined: July 2004
Posted: July 19 2006,15:30 QUOTE

First, what type of script are you working on?  Bash? Lua? Perl? Other?

updateXserverrc() is a function inside /usr/sbin/xvesa.lua.  It will not be available outside of this script.  You will need to copy that fuction into your script if you're using Lua, or rewrite the function if you're using something else.

If "99,66,60" are hex values then it would be
xsri --color=#996660
If they are rgb values I don't know if they'd work with xsri.  The colorBtn formats the rgb values that lua fltk uses into a hex value that xsri uses.

Fluxbox styles are not scripts.  They are resource files, like .Xdefaults. If you want to have fluxbox always use a particular style, make sure .fluxbox/init has the appropriate one listed after "session.styleFile".

The filename extension doesn't really matter for anything other than letting you know what kind of script it is.

You can run a script from just abut anywhere, other than a partition that is mounted without executeable permission.  If these are all X-related actions, you could put commands into .xintrc to have it set up automatically.

Back to top
Profile PM WEB 
9 replies since July 19 2006,04:04 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: My first script

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code