gypsy Posted November 9, 2007 Posted November 9, 2007 Hi, I'm new to AutoIT. Is it possible to append the IP Address of a host to the name of a log file? $PublicIP = _GetIP() ;Gets IP Address of local host. $file = FileOpen("logfile.txt", 1) ;Opens a text file called logfile.txt which can be written to. Would like to have the log file name in the following format: logfile_123.456.7.8.txt (123.456.7.8 is the IP Address from the local host) Running multiple machines and it would be easier to identify the log files on a shared drive. Thanks!
Achilles Posted November 9, 2007 Posted November 9, 2007 (edited) Using either FileCreate (if you're making a new file) or FileMove (this can be used to rename, try something like this: FileMove('your file.txt', 'your file name_' & @IPAddress1 & '.txt') If you want to use the _GetIP() function it would be similar, just replace @IPAddress1 with $PublicIP or _GetIP() Edited November 9, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
gypsy Posted November 9, 2007 Author Posted November 9, 2007 Using either FileCreate (if you're making a new file) or FileMove (this can be used to rename, try something like this:FileMove('your file.txt', 'your file name_' & @IPAddress1 & '.txt')If you want to use the _GetIP() function it would be similar, just replace @IPAddress1 with $PublicIP or _GetIP()Thanks!The following worked!$file = FileOpen("logfile_" & $PublicIP & ".txt", 1)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now