Sign in to follow this  
Followers 0
Guest simon

Can any one help!

9 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

I got another idea, have no idea if this is what you looking for :idiot:

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


Were ever i lay my script is my home...

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 :idiot:

EDIT: Just realized that i'm spamming this thread... sorry :">

Edited by Doxie

Were ever i lay my script is my home...

Share this post


Link to post
Share on other sites

I got another idea, have no idea if this is what you looking for :idiot:

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

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

<{POST_SNAPBACK}>

Hi Doxie,.

Thanks for your replies. T

he 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 ideas

Simon

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 userID

Did you try RunAsSet("user", "dom", "password", 2) ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

as far as i know it works like this:

4th param  Environment
======     ===========
0          Default userId
1          RunAsSet userId
2          Original userid 
Empty      RunAsSet userID

Did 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.

Share this post


Link to post
Share on other sites

Hi Simon,

The reason i removed that post, is because i don´t think you can change value of a macro :idiot:

As you said its used to collect data. (I'm not sure tough)


Were ever i lay my script is my home...

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