FrancescoDiMuro

Can't start osk.exe...

10 posts in this topic

#1 ·  Posted (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 by FrancescoDiMuro
Some code :)

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites



#2 ·  Posted

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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

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

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#4 ·  Posted

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.

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#6 ·  Posted

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.

Share this post


Link to post
Share on other sites

#7 ·  Posted

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

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#8 ·  Posted

If you use the code above in a new script does it work?

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#10 ·  Posted

@Subz

I've managed to do that :)

Thanks everyone for the help! :* 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
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

  • Similar Content

    • czardas
      By czardas
      I can never remember the extended ascii codes and I find it tedious keep having to look them up, select them and then having to copy and paste them. So I decided to design an extended ascii virtual keyboard.



      The layout is intended to be intuitive with numeric keys at the top, alphabetic keys on the left, puntuation in the middle and various other symbols appearing to the right. Keys can not be held down since the virtual keyboard needs to lose focus in order to interact with other windows.

      The method used is an adaptation of the method used by Info in the following topic:

      Reading Info's thread saved me some time, and credit must also go to the MvPs who contributed to that project.

      Not all extended ascii characters are included. Four of the keys on the left act as letter modification locks which effect the letters a, e, i, o, u and y. If you wish to type the actual character displayed on one of the modifier keys, you must press the shift key on your main computer keyboard. To type capital letters you can use the shift key or the caps lock key on your main keyboard.

      PROBLEMS POSTING THE LATEST CODE
      The latest code did not display as intended, since the forum software is confusing part of my my code for html. The html entites are displaying as characters and not as code. You need to download the zip file below to view the source. The zip also includes the compiled script, image resources and READ ME.txt which contains important information.

      This script is a spin off from a bigger project, so I have only developed it to the point where it became a functional tool. I don't intend to take the development of this much further, unless by request; however I will most likely use the keypad design layout for other projects in the future.

      Change Log 01 Dec 2011




      Change Log 31 Jan 2012




      Change Log 10 Feb 2012 (including modifications to Melba23's code)




      Change Log 05 Jan 2013





      Download the latest version of win-1252.
      win-1252v1.4.zip
      SHA-1 0C03C570A45386FBA9C4ADB0AD030DFB7D699614
      Previous downloads 116

      by Melba23 are now included in the zip file. I have slightly modified M23's UDF, but this change isn't a requirement. See Change Log 10 Feb 2012 above.