Results 1 to 8 of 8
can you do this with a script?
for example i want to put a warning/confirmation dialog first for a certain button/menu item on the panel, or some link/shortcut on the ...
- 01-01-2004 #1Linux User
- Join Date
- Aug 2003
- Posts
- 289
capturing which buttons/menu items are clicked
can you do this with a script?
for example i want to put a warning/confirmation dialog first for a certain button/menu item on the panel, or some link/shortcut on the desktop, before it proceeds with its action. i already got the dialogs done - kdialog and/or gdialog, i've read the basics, i've done the if-else control statements - but how to figure out the buttons pressed so the right script can be supplied. i'm not talking about the buttons yes, no, or cancel on the dialog here. i'm talking about capturing a button/item clicked outside my script.Registered User #345074
- 01-01-2004 #2Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
Canīt you just reference your button to your program instead that first is capturing the click and then starting the actual program...for example xterm...
Code:#!/bin/sh USER=`id -nu` echo "User:$USER is starting xterm" >> /var/log/who_start_xterm.log # Starting the actual program xterm
Regards
Andutt
- 01-04-2004 #3Linux User
- Join Date
- Aug 2003
- Posts
- 289
well, i could do that but i don't want redundancy. i mean, i may have like 5 buttons or links where the user has to confirm to proceed with a certain action, i got one script that controls all other scripts, and it should know which of these 5 buttons was clicked or something like that.. . wouldn't it be more dynamic that way?
Registered User #345074
- 01-04-2004 #4Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
Yes thats a lot more dynamic...IF you like you can do a program with a case statement. THen just execute that with the argument you want. Then you just have do modify one program...like this..
Then just program the xmms button like...runprogram <thisprogram> -xmmsCode:#!/bin/sh USER=`id -nu` case $1 in -xmms) echo "Starting xmms as user:$USER" >> /var/log/who_clicked.log #Starting xmms.. xmms ;; -xclock) echo "Starting xclock as user:$USER" >> /var/log/who_clicked.log #Starting xclock... xclock ;; *) echo echo "Invalid input,Usage:" echo echo "$0 -xmms :starts xmms player" echo "$0 -xclock :starts xclock" ;; esac
Regards
Andutt
- 01-04-2004 #5Linux User
- Join Date
- Aug 2003
- Posts
- 289
hmmm... nice, i think i get your point. more like arguments or options... kewl! thanks andutt, i'll definitely try this out!
i was thinking of something like a listener for an event, catches the event it's supposed to listen to, and then do some stuff.. . didn't know how to do this.. .Registered User #345074
- 01-04-2004 #6Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
Ok...to build listeners we have to leave the shellprogramming and look at Perl but its duable if you feel like jumping in and learn perlprogramming instead.
Regards
Andutt
- 01-05-2004 #7Linux User
- Join Date
- Aug 2003
- Posts
- 289
no thank you.
i mean not for now. i would like to though, but i wanna familiarize myself first with linux scripts. i've got much to do in school already - everything on the basics of network systems, PHP, javascripts, and SQL... phooeeyyy... blah3x - i don't want another load on my back, i still have to have time for gimmicks and booze! hahaha...
Registered User #345074
- 01-05-2004 #8Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
Hehe looks like a wise call....
for now..
Regards
Andutt


Reply With Quote