Jump to content

New to scripting :/


moobsuk
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...