Sign in to follow this  
Followers 0
Cheran

File Copy

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



I'm not sure what you want but this could be a start :D

$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!

Share this post


Link to post
Share on other sites

I'm not sure what you want but this could be a start :D

$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 :D

#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

Share this post


Link to post
Share on other sites

Test adding this before DirCopy() :D

DirCreate("C:\Destination\"&$user&"\")

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

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. :D

Also for global settings/files, etc., you can use the @AppDataCommonDir macro. :D

Share this post


Link to post
Share on other sites

Test adding this before DirCopy() :D

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 ! :D

Share this post


Link to post
Share on other sites

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 ! :D

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 :D


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

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. :D

Also for global settings/files, etc., you can use the @AppDataCommonDir macro. :D

Hi FreeFry,

I have no idea how to use that! But Thanks for the tip, i am still Learning!

Rgds

Cheran

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0