# if is then .....

**URL:** https://forum.highend3d.com/t/if-is-then/5665
**Category:** Maya
**Tags:** mel
**Created:** [November 26, 2002, 5:33pm UTC](https://forum.highend3d.com/t/if-is-then/5665 "2002-11-26T17:33:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![contrabazista](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@contrabazista](https://forum.highend3d.com/u/contrabazista)
#### Post date: [November 26, 2002, 5:33pm UTC](https://forum.highend3d.com/t/if-is-then/5665/1 "2002-11-26T17:33:42Z")

</div>

ok . i need to write a simple expression but I am Stuck.  
 the goal is :   
 when object A is selected select object B.  
 well I was thinking that I can do it with an if statment  
 aka:  
$s = `ls -sl`;  
if ( $s == A)  
 select -tgl B:

well thats the Idea . of course it does not work . so Could you help me to write the expression that will .  
 thanks   
 yury

---

<div class="post-metadata">

### Author: ![jeffd](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/71c47a/32.png) [@jeffd](https://forum.highend3d.com/u/jeffd)
#### Post date: [November 27, 2002, 12:49am UTC](https://forum.highend3d.com/t/if-is-then/5665/2 "2002-11-27T00:49:08Z")

</div>

If you need a script that continually monitors the selection state of an object you need to look into the scriptJob command.

--JeffD

---

<div class="post-metadata">

### Author: ![contrabazista](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@contrabazista](https://forum.highend3d.com/u/contrabazista)
#### Post date: [November 27, 2002, 4:12pm UTC](https://forum.highend3d.com/t/if-is-then/5665/3 "2002-11-27T16:12:23Z")

</div>

thanks Man .  
 actually I ended up using the For Function to get what I want:

$q = `ls -sl` ;  
// print $q;  
for ( $x in $q ) {  
 if ( $x == "ball" )  
 select -add ball1;  
}

anyway thnks for the input.  
 yury
