Mesca Posted November 25, 2009 Share Posted November 25, 2009 (edited) I am trying to do something along the lines of this... IniRead("config.ini", "Messages", $message, "Error") I organized the messages in an ini and have the key names as numbers. ex: [Messages] 1 - random message 2 - another random message The $message variable is a random generated number within the total number of messages. My problem is that the key name needs to be in quotes. I tried """ & $message & """, but you can't quote quotations. :S Any solution? Edited November 25, 2009 by Mesca Link to comment Share on other sites More sharing options...
FuryCell Posted November 25, 2009 Share Posted November 25, 2009 (edited) wrap the quote in single quotes like: '"' Edited November 25, 2009 by P5ych0Gigabyte HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Mesca Posted November 25, 2009 Author Share Posted November 25, 2009 (edited) wrap the quote in single quotes like: '"' I keep getting "Error in expression" even when I do this. Here is the code that I am using with the error. $numberofmessages = IniRead("config.ini", "Messages", "NumberOfMessages", 1) $message = Random(1,$numberofmessages,1) GUICtrlSetData($CurrentMessageEdit, IniRead("config.ini", "Messages", '"' & $message & '"', "Error")) /edit I think it is boiling down to if you can use variables in iniread functions or not. Edited November 25, 2009 by Mesca Link to comment Share on other sites More sharing options...
ResNullius Posted November 25, 2009 Share Posted November 25, 2009 I keep getting "Error in expression" even when I do this. Here is the code that I am using with the error. $numberofmessages = IniRead("config.ini", "Messages", "NumberOfMessages", 1) $message = Random(1,$numberofmessages,1) GUICtrlSetData($CurrentMessageEdit, IniRead("config.ini", "Messages", '"' & $message & '"', "Error")) /edit I think it is boiling down to if you can use variables in iniread functions or not. You've got your quotes in the wrong place: you need to wrap the results of the IniRead in the quotes, not the variable in the IniRead: GUICreate("test") $CurrentMessageEdit = GUICtrlCreateInput("", 5, 5) $numberofmessages = IniRead("config.ini", "Messages", "NumberOfMessages", 1) ConsoleWrite($numberofmessages & @CRLF) $message = Random(1, $numberofmessages, 1) GUICtrlSetData($CurrentMessageEdit, '"' & IniRead("config.ini", "Messages", $message, "Error") & '"') GUISetState() Do Until GUIGetMsg() = -3 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