Jump to content
MrBedo

GPEDIT.MSC not responding to SendKeys

Recommended Posts

Posted (edited)

Can anyone save my sanity with this one?!

I'm trying to manipulate the local group policy editor using sendkeys, I won't bore you with the reasons why.

I can launch it, I can (I'm pretty sure) get it as the active window but no matter what I do, I cannot get it to react to the keys I send.

If I swap the gpedit.msc for notepad.exe (along with the relevant window titles where appropriate) it works like a charm. I'm sure it's me being a muppet somewhere along the line, but I can't see it.

The If statement is there for testing purposes and I can confirm that it comes back with a "Got it" message.

Thanks in advance for any help with this.

run(@comspec & " /c gpedit.msc")
WinWaitActive("Local")

If WinActive("Local") Then
    MsgBox(0, "Result", "Got it.")
Else
    MsgBox(0, "Result", "Not active.")
EndIf

Send("{F}")
Send("{RIGHT}")
Send("{DOWN}")
Send("{TAB}")
Send("{DOWN}")
Send("{ENTER}")
Sleep(500)
Send("{TAB}")
Send("{ENTER}")
Sleep(500)
Send("{TAB}")
Send("{TAB}")
Send("{ENTER}")

 

Edited by MrBedo

Share this post


Link to post
Share on other sites

#RequireAdmin

So I thought I'd exhausted the forums looking for solutions to this. Turns out I missed the one with the answer I needed!

In my defence, it's 5am here and I've been at this nonsense for about 16 hours straight (not the Autoit, but this lovely little project 🤯🔫).

 

cheers

Share this post


Link to post
Share on other sites

You could try to learn and use IUAutomation, It will be the best way for you to automate windows from Windows. 

 

It could look complicated but, it is not, after a bit time of training. 

 


My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...