Cheran Posted April 28, 2008 Share Posted April 28, 2008 Hi, I am a newbie to Autoit and am just testing the waters. I am trying to build a script where it asks for the username or gets it from "@username" and copies some file from Location X to Y. (Both directories in the same partition, will later change to network share).Can anyone helpme in that?Details : For Citrix & Terminal server we can change the application path by using "%username%" in icon properties so that each user has seperate session though the application installation is done just once . Each user will have a folder based on his username.I need to copy the files to each user based on some conditions. Link to comment Share on other sites More sharing options...
monoceres Posted April 28, 2008 Share Posted April 28, 2008 I'm not sure what you want but this could be a start $user=InputBox("Username:","Please enter username, empty for macro") If $user="" Then $user=@UserName DirCopy("C:\Users\"&$user&"\VeryImportFolder","C:\Destination\") Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Cheran Posted April 28, 2008 Author Share Posted April 28, 2008 I'm not sure what you want but this could be a start $user=InputBox("Username:","Please enter username, empty for macro") If $user="" Then $user=@UserName DirCopy("C:\Users\"&$user&"\VeryImportFolder","C:\Destination\") Hi Monoceres, I have tried that as well but doesnot seem to be working #include<file.au3> #NoTrayIcon $user=InputBox("File Copy", "Username ") If $user="" Then $user=@UserName DirCopy("C:\Source\Data\","C:\Destination\"&$user&"\Data",1) I had converted the same to exe and run it. Is there something that i am missing ? And btw thanks for your response! Way Fast! Regards Cheran Link to comment Share on other sites More sharing options...
monoceres Posted April 28, 2008 Share Posted April 28, 2008 Test adding this before DirCopy() DirCreate("C:\Destination\"&$user&"\") Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
FreeFry Posted April 28, 2008 Share Posted April 28, 2008 May I suggest using the Application Data directory for user-specific files/settings, etc.? It's specific to each user, and it can be located with the @AppDataDir macro. Also for global settings/files, etc., you can use the @AppDataCommonDir macro. Link to comment Share on other sites More sharing options...
Cheran Posted April 28, 2008 Author Share Posted April 28, 2008 Test adding this before DirCopy() DirCreate("C:\Destination\"&$user&"\") Hi Monoceres, Yipee it worked! But one question, the folders existed before Dircreate as well! But still needs to be "Created?". Anyway it works! Thanks ! Link to comment Share on other sites More sharing options...
monoceres Posted April 28, 2008 Share Posted April 28, 2008 Hi Monoceres, Yipee it worked! But one question, the folders existed before Dircreate as well!But still needs to be "Created?". Anyway it works! Thanks ! No it shouldn't, really sure a folder with the exact same foldername existed?But hey, if it works then it it doesn't matter Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Cheran Posted April 28, 2008 Author Share Posted April 28, 2008 May I suggest using the Application Data directory for user-specific files/settings, etc.?It's specific to each user, and it can be located with the @AppDataDir macro. Also for global settings/files, etc., you can use the @AppDataCommonDir macro. Hi FreeFry, I have no idea how to use that! But Thanks for the tip, i am still Learning!RgdsCheran Link to comment Share on other sites More sharing options...
FreeFry Posted April 28, 2008 Share Posted April 28, 2008 Hi FreeFry, I have no idea how to use that! But Thanks for the tip, i am still Learning! Rgds Cheran I'm not sure I'm following exactly what you're wanting to do, but what I mean was doing something like this: Dim $MyApp = "My Application" ; Your application name Dim $SettingsDir = @AppDataDir & "\" & $MyApp ; This defines your application settings/data dir DirCreate($SettingsDir) ; Create our applications directory in case it would not exist. ; Some examples what you can use this for: FileCopy(@WindowsDir & "\explorer.exe", $SettingsDir & "\") ; Copy some user-specific file to your applications directory.. IniWrite($SettingsDir & "\SomeSettingsFile.ini", "SomeSection", "SomeKey", "SomeValue") ; Write some user setting $Value = IniRead($SettingsDir & "\SomeSettingsFile.ini", "SomeSection", "SomeKey", 0) ; Read the setting MsgBox(0, "Value read:", $Value) ; Display the setting ShellExecute($SettingsDir) ; Open settings directory 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