Jump to content

On-Screen Keyboard Move and size


Mustafa23
 Share

Recommended Posts

Hello All, 

I'm having issue to move and size OSK from the first run of the script. if I run the script for the 2nd time it will do the WinMove.  Please advise

Local $hWnd = WinGetHandle("[CLASS:OSKMainClass]")
    If @OSArch = "x64" Then
         DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection
                If not WinExists($hWnd) Then
                ShellExecute("osk.exe")
                EndIf
    EndIf
WinMove($hWnd, "", 563, 387, 1000, 400)

 

Link to comment
Share on other sites

I'm not sure that I completely understand your existing code, but this is what it would look like if I were to rewrite it --

If @OSArch = "x64" Then
   DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection
EndIf

Local $hWnd = WinGetHandle("[CLASS:OSKMainClass]")

If @error Then
    ShellExecute("osk.exe")
    WinWait("[CLASS:OSKMainClass]", 5)
    $hWnd = WinGetHandle("[CLASS:OSKMainClass]") ; This is what you were missing
EndIf

WinMove($hWnd, "", 563, 387, 1000, 400)

 

Link to comment
Share on other sites

6 hours ago, Danp2 said:

I'm not sure that I completely understand your existing code, but this is what it would look like if I were to rewrite it --

If @OSArch = "x64" Then
   DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection
EndIf

Local $hWnd = WinGetHandle("[CLASS:OSKMainClass]")

If @error Then
    ShellExecute("osk.exe")
    WinWait("[CLASS:OSKMainClass]", 5)
    $hWnd = WinGetHandle("[CLASS:OSKMainClass]") ; This is what you were missing
EndIf

WinMove($hWnd, "", 563, 387, 1000, 400)

 

Thank you @Danp2 your script fix the issue. I had to change on WinWait to look like this WinWait("[CLASS:OSKMainClass]", "", 5). it was pausing the script. 

thank you again. 

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