Webber2222 0 Report post Posted March 14, 2006 Ok... I read the FAQ and I saw that the command "goto" is not there anymore... I don't want to know why But now I have a doubt (I don't think that the example on the FAQ can be applied here). Let's say I need something like $var = IniRead("C:\Temp\myfile.ini", "section2", "key", "0");var can be "0" or "1" or "2" or "3" if $var=0 goto 1 if $var=1 goto 2 if $var=2 goto 3 if $var=3 goto 4 1 $var="sample1" goto 5 2 $var="sample2" goto 5 3 $var="sample3" goto 5 4 $var="sample4" 5 exit That is just an example, of course.... now... can anyone give me a clue how can I do that without the "goto(s)". My objctive is to be able to merge different "scripts" in one... launching the "part" I want to after reading the variable from an INI file - FYI... I need to merge them 'cause they alway have the size of 173kb if seperated, and something tells me that if I merge I'll be able to have them all with a file size almos equal Thanks in advance Share this post Link to post Share on other sites
Valuater 107 Report post Posted March 14, 2006 maybe $var = IniRead("C:\Temp\myfile.ini", "section2", "key", "0");var can be "0" or "1" or "2" or "3" if $var=0 Then goto1() if $var=1 Then goto2() if $var=2 Then goto3() if $var=3 Then goto4() Func goto1() $var="sample1" goto5() EndFunc Func goto2() $var="sample2" goto5() EndFunc Func goto3() $var="sample3" goto5() EndFunc Func goto4() $var="sample4" goto5() EndFunc Func goto5() exit EndFunc 8) Share this post Link to post Share on other sites
Confuzzled 1 Report post Posted March 14, 2006 (edited) Would While...WEnd or Select...Case...EndSelect do the job (refer Help file)? (Don't forget the otherwise bit, where none of the valid clauses apply - often a gotcha that makes debugging and program flow a real pain) Edited March 14, 2006 by Confuzzled Share this post Link to post Share on other sites
Webber2222 0 Report post Posted March 14, 2006 @Valuater Thanks... that worked as smooth as a baby's ass @Confuzzled I'll take a look into those functions aswell. Share this post Link to post Share on other sites
Valuater 107 Report post Posted March 14, 2006 (edited) welcome...because your new... if you would like to learn alot quickly... see thishttp://www.autoitscript.com/forum/index.php?showtopic=21048#8) Edited March 14, 2006 by Valuater Share this post Link to post Share on other sites
CyberSlug 3 Report post Posted March 14, 2006 (edited) If $var = 0 Then ;zeroth stuff ;... ElseIf $var = 1 Then ;first stuff ;.... ElseIf $var = 2 Then ;second stuff ;.... ElseIf $var = 3 Then ;third stuff Else ;optional other case EndIf Select...Case...EndSelect is also a good choice Switch...Case...EndSwitch (in beta AutoIt version) is another Switch $var Case 0 ;zero... Case 1 ;one... Case 2 ;two... Case 3 ;three... EndSwitch Edit: Well, the inner blocks should be indented. If you have really long sections of code, you could make the If statement or Case statement call a function like in Valuater's example. Edited March 14, 2006 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Share this post Link to post Share on other sites