My first scriptForum: Programming and Scripting Topic: My first script started by: newby Posted by newby on July 19 2006,04:04
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:GIVEN:
QUESTION: Would the command to put in a script be?
GIVEN:
QUESTION: Would the command to set a light-brown background color be?
THIRD EXAMPLE: The following appears to be the script for the "Minimal" style.
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? .lua . sh QUESTION: Does it matter where I put it? Could I run it from a floppy, for example? Have I missed anything? Posted by Zucca on July 19 2006,10:18
Damn with those happy-faces... Please paste that code inside CODE-tags.
Posted by newby on July 19 2006,14:59
OK, figured one more thing out in DSL. How about my questions? Posted by crusadingknight on July 19 2006,15:13
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 Posted by mikshaw on July 19 2006,15:30
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. Posted by mikshaw on July 19 2006,16:50
By the way, I believe if it were to output a proper 6-character html color, the format should be
As it is now, an R, G, or B value of 0 is converted to a hex value of 0 instead of 00 Posted by newby on July 20 2006,10:25
So, I'll have a .lua file with the contents:
How do I call it? Just click on it from emelFM? Posted by mikshaw on July 20 2006,13:34
No, to everything.You didn't read my carefully-and-slowly-typed response, which explain at least the first two things I see wrong with your .lua file. As far as how you call it....it depends on how the file was written and whether or not it's executeable. You really should read a little bit about the process of scripting. This applies to bash, but it's the same concept: < http://www.linuxcommand.org/wss0010.php > Posted by newby on July 20 2006,18:55
Sorry, too many answers from too many different people. I'm getting confused as a result. No offense intended. Thanks for the URL. Posted by mikshaw on July 21 2006,02:36
no offense taken. As usual, my response was lighthearted, although i probably should use more smilies.I hope you find scripting to be a pleasure. It is a constant learning experience and a joy to make something useful to yourself and others, although it can also be frustrating at times. Fortunately the positive greatly outweighs the negative. |