Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 17 Sep 2014, 09:44
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GTKdialog variable tests
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Wed 21 Oct 2009, 23:39    Post subject:  GTKdialog variable tests
Subject description: Testing more than one variable in one instance. SOLVED
 

How would one check to see if two variables were true before calling a function?
I know how to check one with
Code:

If [ $CBOX3 = "true" ] ;then #Checkbox checked for USB
if [ $CBOX4 = "true" ] ;then #If Checkbox for internal drive is checked
if [ $CBOX1 = "true" ] ;then #Checkbox checked for format
run function
fi
fi
else
display message
fi


Also, $CBOX3 and $CBOX4 cannot both be true.
So how do I implement and or on them
Opps! that was three. But can I shorten that.
But can I combine them with an and to signify both need to be true?
Suggestions welcome.

I am on the final lap of creating one program that will format both internal and USB floppy disks.

Last edited by 8-bit on Thu 22 Oct 2009, 03:30; edited 1 time in total
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Thu 22 Oct 2009, 02:13    Post subject:  

Please teach yourself to indent your code for better readability.

Code:
If [ $CBOX3 = "true" ] && [ $CBOX4 = "true" ] ;then 
   if [ $CBOX1 = "true" ] ;then
      run function
   fi
else
   display message
fi


Or:
Code:

If [ $CBOX3 = "true" -a $CBOX4 = "true" ] ;then 
   if [ $CBOX1 = "true" ] ;then
      run function
   fi
else
   display message
fi
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Thu 22 Oct 2009, 03:29    Post subject:
Subject description: SOLVED
 

As Gomer Pyle said,
Thank you.
Thank you.
Thank you.

That bit of information helped in finalizing the program other than going back through and indenting.
As you might of gathered, I am a hit and miss programmer.
I try something and keep changing it until it works.

But the final result is a program that will format both internal floppy disks and external USB floppy disks.

It might even be good enough for inclusion in a new Puppy release.

I had previously uploaded 2 versions just for USB drives.
This one goes beyond that.

Thanks again! Smile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0578s ][ Queries: 12 (0.0179s) ][ GZIP on ]