hexagon logo

Script help please

I have run this script many times. Here is the problem. If I have more then one assignment in the program it passes to them all and that is not a good thing. How can I get it to pass to a assignment name or just the first one it comes to and leave the rest alone.
Function Main()
Begin Dialog Menu 192,45,140,115, "Run Manual Alignment?",.enable
OptionGroup .GROUP_1
OptionButton 32,16,68,12,"YES",.choice1
OptionButton 32,28,68,12,"NO",.choice2
OKButton 8,88,48,16
CancelButton 64,88,64,16
End  Dialog

Dim  app  As Object
Set  App = CreateObject("pcdlrn.Application")

Dim  part  As  Object
Set  Part  =  App.activePartProgram

Dim  cmds  As  Object
Dim  cmd  As  Object

Dim  dlg1  As  Menu
button  =  Dialog( Dlg1 )

Dim  sel_text  As  String

If  button  =  -1  Then
'comment  MsgBox "button:" & button ' uncomment For button return value
Select  Case  Dlg1.GROUP_1
Case  0 
sel_text  =  "YES"
Case  1
sel_text  = "NO"
End  Select
Else
MsgBox "Cancel was Pressed"
End  If

Set  cmds  =  part.Commands
'comment  Get the assignments command
For  Each  cmd  In  cmds

If  cmd.TypeDescription  =  "Assignment"  Then
bln  =  cmd.PutText(""""  + sel_text  + """",SRC_EXPR,0)
cmd.ReDraw
End  If

Next  cmd

End  Function



Thanks
Parents Reply Children
No Data