Dalai wrote:Just replacing all occurances of string X with string Y may work at first, until there's some string that you don't want to have replaced.
But that is exactly what I do now, and it's working fine. So...
Dr. Strangelove and all that.
Dalai wrote:@Hacker:
The replacement you make in your code only works in one direction, but both directions are needed. As I understand brian,
You understood me fine. Now, the 2nd directions is no biggie, look below.
[face=courier]
IF winver ="[Version 10.0.14393]"
THEN[/face]
Code: Select all
#NoEnv
ReplaceString1 = C:\
ReplaceString2 = D:\
TemporaryString = ######TempString######
EnvGet, TcIni, COMMANDER_INI
EnvGet, TcExe, COMMANDER_EXE
SplitPath, TcExe, TcProcessName
PostMessage, 1075, 24340, , , ahk_class TTOTAL_CMD
Process, WaitClose, %TcProcessName%
FileRead, FileContents, %TcIni%
StringReplace, FileContents, FileContents, %ReplaceString1%, %TemporaryString%, All
StringReplace, FileContents, FileContents, %ReplaceString2%, %ReplaceString1%, All
StringReplace, FileContents, FileContents, %TemporaryString%, %ReplaceString2%, All
FileRecycle, %TcIni%
FileAppend, %FileContents%, %TcIni%
Run, %TcExe%
[face=courier]
ELSE[/face]
Code: Select all
#NoEnv
ReplaceString1 = C:\
ReplaceString2 = D:\
TemporaryString = ######TempString######
EnvGet, TcIni, COMMANDER_INI
EnvGet, TcExe, COMMANDER_EXE
SplitPath, TcExe, TcProcessName
PostMessage, 1075, 24340, , , ahk_class TTOTAL_CMD
Process, WaitClose, %TcProcessName%
FileRead, FileContents, %TcIni%
StringReplace, FileContents, FileContents, %ReplaceString2%, %TemporaryString%, All
StringReplace, FileContents, FileContents, %ReplaceString1%, %ReplaceString2%, All
StringReplace, FileContents, FileContents, %TemporaryString%, %ReplaceString1%, All
FileRecycle, %TcIni%
FileAppend, %FileContents%, %TcIni%
Run, %TcExe%
[face=courier]
ENDIF[/face]
Of course, the big thing missing is running a dos command VER from inside the script, and comparing the output with a string.
The string can be coded with something like:
Code: Select all
VersionString = [Version 10.0.14393]
perhaps?
How do I get to run the dos command?