botanic Posted December 17, 2006 Share Posted December 17, 2006 (edited) I have an ini file and im trying to read from it the "MODE" this is my code (it always returns "ALL"...): Send(StringUpper( IniRead($INIFILE, "Trade", "Mode", "ALL"))) the location of the ini file is: $WORKINGDIR = @ScriptDir & "\"; $INIFILE = $WORKINGDIR & "\Project GremBot.ini" this is the ini file: [Trade] BuyingBotTakes=6 BuyingBotGives=1 BuyingRarity=ANY BuyingVersion=ANY Buying= NumberOwnedSign=>= NumberOwnedValue=0 Set=ALL MaxCardsPerTrade=32 NumberOfSameCards=1 NoLands=YES SellingBotGives=1 SellingBotTakes=1 TradingBotGives=2 TradingBotTakes=1 Mode=BUY Edited December 17, 2006 by botanic Link to comment Share on other sites More sharing options...
martin Posted December 17, 2006 Share Posted December 17, 2006 I have an ini file and im trying to read from it the "MODE" this is my code (it always returns "ALL"...): Send(StringUpper( IniRead($INIFILE, "Trade", "Mode", "ALL"))) the location of the ini file is: $WORKINGDIR = @ScriptDir & "\"; $INIFILE = $WORKINGDIR & "\Project GremBot.ini" this is the ini file: [Trade] BuyingBotTakes=6 BuyingBotGives=1 BuyingRarity=ANY BuyingVersion=ANY Buying= NumberOwnedSign=>= NumberOwnedValue=0 Set=ALL MaxCardsPerTrade=32 NumberOfSameCards=1 NoLands=YES SellingBotGives=1 SellingBotTakes=1 TradingBotGives=2 TradingBotTakes=1 Mode=BUY You have repeated the backslash character, try with just one - $WORKINGDIR = @ScriptDir & "\";<---------------------one $INIFILE = $WORKINGDIR & "\Project GremBot.ini"<--two Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
botanic Posted December 17, 2006 Author Share Posted December 17, 2006 nope thats not it... still nothing... that was a fix i tried and didnt edit out tho so thanks... Link to comment Share on other sites More sharing options...
martin Posted December 17, 2006 Share Posted December 17, 2006 nope thats not it... still nothing... that was a fix i tried and didnt edit out tho so thanks... All looks OK to me. I would check that the file you show really is the file that's being read. If it is then I would edit the file and insert Mode=Buy just after [Trade] in case there is something funny in the file which you can't see. Do the other values get read correctly? If not then what happens if you add If not Filexists($INIFILE) then msgbox(0,'oops','') Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
GEOSoft Posted December 17, 2006 Share Posted December 17, 2006 (edited) All looks OK to me. I would check that the file you show really is the file that's being read. If it is then I would edit the file and insert Mode=Buy just after [Trade] in case there is something funny in the file which you can't see. Do the other values get read correctly? If not then what happens if you add If not Filexists($INIFILE) then msgbox(0,'oops','')Looks to me like there's an error in the path. $WORKINGDIR = @ScriptDir & "\"; $INIFILE = $WORKINGDIR & "\Project GremBot.ini"That will return "\\" in the path. It should be $WORKINGDIR = @ScriptDir & "\"; $INIFILE = $WORKINGDIR & "Project GremBot.ini" Edit: BTW MsgBox(4096, "TEST",<whatever) is your friend. Especially when checking file paths. MsgBox(4096,"TEST",$IniFile) would have shown the "\\" in the path Edited December 17, 2006 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Lemmens Peter Posted December 17, 2006 Share Posted December 17, 2006 (edited) Martin is right ! It works fine. Copy this to a new file called "Project Grebot.ini" [Trade] BuyingBotTakes=6 BuyingBotGives=1 BuyingRarity=ANY BuyingVersion=ANY Buying= NumberOwnedSign=>= NumberOwnedValue=0 Set=ALL MaxCardsPerTrade=32 NumberOfSameCards=1 NoLands=YES SellingBotGives=1 SellingBotTakes=1 TradingBotGives=2 TradingBotTakes=1 Mode=BUY Please create a new directory and place both files (the attachement and the ini you just made) in it. Then run "Project GremBot.au3" You'll get a messagebox with the result... Best regards, PS. I don't understand the use of the "send", but that's my problem :">Project_GremBot.au3 Edited December 17, 2006 by Lemmens Peter Link to comment Share on other sites More sharing options...
botanic Posted December 17, 2006 Author Share Posted December 17, 2006 humm every other part of the ini file works fine... its just that one part.... 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