Guest simon Posted December 16, 2004 Share Posted December 16, 2004 Hi, I am new to Autoit but have used a small scrip to run a program as a different user. See script below: ; Set the RunAs parameters to use local adminstrator account RunAsSet("user", "dom", "password", 0) ; Run Draw plus seven ;RunWait("c:\program files\serif\drawplus\7.0\program\drawplus.exe", "c:\windows") RunWait("cmd.exe") ; Reset user's permissions RunAsSet() The only problem is that this program and others that we may need to run in this way have a file - save as option. The default save location is "My documents" but it points to the my documents folder of the default user profile. if I change the option switch to 1 in the RunAsSet line, it points to the runas users profile. Can anyone point me in the direction of code to redirect the "my documents folder" of the RunAsset user? This is for use on xP and Win2000 clients on a active directory domain with multiple users per machine. Thanks Link to comment Share on other sites More sharing options...
Doxie Posted December 16, 2004 Share Posted December 16, 2004 Maybe its just me, but i don´t understand? You need a program to save in My Documents of the current user, right? When you use RunAsSet with option 1, it should then load the profile of that user, and also give you access to that users My Documents. Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Doxie Posted December 16, 2004 Share Posted December 16, 2004 I got another idea, have no idea if this is what you looking for Set the RunAs parameters to use local adminstrator account RunAsSet("user", "dom", "password", 0) @MyDocumentsDir = "C:\Documents and Settings\" & @UserName & "\My Documents" ; Run Draw plus seven ;RunWait("c:\program files\serif\drawplus\7.0\program\drawplus.exe", "c:\windows") RunWait("cmd.exe") ; Reset user's permissions RunAsSet() Something like that, maybe someone else can help me with the rest Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Doxie Posted December 16, 2004 Share Posted December 16, 2004 (edited) I attached a picture of a GUI you can use, with this script. Wich make it possible for the user to login to the specific application. You can also add combobox for applications, so you don't need this GUI for every program. This has nothing to do with your problem, but i thought it would be sweet EDIT: Just realized that i'm spamming this thread... sorry :"> Edited December 16, 2004 by Doxie Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Guest simon Posted December 16, 2004 Share Posted December 16, 2004 I got another idea, have no idea if this is what you looking for Set the RunAs parameters to use local adminstrator account RunAsSet("user", "dom", "password", 0) @MyDocumentsDir = "C:\Documents and Settings\" & @UserName & "\My Documents" ; Run Draw plus seven ;RunWait("c:\program files\serif\drawplus\7.0\program\drawplus.exe", "c:\windows") RunWait("cmd.exe") ; Reset user's permissions RunAsSet()Something like that, maybe someone else can help me with the rest <{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Guest simon Posted December 16, 2004 Share Posted December 16, 2004 <{POST_SNAPBACK}>Hi Doxie,.Thanks for your replies. The reason we using runas is because the machines are being used by students who do not have sufficient user rights to run certain new bits of software which are being added to the machines. We use an accont that has been added to the localadministrator group to run the application (because it is compiled into a .exe the users cannot see the username and password). however when they save work created using the application we want it to point to their My Documents not the runas users my docs.I have tried using @mydocumentssdir = \\ as you suggested but this always comes back with an error saying unable to pars line. I had seen this in the list of macros but ddint realise you could set a value to it only use it retreive information!I also saved and tried to run the following which i think you posted but seems to have disapeeared!$var = "c:\"MsgBox(0, "Done", @MyDocumentsDir)@MyDocumentsDir = ($var)MsgBox(0, "Done", @MyDocumentsDir)This comes back with error in line 3 (unable to parse line).Look forward to more ideasSimon Link to comment Share on other sites More sharing options...
Developers Jos Posted December 16, 2004 Developers Share Posted December 16, 2004 (edited) The default save location is "My documents" but it points to the my documents folder of the default user profile. if I change the option switch to 1 in the RunAsSet line, it points to the runas users profile.Can anyone point me in the direction of code to redirect the "my documents folder" of the RunAsset user?This is for use on xP and Win2000 clients on a active directory domain with multiple users per machine.Thanks<{POST_SNAPBACK}>as far as i know it works like this:4th param Environment ====== =========== 0 Default userId 1 RunAsSet userId 2 Original userid Empty RunAsSet userIDDid you try RunAsSet("user", "dom", "password", 2) ? Edited December 16, 2004 by JdeB 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. Link to comment Share on other sites More sharing options...
Guest simon Posted December 17, 2004 Share Posted December 17, 2004 as far as i know it works like this:4th param Environment ====== =========== 0 Default userId 1 RunAsSet userId 2 Original userid Empty RunAsSet userIDDid you try RunAsSet("user", "dom", "password", 2) ?<{POST_SNAPBACK}>Hi I have tried using 2 but this does not allow the application to run properlly. Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 Hi Simon, The reason i removed that post, is because i don´t think you can change value of a macro As you said its used to collect data. (I'm not sure tough) Were ever i lay my script is my home... 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