Jump to content
Sign in to follow this  
noobieautolearn

Having issues with pasting into a window

Recommended Posts

noobieautolearn

Specifically I have a code that will highlight a copy user window in Active Directory Users and computers as seen in the screen shot. Once it knows the window is active paste, then tab, paste then tab etc.  This works without issue on Windows 7 but on Windows 10 it will highlight the window then follow the paste commands but nothing shows up on that window. It's as if all those commands don't do anything.  I did put an if statement in there so that if AutoIt doesn't see the window it should sleep for 50000, it isn't getting stuck there it's progressing as if it saw the window in question but the paste commands aren't doing anything.  

Some more information on this is that I'm running active Directory users and  computers as another user other than the one I'm logged in as on both Windows 7 and Windows 10 and again this works without issue on Windows 7 but won't work on 10. Another thing to consider is, if I do nothing else than push ctrl v on my keyboard it will paste the clipboard information into the window but for some reason when the script does that it doesn't work.  Is there some kind of command I have to run get the paste to work in windows 10 since ADUC is running as another user? Is there another work around that will work?

 

Aduc copy.PNG

Edited by noobieautolearn

Share this post


Link to post
Share on other sites
BrewManNH

Run the script with the same credentials as the AD GUI.

 

Although, you can do whatever it is you're trying to automate in the GUI without using the GUI at all. Look for the AD UDF in the example scripts section.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
noobieautolearn
28 minutes ago, BrewManNH said:

Run the script with the same credentials as the AD GUI.

 

Although, you can do whatever it is you're trying to automate in the GUI without using the GUI at all. Look for the AD UDF in the example scripts section.

What is the easiest way to run the scripts as another user? What do you think the reason is that Windows 7 will work even though the script and the ADUC window are being run with two different user accounts?

 

Also I saw runas command in Autoit, it is completely unacceptable that they would ask you to type your password in plain text. Also that seems as though you be calling another program and not running the script it's self that way.

Edited by noobieautolearn

Share this post


Link to post
Share on other sites
BrewManNH

In Win7 are both credentials equal in access rights, for example both admins?

The Windows command RunAs from the command line requires you to enter the password manually, the RunAs function allows you to something similar if you use a variable tied to an Input in place of the password. As to what's acceptable or not, that's for you to decide, other's feel differently.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
noobieautolearn
27 minutes ago, BrewManNH said:

In Win7 are both credentials equal in access rights, for example both admins?

The Windows command RunAs from the command line requires you to enter the password manually, the RunAs function allows you to something similar if you use a variable tied to an Input in place of the password. As to what's acceptable or not, that's for you to decide, other's feel differently.

What command line would run the script as another user?  Is it something like this?  

C:\Windows\System32\runas.exe /user:fakedomain\fakeuser "C:\Program Files (x86)\AutoIt3\AutoIt3.exe C:\remotereg.au3" ?

 

!UPDATE: I decided to just log in as the user that has rights to create accounts directly.  Same issue happens, it highlights the ADUC window, it acts as though it is following the paste and tab commands and then gets stuck looking for the window that is supposed to come after.  It appears to be an issue with the way ADUC works or the way AI works with it specifically under windows 10 rather than an issue of running it as another user account.

Edited by noobieautolearn

Share this post


Link to post
Share on other sites
BrewManNH

Use the AD UDF, it's going to save you a LOT of time in the long run.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
noobieautolearn
2 hours ago, BrewManNH said:

Use the AD UDF, it's going to save you a LOT of time in the long run.

Does it allow you to create users based on other users and automatically put them in the same OU of the user you are copying? What about automatically setting the description? What about setting their phone number? What about setting their address or any attributes? What about everything that I can currently do with my script?  When I look at AD UDF's create user it seems way too basic to be really useful and I'm not seeing how you could do many of the things that need to be done when creating an AD account.  I'm not really sure how much time would be saved by using it.

Edited by noobieautolearn

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  

×