-
I want to make some buttons selected according to this variable set on input:
Selections=1,4,10
How can I substract these number out of the string, so I can say:
If (x=10)
Tell target "/Button10"
Go to and stop "Selected State"
End Tell target
End if
Kim
-
Try this:
<pre>
Set Variable: "a" = 1
Set Variable: "Number" = ""
Loop While (a <= Length (Selections))
If (Substring (Selections, a, 1) eq "," or a = Length(Selections))
Set Variable: "Number" = ""
If (Number ne "")
Begin Tell Target ("/Button" & Number)
Go to and Stop ("Selected State")
End Tell Target
End If
Else
Set Variable: "Number" = Number & Substring (Selections, a, 1)
End If
Set Variable: "a" = a + 1
End Loop
</pre>
[This message has been edited by scottris (edited 26 March 2000).]
-
Ok, your script had a few bugs. Here's my version that works with the original variables:
Set Variable: "a" = 1
Set Variable: "number" = ""
Loop While (a<= Length (selections))
If (Substring ( selections, a, 1 ) eq ",")
Set Variable: "number" = ""
Else
Set Variable: "number" = Substring ( selections, a, 1 )
If ("Number" ne "")
Begin Tell Target ("/MC"&Number)
Go to and Stop ("S2")
End Tell Target
End If
End If
Set Variable: "a" = a+1
End Loop
Thx for helping me out finding it!
-
Oh my! you're quite correct.. That script that I posted had several bugs..
I am afraid that in my haste to help, I neglected to sufficiently check my work. My apologies.
However, I am glad that you figured it out!
-
eww. This language seems a lot like a Mickey Mouse version of C++. And i thought programming in DOS was lame, not it can actually be applied to something semi-practical. woo yea. IN YOUR FACE MARTHA STUART. I hope that didn't make sense to anyone.
------------------
"so, sup b?"
"watchin' the game, havin' a bud"
"tru, tru"
-Nuclearholocat
says "wazzzzup"
and "i'm hep"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|