FrancescoDiMuro Posted May 8, 2017 Share Posted May 8, 2017 (edited) Good morning I was trying to start the Virtual Keyboard of Windows from my script, but everytime I do the Shell from the script, a MsgBox appears to communicate that it's unable to start the virtual keyboard. I run AutoIt on Windows 10 64 bit, and If I double click on "osk.exe", located in C:\Windows\System32, it runs normally... If I try to launch it from my application ( or double click / launch from C:\Windows\SysWOW64 ), it tells me what I wrote above. This is the code I use to launch the Virtual Keyboard ( First, I see if the user has clicked on a checkbox and set the state to checked only, if so, I launch osk.exe ) : If Not (ProcessExists("osk.exe")) And GUICtrlRead($checkbox_DataAuditUtente) = $GUI_CHECKED Then Local $iEsitoAvvioTastiera = ShellExecuteWait($sFileTastieraVirtuale If $iEsitoAvvioTastiera == 0 Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'avvio della tastiera virtuale." & @CRLF & "Errore: " & @error) Exit EndIf EndIf Any suggestions? Thanks Edited May 8, 2017 by FrancescoDiMuro Some code :) Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Subz Posted May 8, 2017 Share Posted May 8, 2017 This works for me: If @OSArch = "x64" Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection ShellExecute("osk.exe") DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection EndIf Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 8, 2017 Author Share Posted May 8, 2017 Hey @Subz, thank you for your reply! Thanks for the code, I'll try it now But, why Windows or the script should do a redirection? Thanks Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Subz Posted May 8, 2017 Share Posted May 8, 2017 Basically you're trying to run 64 bit application from 32 bit compiled script, you could of course just compile your script as 64 bit but if you want to target both architectures you would need to have two separate scripts i.e. 32 bit compiled and 64 bit compiled. Using the above method will allow you to target both architectures from a single script, of course you'd need to add an else to the end of the code above with just "ShellExecute("osd.exe") for 32 bit systems. Hope that made sense. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 8, 2017 Author Share Posted May 8, 2017 (edited) So, If I understood correctly, osk.exe is a 64 bit application, and I'm trying to run it from AutoIt, that, by default, compile the script for 32 bit OS architectures. That makes the mess? Thanks for your explanation again EDIT: By the way, the code you posted doesn't work for me :/ This is my code: ; Checking for OS Arch If @OSArch = "X64" Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection EndIf ; When the user exit the application, I set the Wow64 redirection to 0 Func ChiudiApplicazione() AdlibUnRegister("GestioneCampiGUI") DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection Exit EndFunc Edited May 8, 2017 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 8, 2017 Moderators Share Posted May 8, 2017 It's best to provide a reproducer script that can actually run on someone else's pc. Your code above doesn't even show you calling "osk.exe". Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 9, 2017 Author Share Posted May 9, 2017 Good morning everyone Sorry for not provided my script... Here you are Select Case @GUI_CtrlId = $checkbox_DataAuditUtente GUICtrlSetState($date_DataAuditUtente, $GUI_FOCUS) If Not (ProcessExists("osk.exe")) And GUICtrlRead($checkbox_DataAuditUtente) = $GUI_CHECKED Then Local $iEsitoAvvioTastiera = ShellExecuteWait($sFileTastieraVirtuale) If $iEsitoAvvioTastiera == 0 Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'avvio della tastiera virtuale." & @CRLF & "Errore: " & @error) ;~ Exit EndIf EndIf With this code, plus the one in the post #5, I still can't run the "osk.exe"... Thanks everyone Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Subz Posted May 9, 2017 Share Posted May 9, 2017 If you use the code above in a new script does it work? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 9, 2017 Author Share Posted May 9, 2017 (edited) @Subz Yes, it works in a new script EDIT: This code: #include <MsgBoxConstants.au3> If @OSArch = "x64" Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection ShellExecute("osk.exe") DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection EndIf Edited May 9, 2017 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 9, 2017 Author Share Posted May 9, 2017 @Subz I've managed to do that Thanks everyone for the help! Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
hmxdenis Posted May 7, 2019 Share Posted May 7, 2019 Hello I hawe car-pc end I wont to run automatical the osk when input text cursor blink, end exit osk aftre some inactivity blink time While 1 $cursor = MouseGetCursor() If $cursor = 5 or $cursor = 0 Then ShellExecute('"C:\Windows\******\osk.exe"') Sleep(750) WEnd Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 7, 2019 Author Share Posted May 7, 2019 @hmxdenis Please don't ask multiple questions; stick to one thread only. Are you trying to automate a specific application in which you want to run "osk.exe", or is a more generic question? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
hmxdenis Posted May 8, 2019 Share Posted May 8, 2019 popup osk on text input focus,when input blink popup osk on text input like on android smartphone Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 8, 2019 Author Share Posted May 8, 2019 (edited) @hmxdenis Take a look at this link Edited May 8, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
rudi Posted May 13, 2019 Share Posted May 13, 2019 Hi, i've faced the exactly same issue as well some time ago. To check for the OSARCH only doesn't help, you also have to evaluate, if the script is compiled to 32 or 64bit app. Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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