kertofer Posted March 11, 2006 Share Posted March 11, 2006 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 More sharing options...
Valuater Posted March 11, 2006 Share Posted March 11, 2006 (edited) 1Welcome to Autoit2Show Script = Get Helpcan you show what script you have so far??a great place to learn alot quicklyhttp://www.autoitscript.com/forum/index.php?showtopic=21048#8) Edited March 11, 2006 by Valuater Link to comment Share on other sites More sharing options...
theguy0000 Posted March 11, 2006 Share Posted March 11, 2006 (edited) Welcome to the forums!I'm not sure what you mean, but try looking at these functions:FileWriteFileWriteLineIniWriteFileCopyPlease let me know wether this is helpful Edited March 11, 2006 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 More sharing options...
Moderators SmOke_N Posted March 11, 2006 Moderators Share Posted March 11, 2006 I just did something like that here: http://www.autoitscript.com/forum/index.ph...ndpost&p=159997 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kertofer Posted March 11, 2006 Author Share Posted March 11, 2006 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 More sharing options...
Valuater Posted March 11, 2006 Share Posted March 11, 2006 maybe $FilePath = "C:\program files\files\" $Username = "kertofer" FileCopy = ($FilePath & $Username & ".ini" , $FilePath & "filename.ini",1) 8) Link to comment Share on other sites More sharing options...
kertofer Posted March 11, 2006 Author Share Posted March 11, 2006 Here is the error I get now: Error:Error parsing function call This error is thrown on the line with the FileCopy function in it. Link to comment Share on other sites More sharing options...
greenmachine Posted March 11, 2006 Share Posted March 11, 2006 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 More sharing options...
Valuater Posted March 11, 2006 Share Posted March 11, 2006 (edited) ooopps!... twice today 8) Edited March 11, 2006 by Valuater Link to comment Share on other sites More sharing options...
greenmachine Posted March 11, 2006 Share Posted March 11, 2006 then one of your files/folders is not there/correct8)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 More sharing options...
kertofer Posted March 11, 2006 Author Share Posted March 11, 2006 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 More sharing options...
kertofer Posted March 11, 2006 Author Share Posted March 11, 2006 GreenMachine, you were right, I did not see that equal sign in the FileCopy funchtion line, that got it working! Thanks a lot all! Link to comment Share on other sites More sharing options...
Valuater Posted March 11, 2006 Share Posted March 11, 2006 (edited) ... I did not see that equal sign in the FileCopy funchtion line...yea... then i followed your lead... Dah!8) Edited March 11, 2006 by Valuater Link to comment Share on other sites More sharing options...
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