Jump to content

Send and Windows 7


Recommended Posts

Hello All,

I'm relatively new to AutoIT so please be gentle... I've tried searching and reading the forum / site but can't find anything to help, so apologies if there's a quick and easy link somewhere that answers this but I haven't found it.

I'm trying to get a script working on Windows 7. I need to add a domain user to the local group, and I've found some code elsewhere but I haven't been able to get it to work and don't know enough about the processes to debug it. So my approach is to use arrow keys and do it auto-manually... (:-))

The following code works a treat on WindowsXP, but doesn't work on Windows 7. It seems as though the SEND function isn't working on Windows 7. Is this a known problem or something weird at my end? I've tried it on two different W7 machines and neither work.

ShellExecute("compmgmt.msc")
    WinWaitActive("Computer Management")

    ; scroll to groups
    Sleep(100)
    
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")

I've tried putting sleeps between each of the SEND calls, I've also tried

ControlSend("Computer Management","","","{DOWN}")

but neither seem to work.

As mentioned, it appears as though the SEND function is either not working, or sending to the wrong window.

Any assistance would be greatly appreciated.

Many thanks,

Chris.

Link to comment
Share on other sites

Welcome to the forum.

Look at ControlSend, and also look at using commandline type scenarios to do what you have in mind. Look here:

http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/22315110-cf36-440b-9590-ba1d78b4331d

This will make it MUCH easier to do what you have in mind.

Link to comment
Share on other sites

Hello Volly,

thanks for your response. I had a look at the site you referenced and it appears to be aimed at adding machines to a domain. My machines are already added to the domain so that's not my problem. I have tried ControlSend but that doesn't appear to work either.

What I am trying to achieve is to add a user "mydomain\myusername" to the local administrators group on the local machine. I can do this via the AddToGroup option in the user management console.

However, this is secondary to my problem. It certainly seems as though either

a. SEND doesn't work on the windows 7 machine, or

b. this particular control doesn't receive messages from AutoIt.

both seem very peculiar.

As stated, the script I posted works perfectly under windowsXP. When I perform those actions manually under W7 it works. So I can't understand why the script isn't working?

Cheers,

Chris.

Edited by stebbo
Link to comment
Share on other sites

Hi All,

after further investigation I've discovered a command line that actually works. I had tried this command line before but nothing I'd read had specified that the quotes around the username and group were required - I had simply assumed they were there for illustrative purposes.

So, I can run the following command

net localgroup "administrators" "mydomain\myusername" /add

and that works.

Now, I just need to figure out how to get that to run as an administrator and I'll be fine.

Cheers,

Chris.

Link to comment
Share on other sites

  • 8 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...