Jump to content

Calling a filename?


Recommended Posts

Hi all, I am new to Autoit scripting and I am trying to use a variable to call a filename and am not sure of the syntax to do so.

For example I have a variable which is $UserName and I have a file in a directory that is called UserName.ini I want Autoit to grab the $Username variable, append .ini to it and copy that file over another file.

Can someone help me out with the proper syntax for this?

Thanks in advance!

Link to comment
Share on other sites

Welcome to the forums!

I'm not sure what you mean, but try looking at these functions:

FileWrite

FileWriteLine

IniWrite

FileCopy

Please let me know wether this is helpful :)

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

HEre is what I am doing:

$FilePath = (C:\program files\files\)

$Username = 'kertofer'

FileCopy = ($FilePath\$Username.ini,$FilePath\filename.ini,1)

What I am trying to accomplish is getting a group of files that can be copied over the main configuration file by using an AutoIt script.

Link to comment
Share on other sites

maybe

$FilePath = "C:\program files\files\"
$Username = "kertofer"

FileCopy = ($FilePath & $Username & ".ini" , $FilePath & "filename.ini",1)

8)

Since when do you set something equal to a function call?

$FilePath = "C:\program files\files\"
$Username = "kertofer"

FileCopy ($FilePath & $Username & ".ini" , $FilePath & "filename.ini",1)
Link to comment
Share on other sites

then one of your files/folders is not there/correct

8)

What are you talking about? Did you reread your code you posted, and then the code I posted? Did you notice something different between the way you were calling the function and the way I was? That's where your error is.

Link to comment
Share on other sites

I got this to work, I created a simple DOS batch file within the files directory and had it copy the files the way I want them then in my AutoIt script I call that batch as follows:

Run($FilePath & $Username & ".bat",$FilePath)

This works, it is just something in that FileCopy function call that is not working and I am too much of a newb to figure out what it is.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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