0

I am building a web application program that will be used on touchscreen computers. The files are hosted locally. The computers are Windows 10 and are managed by me so any changes can be made on them if necessary.

The first task I need help with is opening an application from Firefox, most likely through JavaScript.

I want to open the Windows On Screen Keyboard when a text input gets focused and close it when it loses focus.

I do not want to use a library keyboard because these cannot interact with alerts, prompts, and sweetalert2 alerts which is what I will be using.

Like I said, I have full control to add any application or extension. These will need to work with Firefox however as it is the only browser which allows me to print automatically without showing any sort of prompt, preview, or dialog box which is very important for my project.

Everything that I have found is very old...I tried several things and none seem to work.

Thanks in advance for any contributions and advice you can shed.

Tim
  • 65
  • 7
  • Javascript doesn't have access to the computer's hard drive for security reasons. You can't launch or close programs with it. It _might_ be possible with a browser extension, but you'd probably need one custom made for that. Easiest (imho) is probably to just run a local server and use some server side script to launch and close the program, as server side scripts do have access to this. All you'd need to do is use Ajax to tell the server side script to launch / close the program with the focus events etc. – icecub Aug 24 '21 at 19:43
  • That is interesting. I could run a local server. Do you know how I could open or close the files with PHP? Its the only server side stack that I know. I am currently using XAMPP – Tim Aug 24 '21 at 19:46
  • If you use Touchdevices, the on screen keyboard should open when you enter a textfield/textbox, with php you can use [exec](https://www.php.net/manual/en/function.exec.php) to run commands – Marc Aug 24 '21 at 19:49
  • The touchscreen OSK opens for smaller tablets like the surface but large all in one computers they do not because they generally have a keyboard attached. – Tim Aug 24 '21 at 19:57
  • You will want to use [proc_open](http://php.net/manual/en/function.proc-open.php) for this and not `exec`. Since you also need to be able to close the program again. With exec, you'd have to do some weird wizardry to get the process id and use [posix_kill](https://www.php.net/manual/en/function.posix-kill.php) to be able to close it again. If you use `proc_open` instead, you can simply monitor it and use [proc_close](https://www.php.net/manual/en/function.proc-close.php) or [proc_terminate](https://www.php.net/manual/en/function.proc-terminate.php) – icecub Aug 24 '21 at 20:03
  • You'll probably find some useful code in the second answer here too: https://stackoverflow.com/questions/1470910/invoke-external-shell-script-from-php-and-get-its-process-id – icecub Aug 24 '21 at 20:09

0 Answers0