glasglow Posted February 14, 2008 Posted February 14, 2008 (edited) I have found myself in a very very very long file with for example: If $something = "something" Then _something($something,$ship) Endif If $something2 = "something" Then _something($something2,$ship) Endif If $something3 = "something" Then _something($something3,$ship) Endif If $something4 = "something" Then _something($something4,$ship) Endif If $something5 = "something" Then _something($something5,$ship) Endif Can I array this? Make it shorter? Edited February 14, 2008 by glasglow
Aceguy Posted February 14, 2008 Posted February 14, 2008 (edited) well for starters it would be easier if you gave more info on what your trying to achieve. and also.. if $something ="what" then whatever elseif $something = "what2" then whatever elseif $something = "what3" then whatever endif Edited February 14, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock
Aceguy Posted February 14, 2008 Posted February 14, 2008 dim $something[50] for $count = 1 to $something[0] if $something[$count]= "Whatever" then dosomething endif next [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock
glasglow Posted February 14, 2008 Author Posted February 14, 2008 (edited) dim $something[50] for $count = 1 to $something[0] if $something[$count]= "Whatever" then dosomething endif next Yes this is closer to what I am looking for.. Could I array it? I'm looking for a match for example: (pardon the code but I hope you get the idea) IF $something = ("one" OR "two" OR "three" OR "four") Then Do Something I know it's rediculous code but it seems I shoul be able to do it with an array. Edited February 14, 2008 by glasglow
Valuater Posted February 14, 2008 Posted February 14, 2008 $something = StringSplit("This,That,The other,This way,That way,The other way", ",") $return = StringSplit("Not,Nat,Nope,Dope,Pope,Rope", ",") ; match found MsgBox(0x0, "answer", "Something = " & _something("That way")) ; no match MsgBox(0x0, "answer", "Something = " & _something("Thats way")) Func _something($info) For $x = 1 To $something[0] If $something[$x] = $info Then Return $return[$x] ; return what ever you want Next Return "nada" EndFunc ;==>_something 8)
glasglow Posted February 14, 2008 Author Posted February 14, 2008 (edited) $something = StringSplit("This,That,The other,This way,That way,The other way", ",") $return = StringSplit("Not,Nat,Nope,Dope,Pope,Rope", ",") ; match found MsgBox(0x0, "answer", "Something = " & _something("That way")) ; no match MsgBox(0x0, "answer", "Something = " & _something("Thats way")) Func _something($info) For $x = 1 To $something[0] If $something[$x] = $info Then Return $return[$x] ; return what ever you want Next Return "nada" EndFunc ;==>_something 8) Man that's a great one. The Return will be written as a DO but it's a nice, very nice thank you. You had a Filesearch on here.. also a very nice example. We can all learn a lot from you. Edited February 14, 2008 by glasglow
glasglow Posted February 14, 2008 Author Posted February 14, 2008 Thanks, and your welcome!!!8)Haha you returned before I finished editing..dictionary became filesearch.. I mixed up the gui's.. filesearch pop's out a "valuater"...thanks again.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now