this post was submitted on 13 Apr 2025
6 points (100.0% liked)
AutoHotkey
179 readers
1 users here now
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
You would either concatenate it or use the format command. That is explained at the beginning of the document. You could assign the filename to a variable.
filename := A_ComputerName. ".txt"
I am on mobile so it is much easier to link to examples. What have you tried?
I'm also currently on mobile and while I know about concatenation, I don't understand how to incorporate the filename into the path.
FileAppend()
requires the path if you want it elsewhere than the script's folder (which I do), so how would that work?"C:\" . filename
?It's currently
FileAppend('test', 'C:\doc.txt')
, for example.FileAppend is to write data to the end of a file.
If your computer name is Alice, then
FileAppend A_ComputerName, "Helloworld.txt"
This changes the text of HelloWorld.Txt to
"Hello World.
Alice"
Where Helloworld.txt will (probably) be in the same folder as your script.
You are asking about the file name, which would be
FileAppend "asdf", A_Computername . " Helloworld.txt"
Filename:
"Alice Helloworld.txt"
Text:
"Hello World
asdf"
FileAppend does create a file, so you can just start calling the file and appending to it with the same command:
MyData := "GIGOasdfasdfasdfasdf" MyPath:= "C:\OutputFolder" . A_Computername
FileAppend MyData, MyPath, `n
Gotcha, I don't know why my brain couldn't figure this out. Thanks, I'll try it!