Register
It is currently Fri Oct 31, 2014 7:45 pm

how to execute two commands from zenity-list


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Sun May 17, 2009 10:03 am   

Joined: Sun May 17, 2009 9:55 am
Posts: 2
hi
i would like to execute programs which i choose from a list-dialog with zenity
com=$( zenity --title=Blitzstart --height=400 --list --separator=" & exec " --checklist --column="1/0" --column=befehl --column=Programm "" "xmaple" "maple 12" "" "jdown" "JDownloader" "" "firefox" "Firefox" "" "rhythmbox" "Rhythmbox" "" "deluge" "Deluge" "" "pidgin" "Pidgin" "" "nauti" "Filemanager" "" "eclipse" "Eclipse" "" "checkgmail" "Gmail" "" "xchat" "Xchat" "" "skype" "Skype")&& exec $com

doesnt work, for example if i try to open firefox and pidgin firefox opens with urls: &.com and pidgin.com but pidgin doesnt start
please help me


Top
 Profile  
 PostPosted: Sun Jun 14, 2009 12:24 am   
User avatar

Joined: Sat Jun 13, 2009 8:53 pm
Posts: 73
Location: Texas!
By using eval and no exec's, the following works for me:
Code:
com=`zenity --title=Blitzstart --height=400 --list --separator=" & " --checklist --column="1/0" --column=befehl --column=Programm "" "xmaple" "maple 12" "" "jdown" "JDownloader" "" "firefox" "Firefox" "" "rhythmbox" "Rhythmbox" "" "deluge" "Deluge" "" "pidgin" "Pidgin" "" "nauti" "Filemanager" "" "eclipse" "Eclipse" "" "checkgmail" "Gmail" "" "xchat" "Xchat" "" "skype" "Skype"`
eval "$com"


Top
 Profile  
 PostPosted: Thu Aug 06, 2009 3:50 pm   

Joined: Thu Aug 06, 2009 3:46 pm
Posts: 1
That's great - how about if I would like to populate a checkbox or radiobox but I don't know how many items I have? example: scripts runs and finds items ( could be 4,5,...) and post those with zenity checkbox? Thanks


Top
 Profile  
 PostPosted: Thu Aug 13, 2009 11:05 pm   
User avatar

Joined: Sat Jun 13, 2009 8:53 pm
Posts: 73
Location: Texas!
Well, there are a few ways to do what you want. As an example, if you have a directory with links to the applications that you want, like ~/myapps, you could do it this way:
Code:
#!/bin/bash

com1='zenity --title=Blitzstart --height=400 --list --separator=" & " --checklist --column="1/0" --column=befehl --column=Programm'

for app in ~/myapps/*
do
    com2=" \"\" \"$app\" \"$app\""
    com1=$com1$com2
done

eval "$com1"

It's not the prettiest (full path names), but it works. You may want to do something else, but they key here is just concatenating whatever you want onto the command string.


Top
 Profile  
 PostPosted: Thu Aug 12, 2010 3:13 am   

Joined: Thu Aug 12, 2010 3:11 am
Posts: 1
Hi following script works nice for me...


#!/bin/bash

lsof -i > /root/.boss_secure_lsofi

com1='zenity --title="List of Opened Applications in the system" --height=500 --width=600 --list --separator=":" --text "Please select the following Applications for stoping in this system or\n Deselect to avail that service in this system" --checklist --column="Select" --column="Available Applications in this system"'

while read line
do

FIELD=`echo $line | awk '{ print $1 "\t" $2 "\t" $3 "\t" $8 }'`
com2=" \"\" \"$FIELD\" "
com1=$com1$com2

done < /root/.boss_secure_lsofi

eval "$com1"


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP