Share this post

Link to post

Share on other sites

sulfurious 0

To use strings on a .reg file, it must be ASCII, not Unicode. Open a ASCII .reg file and search and replace. To open Unicode file, fileopen(file,4) - which is RAW, or hexadecimal. Then handle with something like _Hex2String, then you can use strings to search and replace.

Share this post

Link to post

Share on other sites

SebaM 0

Oh my good. I think that this is more easy. Im not Informatiker so for me I think is too much

There is no easy way to replace in registry file drive letters? Just simple find and replace? Maybe not to change in registry file but write this file to registry and then change entry to current drive letter or working directory?

Share this post

Link to post

Share on other sites

sulfurious 0

It is easy, if the .reg file is ASCII. Then you can open file, read line, search for c:\ and replace with d:\. All pretty standard stuff you will find in the help file examples, under fileopen, filereadline,stringinstr,stringreplace.

Most people export .reg file in w2k/xp format, which is Unicode. Exporting in 9x is ASCII. You can also find mulitple posts showing how to use a RunWait(@comspec 'type') statement to convert the existing Unicode format to ASCII format.

You can also use the RegRead and RegWrite functions to chage the values in your registry.

but I think that AutoIt don't support regexps? MessageBox don't show changed directory.

Thans for all help.

If your file is opened, you then read $line. If there is only one line in the file, then you have captured $line. However, if there is more than one line in the file, then your RegExp is looking for whatever the last $line was, which may not contain what you expect. Try doing a string search before the wend.

Share this post

Link to post

Share on other sites

sulfurious 0

First guess would be the value has both ' and ", so the search is probably confused. Try you search string including the quotes that will be in the value. You might also give @Homedrive a $var before you call it. Then use the $var where you need it.

Share this post

Link to post

Share on other sites

sulfurious 0

I don't know if you need to use regular expressions or not. If your drive letter value to change will always be the same, then I came up with this (as an example) to get the reg values, convert them to ascii, and then replace a value. Maybe it helps.