Jump to content

Recommended Posts

Posted (edited)

I am still new with autoit, but I was wondering how one would go about cutting the bottom line from a .txt file and pasting it into another at a certain location. Here is a quick overview of what I am trying to accomplish. The company I work for builds systems for clients and then sets them up at the desired location. I am currently using a CD based Windows XP unattended installation, but the problem with that is I have to create a new CD for each machine because of the product license, or use a license key changer after I do the install.

What I want to do is use a RIS and PXE to automatically start the install when I turn the machine on. The response information file is called "WINNT.SIF" and has a line were you can add the Windows license for the machine. I would like to store all of the keys in one text file and have them cut and pasted into the WINNT.SIF file when the installation starts, thus providing a unique key for each machine.

I know how to go about doing this, but as to the applicable syntax using autoit I am a bit unsure of. The steps should be:

1: Open the .txt file, then select and cut the last line of the file.

2: Open the WINNT.SIF file and paste the line after "ProductKey=" in the file

3: Exit and save both files

I don't think it will be very difficult to do, but what can I say I'm a noob.

I would appreciate any help or information anyone can give.

Edit* I am not looking for someone to complete a script for me, I am just looking for applicable functions or code that I can see to get an idea of how to accomplish this. I'm not going to learn anything if I just have someone do it for me.

Edited by agass4u
Posted

Check out the readme for:

FileWrite ( filehandle or "filename", "line" )

FileWriteLine ( filehandle or "filename", "line" )

Or maybe even:

_ReplaceStringInFile($szFileName, $szSearchString, $szReplaceString, $fCaseness = 0, $fOccurance = 1)

B)

Posted

That's perfect!

And I know I can do what I need with these, FileReadLine, and _FileCountLines.

I don't see anything like a FileCutLine though. That would simplify things a lot. I'll keep searching through the Help Doc. Thanks.

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
×
×
  • Create New...