Mustafa23 Posted November 13, 2020 Share Posted November 13, 2020 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 More sharing options...
Danp2 Posted November 13, 2020 Share Posted November 13, 2020 If the OSK isn't present on the first run, the script load it but doesn't then capture the $hwnd. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Mustafa23 Posted November 13, 2020 Author Share Posted November 13, 2020 1 hour ago, Danp2 said: If the OSK isn't present on the first run, the script load it but doesn't then capture the $hwnd. I'm not that really good, can you please assist me? Link to comment Share on other sites More sharing options...
Danp2 Posted November 13, 2020 Share Posted November 13, 2020 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) Mustafa23 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted November 13, 2020 Share Posted November 13, 2020 49 minutes ago, Danp2 said: if I were to rewrite it I believe you already did Danp2 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Mustafa23 Posted November 13, 2020 Author Share Posted November 13, 2020 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 More sharing options...
Danp2 Posted November 13, 2020 Share Posted November 13, 2020 @Mustafa23 Oops... left out the text parameter. 😃 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now