layer Posted December 28, 2004 Share Posted December 28, 2004 (edited) hello... i thought i saw this a while ago... but how would i write a .cfg? ive searched the help file... ive looked in file.au3... but heres my code that doest write any .cfg files... Func n0r3c0i1 () $path= "C:\Program Files\Steam\SteamApps\mynamehere**\counter-strike\cstrike\autoexec.cfg" FileWriteLine ($path, "cl_pitchspeed 2.5") FileWriteLine ($path, "alias w wait") FileWriteLine ($path, "alias +ab ab1; ab2") FileWriteLine ($path, "alias -ab ab3; ab4") FileWriteLine ($path, "alias ab1 +lookdown; w; +attack") FileWriteLine ($path, "alias ab2 +lookdown; w; +attack") FileWriteLine ($path, "alias ab3 -lookdown; w; -attack") FileWriteLine ($path, "alias ab4 -lookdown; w; -attack") FileWriteLine ($path, "bind mouse1 +ab") EndFunc While 1 Sleep(10) $get= GUIGetMsg () Select Case $get= $b1 n0r3c0i1 () EndSelect WEnd lets say $1 and others are already defined though... what am i doing wrong? Edited December 28, 2004 by layer FootbaG Link to comment Share on other sites More sharing options...
Valik Posted December 28, 2004 Share Posted December 28, 2004 Quite obviously (Given that you've specified the full path 329538259 times which is dumb...), you're missing a \ after the drive letter. Link to comment Share on other sites More sharing options...
Josbe Posted December 28, 2004 Share Posted December 28, 2004 While 1 Sleep(10) $get= GUIGetMsg () Select Case 1=1;$get= $b1 n0r3c0i1 () Exit; for testing purposes EndSelect WEnd Func n0r3c0i1 () Local $sFile = "output.cfg"; for testing purposes ;"C:\Program Files\Steam\SteamApps\MYNAMEHERE\counter-strike\cstrike\autoexec.cfg" FileWriteLine ($sFile, "cl_pitchspeed 2.5") FileWriteLine ($sFile, "alias w wait") FileWriteLine ($sFile, "alias +ab ab1; ab2") FileWriteLine ($sFile, "alias -ab ab3; ab4") FileWriteLine ($sFile, "alias ab1 +lookdown; w; +attack") FileWriteLine ($sFile, "alias ab2 +lookdown; w; +attack") FileWriteLine ($sFile, "alias ab3 -lookdown; w; -attack") FileWriteLine ($sFile, "alias ab4 -lookdown; w; -attack") FileWriteLine ($sFile, "bind mouse1 +ab") EndFunc Yeah...as Valik said. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
layer Posted December 28, 2004 Author Share Posted December 28, 2004 (edited) hmmm, i updated the code up there ^^ still doesn't work... EDIT: i even tried josbe's code, that doesnt work either EDIT2: nevermind, i got it, thanks guys EDIT3: sometimes i think my brain is as small as homers... Edited December 28, 2004 by layer FootbaG Link to comment Share on other sites More sharing options...
CyberSlug Posted December 28, 2004 Share Posted December 28, 2004 One possible revision. See the FileWriteLine remarks for why this is better...Func n0r3c0i1 () Local $path = "C:\Program Files\Steam\SteamApps\MYNAMEHERE\counter-strike\cstrike\autoexec.cfg" Local $handle = FileOpen($path, 1);append mode If $handle = -1 Then Return MsgBox(4096,"Error","Could not open file for writing...") EndIf FileWriteLine($handle, "cl_pitchspeed 2.5") FileWriteLine($handle, "alias w wait" FileWriteLine($handle, "alias +ab ab1; ab2" FileWriteLine($handle, "alias -ab ab3; ab4" FileWriteLine($handle, "alias ab1 +lookdown; w; +attack" FileWriteLine($handle, "alias ab2 +lookdown; w; +attack" FileWriteLine($handle, "alias ab3 -lookdown; w; -attack" FileWriteLine($handle, "alias ab4 -lookdown; w; -attack" FileWriteLine($handle, "bind mouse1 +ab" EndFuncIn fact, why do you even need to FileWriteLine text that doesn't change? Couldn't you overwrite autoexec.cfg with a premade file?If you wanted to merge a premade file with autoexec.cfg you could try the following on Windows XP (assuming you used the correct full file paths):Run('cmd /c type "yourAdditionalLines.cfg" >> "autoexec.cfg"', "", @SW_HIDE) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
layer Posted December 28, 2004 Author Share Posted December 28, 2004 thanks cyberslug! that looks awesome thanks for helping me FootbaG Link to comment Share on other sites More sharing options...
killaz219 Posted December 28, 2004 Share Posted December 28, 2004 Now that you got it don't forget "exec autoexec.cfg" And you better not forget -console 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