Jump to content

Recommended Posts

Guest Kristof
Posted

Okay making a shortcut is fairly easy. But how can you program autit to copy a file of make a shortcut to the desktop for an account of which the name is unkown at the time you write the script.

Exmaple:

you install xp and you define the first account to be "user1".

Yuo log on as user1 and then you want a script to copy a file to the desktop. Easy of course:

filecopy("whatever","c:\doc & set\user1\desktop")

but the above does not work whe you define the first account to be "Peter" instead of "user1".

Is there some way to retrieve the first account name (if not it can be specified by quering the user) AND to that sepcific account name in a file copy function or a make shortcut function.

Thanx for reading and helping,

Kristof

  • Developers
Posted

Okay making a shortcut is fairly easy. But how can you program autit to copy a file of make a shortcut to the desktop for an account of which the name is unkown at the time you write the script.

Exmaple:

you install xp and you define the first account to be "user1".

Yuo log on as user1 and then you want a script to copy a file to the desktop. Easy of course:

filecopy("whatever","c:\doc & set\user1\desktop")

but the above does not work whe you define the first account to be "Peter" instead of "user1".

Is there some way to retrieve the first account name (if not it can be specified by quering the user) AND to that sepcific account name in a file copy function or a make shortcut function.

Thanx for reading and helping,

Kristof

<{POST_SNAPBACK}>

Would this work ?

filecopy("whatever","c:\doc & set\" & @UserName & "\desktop")

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

filecopy("whatever","c:\doc & set\" & @UserName & "\desktop")
Never use this way if you can use @UserProfileDir or even better @DesktopDir. Usernames change, directories do not.

The path C:\Documents and Settings\Alexandra.Meier can belong to the user Alexandra.Heimann when she marries. In worst case your script could even write data in the directory of another user. And yes, I've had this once (usernames were in different format) resulting in a lot of work for me since I had to recreate two useraccounts and sort their data into the right directories.

And if you're not logged on as that user there's still a way to get the real profile path from HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList, but it's a bit more work.

Guest Kristof
Posted

Yup, @DesktopDir does the job pretty fine. Didn't knew those @ thingies even existed.

Thank you all for replying and helping out !!!!!

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
×
×
  • Create New...