Sign in to follow this  
Followers 0

File Creation

2 posts in this topic

Is it possible to create a file using Autoit3 as part of a routine.

I am currently working in a large user environment and I want to make a list of all users who's My Docs are stored locally. So I thought a simple check as they log on and create a text file in a share with the username as the filename....something along these lines.....

FileExists(@username & ".txt") then exit

$MyDocs = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" , "personal")

if $MyDocs = ("Z:\My Documents") then exit

I can write it to a logfile but then I have to read the file for existing usernames to avoid duplicate entries and as it's going to be part of the logon script it will be faster to check for a file.

I have looked through the help files and all I can find is _FileCreate and I this doesnt seem to create a file even locally.

Any ideas much appreciated

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post

Link to post
Share on other sites

I'm not sure, but you're trying to see if the user that logs on has his/her My Documents folder in a local hdd or somewhere else, and if is local, write it to a txt file? In that case, try

If @MyDocumentsDir = "Z:\My Documents" Then Exit
$file = FileOpen("C:\Users.txt", 1)
FileWriteLine($file, @UserName)

If I misunderstand you let me know!

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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