Author Topic: repair-database (My first zenity script)  (Read 8495 times)

Offline glamdring

  • Hero Member
  • *****
  • Posts: 552
Re: My first zenity script
« Reply #30 on: January 12, 2011, 11:19:40 PM »
I believe I know why now. I think its because its taking --auto-kill so long to kill the process. Any one know of a faster way to kill this process? If not i could try and make the window pop-up before the process is done being killed. But is that a wise thing to do?

EDIT:
Maybe if on clicking the cancel button it will go to another command that kills the process but displays a pulsate bar tell it is done. How can I determin what the name of the process is?
« Last Edit: January 12, 2011, 11:21:34 PM by glamdering »

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: My first zenity script
« Reply #31 on: January 13, 2011, 03:31:15 AM »
Try this --
Code: [Select]
if [ "$?" != "0" ]; then  # just quit
This is from ezswitch, line 105.

Offline glamdring

  • Hero Member
  • *****
  • Posts: 552
Re: My first zenity script
« Reply #32 on: January 13, 2011, 06:30:37 AM »
Still doesn't like it. The only thing I can think of is to remove the cancel button, but its probably not a good idea.

But on the other hand I think I found out whats wrong with stopping the process. A lot of people are complaining about --auto-kill not working right.

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: My first zenity script
« Reply #33 on: January 13, 2011, 06:37:17 AM »
No, the cancel button should be there for sure.

Hmm...... guess we need to look for a fix.


Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: My first zenity script
« Reply #34 on: January 13, 2011, 08:04:10 AM »
Kill by PID?

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3737
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: My first zenity script
« Reply #35 on: January 13, 2011, 09:25:00 AM »
if auto-kill, then the script dies immediately...
Use your script in a terminal, and see what is do by clicking on cancle  ;)


Offline glamdring

  • Hero Member
  • *****
  • Posts: 552
Re: My first zenity script
« Reply #36 on: January 13, 2011, 10:05:56 AM »
I do all the testing in terminal but I don't see the problem. Even removing the --auto-kill results in the slow delay to move to the next option.

Auto-kill dose indeed stop or at-least removes any changes it has made. But it takes just about the length it takes to normally complete the operation. Its almost like as if it doesn't actually kill the operation tell its over.

Any way adding new yad version of the script. I fined yad to be much better then zenity. To use the script make sure you have yad installed from synaptic.
(If you can fix the error on zenity it will most likely work on yad there very similar.)

Offline glamdring

  • Hero Member
  • *****
  • Posts: 552
Re: My first zenity/yad script
« Reply #37 on: January 13, 2011, 01:08:41 PM »
Dose any one know how to gather the information from a check box? For example:

Code: [Select]
yad --title="$TITLE" --form \
--field="check box 2:CHK" TRUE \
--field="Check box 1:CHK" TRUE \

or even a way to gather the information for a check list --list --checklist?

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: My first zenity/yad script
« Reply #38 on: January 13, 2011, 02:35:16 PM »
Have a look at lxcursor.

Offline glamdring

  • Hero Member
  • *****
  • Posts: 552
Re: My first zenity/yad script
« Reply #39 on: January 13, 2011, 07:51:16 PM »
Is there a way to have the script jump from one line to another and begin again from there if a criteria is met? For example if [ "$?" = "1" ] go to line 23 fi

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: My first zenity/yad script
« Reply #40 on: January 14, 2011, 12:24:03 AM »
 That would be an if then statement: if this then that.


Offline glamdring

  • Hero Member
  • *****
  • Posts: 552
Re: My first zenity/yad script
« Reply #41 on: January 14, 2011, 07:01:56 AM »
I i know/understand that but I mean what would be the command to jump from from one spot in the script to another.

For example:


if
the command to skip from line 21 to 110
fi
21: This part will create folder testing



110: This line will copy files into folder testing

Now I know thats not a great example but what if for some reason I want to jump to line 110 and skip everything in between.

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: My first zenity/yad script
« Reply #42 on: January 14, 2011, 08:39:48 AM »
You mean something like --
if [script == 1] then continue
if [script == 2] then go to line 110

The if then option is pretty flexible. Have you looked at the lusbc script?


Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: My first zenity/yad script
« Reply #43 on: January 14, 2011, 09:11:39 AM »
Here is an example of if then from lomanager (in development [by pinoc]) --
Code: [Select]
# check for kdesu or gksu and setup/or run XUGOO
#=================================================
if [ ! -e $XUGOO ];then
  if [ -r /usr/bin/gksu ]; then WMSUDO=/usr/bin/gksu; fi
  if [ -r /usr/lib/kde4/libexec/kdesu ]; then WMSUDO=/usr/lib/kde4/libexec/kdesu; fi
  # setup XUGOO
  echo "#"'!/bin/bash' > $XUGOO
  if [ "$UID" != "0" ]; then echo $WMSUDO lomanager >> $XUGOO; else echo lomanager >> $XUGOO; fi
  chmod a+x $XUGOO
  $XUGOO &
  exit 0
fi


Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: My first zenity/yad script
« Reply #44 on: January 14, 2011, 09:21:40 AM »
Look at the script in this thread. It has another example of using if then.

« Last Edit: January 14, 2011, 09:23:27 AM by Neal »