Jump to content

I can WinActivate osk but I cannot ControlClick on it


inna
 Share

Go to solution Solved by BakedCakes,

Recommended Posts

Hi, I'm not sure what's wrong with my code or it's related to Windows's changes like UDF that I cannot ControlClick on a Windows Native app.

This is my code:

#include <AutoItConstants.au3>
$i = 0
While $i <= 10
    $i = $i + 1
    Local $key = '[Title:On-Screen Keyboard]'
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    Local $key = WinWait('[Title:On-Screen Keyboard]', '', 1)
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    Local $title = '[CLASSNN:DirectUIHWND1]'
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    WinActivate($key)
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    ControlClick($key,'', $title, 'left', 1, 1109, 240) ; Right Shift ControlClick Coords for window size 1390, 320
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    WinMove($key, '', 800, 100, 400, 400, 100)
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    Run("C:\windows\system32\osk.exe")
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    Local $hWnd = WinGetHandle("[CLASS:OSKMainClass]")
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    Sleep(1000)
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    WinActivate("[CLASS:OSKMainClass]")
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    WinWait("[CLASS:OSKMainClass]", '', 5)
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    $hWnd = WinGetHandle("[CLASS:OSKMainClass]")
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
    WinMove($hWnd, "", 563, 387, 1000, 400)
    ConsoleWrite('The value of i is ' & $i & @LF)
    $i = $i + 1
WEnd

Part of my code is from this topic, but does not work for me (not unexpected, but does not work at all).

I put a While loop only to see how it goes and what it does.

This is the console:

The value of i is 1
The value of i is 2
The value of i is 3
The value of i is 4
The value of i is 5
The value of i is 6
The value of i is 7
The value of i is 8
The value of i is 9
The value of i is 10
The value of i is 11
The value of i is 12
The value of i is 13
The value of i is 14
+>20:50:05 AutoIt3.exe ended.rc:0
+>20:50:05 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 20.15

I am trying different ways to run osk, but with Run it does not, but if I run it manually it focuses to that window. But I cannot click on any position of its controls.

The reason of using osk is I'm trying to test something in a Windows Remote Desktop after closing the session, so that there's no input of my laptop connected to RDP (like mouse and keyboard).

Do you please help me?

Edited by inna
Link to comment
Share on other sites

1 hour ago, BakedCakes said:

Add #RequireAdmin at the beginning so that the script runs as Administrator, OSK seems to be a privileged process so a non-admin process can't interact with it.

Thanks a lot:) It's using ControlClick finally on it:)

Link to comment
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
 Share

  • Recently Browsing   0 members

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