Jump to content

Can't start osk.exe...


Recommended Posts

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 by FrancescoDiMuro
Some code :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

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

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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

  • Moderators

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

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:

 

Link to comment
Share on other sites

@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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

  • 1 year later...

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

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

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

×
×
  • Create New...