Jump to content

Recommended Posts

Posted

Let's say this is the code I have

$CurrentMatchUsername = "Dgameman1"
$picklineText = "#FirstName#!! Hey, hi!"
FileWrite("C:\Users\Dgameman1\Desktop\test.txt", $picklineText)

How can I make it so that the file on my desktop named 'test.txt' will replace every instance of #FirstName# with `$CurrentMatchUsername`.

The end result is for the text.txt file to have the sentence, Dgameman1!! Hey, hi!

Posted

Use the Opt("ExpandVarStrings", 1) function to replace variables.

Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand

$CurrentMatchUsername = "Dgameman1"
$CurrentMatchUsername = @UserName  ; just to test with own osername
$picklineText = "$CurrentMatchUsername$!! Hey, hi!"
FileWrite("C:\Users\$CurrentMatchUsername$\Desktop\test.txt", $picklineText)

 

App: Au3toCmd              UDF: _SingleScript()                             

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
  • Recently Browsing   0 members

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