moobsuk 0 Posted September 24, 2010 Hi there! Fairly new to the whole Autoit scene so go easy on me! I have a need to open a specific file, its the win.ini file. But also I need to be able to amend the last line in the ini file, is this possible? Share this post Link to post Share on other sites
wakillon 403 Posted September 24, 2010 Welcome to the forum ! Do you know the content of this last line or it's never the same thing ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
Varian 8 Posted September 24, 2010 Here's an example;This segment reads your Win.ini file $Before = FileRead(@WindowsDir & '\win.ini') If @error = 1 Then Exit MsgBox(0, 'ERROR', 'Cannot Read ' & @WindowsDir & '\win.ini') MsgBox(0, 'Win.ini Contents Before Append', $Before) ;This segment writes an additional line to your Win.ini file $Write = FileWrite(@WindowsDir & '\win.ini', 'Your New Line of Text' & @CRLF) If $Write = 0 Then Exit MsgBox(0, 'ERROR', 'Cannot Write To ' & @WindowsDir & '\win.ini') $After = FileRead(@WindowsDir & '\win.ini') MsgBox(0, 'Win.ini Contents After Append', $After) ;This segment reverts the changes that were made...delete/comment these lines when you are ready $File = FileOpen(@WindowsDir & '\win.ini', 2) If @error = -1 Then Exit MsgBox(0, 'ERROR', 'Cannot open ' & @WindowsDir & '\win.ini') FileWrite($File, $Before) FileClose($File) Share this post Link to post Share on other sites
Varian 8 Posted September 24, 2010 Welcome to the forum !Nice New? Avatar!! Share this post Link to post Share on other sites
moobsuk 0 Posted September 24, 2010 wow! that was a quick response!!!! Thank you very much! will go test it out now. Share this post Link to post Share on other sites
wakillon 403 Posted September 24, 2010 Nice New? Avatar!!@VarianThanks, yours too ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
HavikTech 0 Posted September 24, 2010 In addition to what Varian said, you should read the help file about each function used in Examples. Because you are new to AutoIt, i strongly recommend read it. You can access it by pressing F1 in SciTE Editor. Share this post Link to post Share on other sites