Mack Posted August 18, 2005 Share Posted August 18, 2005 I got stuck ( again ). $GameOneName = IniReadSection("settings.ini", "section1.1") For $i = 1 To $GameOneName[0][0] Inputbox( "EGS (RC1)", "1. & $GameOneName[$1][1]" ) Next Its show $GameOneName in the Inputbox Link to comment Share on other sites More sharing options...
Developers Jos Posted August 18, 2005 Developers Share Posted August 18, 2005 (edited) Inputbox( "EGS (RC1)", "1." & $GameOneName[$i][1] ) Edited August 18, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Mack Posted August 18, 2005 Author Share Posted August 18, 2005 Doesn't work, This is the whole script $GameOne = IniReadSection("settings.ini", "section1") For $i = 1 To $GameOne[0][0] Next $GameOneName = IniReadSection("settings.ini", "section1.1") For $i = 1 To $GameOneName[0][0] Next $GameTwo = IniReadSection("settings.ini", "section2") For $i = 1 To $GameTwo[0][0] Next $GameTwoName = IniReadSection("settings.ini", "section2.1") For $i = 1 To $GameTwoName[0][0] Next $GameThree = IniReadSection("settings.ini", "section3") For $i = 1 To $GameThree[0][0] Next $GameThreeName = IniReadSection("settings.ini", "section3.1") For $i = 1 To $GameThreeName[0][0] Next $GameFour = IniReadSection("settings.ini", "section3") For $i = 1 To $GameFour[0][0] Next $GameFourName = IniReadSection("settings.ini", "section3.1") For $i = 1 To $GameFourName[0][0] Next $Master = Inputbox( "EGS (RC1)", "1." & $GameOneName[$i][1] ) Link to comment Share on other sites More sharing options...
Mack Posted August 18, 2005 Author Share Posted August 18, 2005 The error: Link to comment Share on other sites More sharing options...
Developers Jos Posted August 18, 2005 Developers Share Posted August 18, 2005 Doesn't work,This is the whole script$GameOne = IniReadSection("settings.ini", "section1") For $i = 1 To $GameOne[0][0] Next $GameOneName = IniReadSection("settings.ini", "section1.1") For $i = 1 To $GameOneName[0][0] Next $GameTwo = IniReadSection("settings.ini", "section2") For $i = 1 To $GameTwo[0][0] Next $GameTwoName = IniReadSection("settings.ini", "section2.1") For $i = 1 To $GameTwoName[0][0] Next $GameThree = IniReadSection("settings.ini", "section3") For $i = 1 To $GameThree[0][0] Next $GameThreeName = IniReadSection("settings.ini", "section3.1") For $i = 1 To $GameThreeName[0][0] Next $GameFour = IniReadSection("settings.ini", "section3") For $i = 1 To $GameFour[0][0] Next $GameFourName = IniReadSection("settings.ini", "section3.1") For $i = 1 To $GameFourName[0][0] Next $Master = Inputbox( "EGS (RC1)", "1." & $GameOneName[$i][1] )<{POST_SNAPBACK}>have no idea what you are trying with the code you show here..... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Mack Posted August 18, 2005 Author Share Posted August 18, 2005 Iam creating a game list, but i get this error . The script isn't done. But first i want to solve the error. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 18, 2005 Developers Share Posted August 18, 2005 (edited) Iam creating a game list, but i get this error .The script isn't done.But first i want to solve the error.<{POST_SNAPBACK}>I was referring to your "Script Logic" ....You have 8 For...Next loops without any statement in it and then you do a InputBox() were you use the $i, which will be set to the value in $GameFourName[0][0] and you use that to InputBox a value with as default $GameOneName[$i][1] ....?in other word ... there is NO logic in this Script-let you posted.... Edited August 18, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Mack Posted August 18, 2005 Author Share Posted August 18, 2005 Alright then, how would you do it? Link to comment Share on other sites More sharing options...
Mack Posted August 18, 2005 Author Share Posted August 18, 2005 Or how should you do it? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 18, 2005 Moderators Share Posted August 18, 2005 Sounds to me the JdeB is saying, why do you have the For / Next statements. They aren't doing anything. What do you want them to do? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Mack Posted August 19, 2005 Author Share Posted August 19, 2005 (edited) Let me explain:$GameOne = IniReadSection("settings.ini", "section1") For $i = 1 To $GameOne[0][0] Next $GameOneName = IniReadSection("settings.ini", "section1.1") For $i = 1 To $GameOneName[0][0] Next $GameTwo = IniReadSection("settings.ini", "section2") For $i = 1 To $GameTwo[0][0] Next $GameTwoName = IniReadSection("settings.ini", "section2.1") For $i = 1 To $GameTwoName[0][0] Next $GameThree = IniReadSection("settings.ini", "section3") For $i = 1 To $GameThree[0][0] Next $GameThreeName = IniReadSection("settings.ini", "section3.1") For $i = 1 To $GameThreeName[0][0] Next $GameFour = IniReadSection("settings.ini", "section3") For $i = 1 To $GameFour[0][0] Next $GameFourName = IniReadSection("settings.ini", "section3.1") For $i = 1 To $GameFourName[0][0] Next $Master = Inputbox( "EGS (RC1)", "1." & $GameOneName[$i][1] )Link to game .exe's are stored in the .ini file, and i want to make a list with a InputBox so it would look like this:1. Doom 32. Counter Strike 1.63. Starcraft4. Warcraft 3 5. Tony Hawks Underground 2And then type the number and run the game, savy?PS. Ive created a wizard ( that does work ) that stores the name of the game's and .exe's in whatever i want in the settings.ini file, so once ive converted it to an .exe i don't have to change it back and also can send it to other people.Thanks for the help, just waiting for an anwser Edited August 19, 2005 by Mack Link to comment Share on other sites More sharing options...
therks Posted August 19, 2005 Share Posted August 19, 2005 (edited) What are the highlighted parts of this code supposed to be doing?$GameOne = IniReadSection("settings.ini", "section1")For $i = 1 To $GameOne[0][0]Next$GameOneName = IniReadSection("settings.ini", "section1.1")For $i = 1 To $GameOneName[0][0]Next$GameTwo = IniReadSection("settings.ini", "section2")For $i = 1 To $GameTwo[0][0]Next$GameTwoName = IniReadSection("settings.ini", "section2.1")For $i = 1 To $GameTwoName[0][0]Next$GameThree = IniReadSection("settings.ini", "section3")For $i = 1 To $GameThree[0][0]Next$GameThreeName = IniReadSection("settings.ini", "section3.1")For $i = 1 To $GameThreeName[0][0]Next$GameFour = IniReadSection("settings.ini", "section3")For $i = 1 To $GameFour[0][0]Next$GameFourName = IniReadSection("settings.ini", "section3.1")For $i = 1 To $GameFourName[0][0]Next$Master = Inputbox( "EGS (RC1)", "1." & $GameOneName[$i][1] )Because at the moment, they're doing nothing.It's like going:If $i = 1 Then EndIfYou have to put something in there!*Edit: Let's see what this settings.ini looks like. Edited August 19, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Mack Posted August 19, 2005 Author Share Posted August 19, 2005 Iam gonna sleep its 2.12 @ Holland time, Post it in the morning But the code should look a little bit like this: $Master = Inputbox( "EGS (RC1)", "1." & $GameOneName[$i][1] ) if $Master = 1 then run("$GameOne[$i][1]") $GameOne[$i][1] links to C:\Valve\CS.exe ( For Example ). But gotta go to sleep, feel free to post tough . Link to comment Share on other sites More sharing options...
therks Posted August 19, 2005 Share Posted August 19, 2005 (edited) Arg. It's so frustrating when people don't understand the difference between strings and variables! "Hello World" <-- String $HelloWorld <-- Variable "$HelloWorld" <-- String, NOT a variable Don't put quotes around variables, unless you're playing with assign or eval, and I'd rather people didn't touch those until they understand how to use variables. It's not hard people, I learned this stuff when I was 13. Okay, sorry for the rant. Anyway, you never really showed what the INI file is looking like, so instead of the blind leading the blind, I'm going to give you my own constructed INI file, and some example code. Have a look in the zip attached to this post. It only took me about 5 minutes to write that code, but hopefully you can read it and learn from it. Edited August 19, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Valuater Posted August 19, 2005 Share Posted August 19, 2005 (edited) Because of other posts by Mack, I think I understand his "logic" he is just trying to follow the help file and "load up" his arrays with the for/next for later use from help $var = IniReadSection("C:\Temp\myfile.ini", "section2") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else For $i = 1 To $var[0][0] MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) Next EndIf The problem is (to me and my hobbiest logic) that he is looking for a single iniread for a single game name under each section name Settings.ini [section1] Key1=Doom 3 [section1.1] Key1=C:\Bla\Doom 3.exe to write this, the ini needs to be more like this IniWrite("Settings.ini", "section1", "key1", "Doom 3") IniWrite("Settings.ini", "section1.1", "key1", "C:\Bla\Doom 3.exe") and the code would look more like this $GameOne = IniRead("settings.ini", "section1", "key1", "Not Found") $GameOneName = IniRead("settings.ini", "section1.1", "key1", "Not Found") $GameTwo = IniRead("settings.ini", "section2", "key1", "Not Found") $GameTwoName = IniRead("settings.ini", "section2.1", "key1", "Not Found") $GameThree = IniRead("settings.ini", "section3", "key1", "Not Found") $GameThreeName = IniRead("settings.ini", "section3.1", "key1", "Not Found") $GameFour = IniRead("settings.ini", "section3", "key1", "Not Found") $GameFourName = IniRead("settings.ini", "section3.1", "key1", "Not Found") $Master = Inputbox( "EGS (RC1)", "1. " & $GameOneName & @CRLF & "2. " & $GameTwoName & @CRLF & "3. " & $GameThreeName & @CRLF & "4. " & $GameFourName, "", " M1" ) If $Master = 1 Then Run($GameOne) If $Master = 2 Then Run($GameTwo) If $Master = 3 Then Run($GameThree) If $Master = 4 Then Run($GameFour) The "Not Found" is a default, just incase the ini was not found I think thats it 8) PS I DO understand that the ini could be written and read in sections, but I think this follows Macks direction, thus more understandable. PS2 Saunders got here first while i was writting. Edited August 19, 2005 by Valuater Link to comment Share on other sites More sharing options...
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