Why Won't Ignition's Touchscreen Keyboard Show on Save?

Karen Mitchell7 min read
HMI / SCADAOther ManufacturerTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

On a keyboardless panel PC, system.dataset.exportCSV() opens a Save dialog that the operator cannot type into. system.gui.showTouchscreenKeyboard() cannot be placed anywhere in the script that makes it feed that dialog. Collect the filename with the touchscreen keyboard first, then write the file with system.file.writeFile() and skip the dialog. Launching the Windows On-Screen Keyboard (osk.exe) alongside the dialog works on Windows 7 panels. It is unreliable on Windows 10 panels.

Why does the keyboard never reach the Save dialog's filename box?

When the export button is pressed, the operator sees a standard Save window with a filename field and no way to type in it. Both script functions open their own modal dialog on the client's GUI thread:

  • system.gui.showTouchscreenKeyboard(initialText [, fontSize] [, passwordMode]) blocks until the operator presses Enter or cancels, then returns a string to the script. It does not type into whatever window has focus.
  • system.dataset.exportCSV(filename, showHeaders, dataset) opens a file chooser, blocks until the operator confirms or cancels, then returns the chosen path. It returns None on cancel.

A keyboard called before exportCSV closes before the chooser appears. A keyboard called after it runs only once the chooser is already gone. While one modal dialog is waiting, the script cannot open the other. That is why the keyboard appears to be "pre-empted" by the save dialog. The Ignition keyboard is a value-returning prompt, not a system-wide input device. The fix is to change where the filename comes from, not to reorder the calls.

Check 1: Does the operator actually need to choose the folder?

Answer this before touching any code. It decides which branch you take.

Requirement Approach Keyboard source Next check
Fixed export folder, operator names the file Prompt with showTouchscreenKeyboard, write with system.file.writeFile Ignition, works on any OS Go to the rewrite procedure
Fixed folder, operator types the name into a screen field Text Field bound to the filename, button writes the file Ignition touch-mode keyboard on the field Go to the rewrite procedure
Operator must browse drives or folders Keep exportCSV/file chooser and open an OS keyboard next to it Windows osk.exe Go to Check 2

Two configurations avoid the dialog, and both work. Prefer the Text Field version on production panels. The operator sees the proposed name on screen before pressing Save. The field can hold a timestamped default, and there is no popup sequence to get stuck in.

The Text Field version depends on touch mode:

  • Enable touch screen mode in the Vision client project properties (User Input section).
  • Set the Text Field's touchscreen mode property so a tap opens the keyboard.

If tapping the field does nothing, that is a configuration fault, not a script fault.

Check 2: Does osk.exe start from the client on this panel?

This check applies only if the operator must browse folders. The workaround launches the Windows keyboard when the button is pressed and kills it after the export:

# mousePressed
import os
os.popen("osk.exe")

# end of actionPerformed, after the export
os.popen('taskkill /IM osk.exe')

This works on Windows 7 and fails on Windows 10. Diagnose it on the panel itself:

  1. Open Run (Win+R) and enter osk.exe.
    • If the keyboard does not open, the OS image or a group policy blocks it. Fix that at the Windows level; nothing in Ignition will help.
    • If it does open, continue to step 2.
  2. Check the bitness of the Java runtime that runs the Vision client against the OS bitness.
    • A 32-bit process on 64-bit Windows has System32 redirected to SysWOW64, where osk.exe is typically absent.
    • Launch C:\Windows\Sysnative\osk.exe from the 32-bit client, or run the client on a 64-bit runtime.
  3. Replace os.popen with system.util.execute(["osk.exe"]) (or the Sysnative path). This makes the launch non-blocking and keeps it in Ignition's scripting API.
  4. If the keyboard opens but taskkill leaves it on screen, the kill is being refused by Windows. Leave the keyboard open and let the operator close it, rather than escalating client privileges.

If any step fails and cannot be fixed at the OS level, drop back to the no-dialog branch. It has no OS dependency.

How do I replace exportCSV's dialog with a keyboard prompt?

  1. Choose the export folder. Store it in a client tag or a custom property on the window rather than hard-coding it. The C:\\Exports path below is a placeholder.
  2. Replace the button's actionPerformed script with:
import system, datetime

table = event.source.parent.getComponent("Table")
now = datetime.datetime.now()
defaultName = now.strftime("%d%m%Y_%H%M%S") + "_stroj_avtomatsko"

name = system.gui.showTouchscreenKeyboard(defaultName)
if name:
    name = name.strip()
    for ch in '\\/:*?"<>|':          # strip characters Windows rejects
        name = name.replace(ch, "_")
    if not name.lower().endswith(".csv"):
        name = name + ".csv"

    exportDir = "C:\\Exports"        # placeholder - use a client tag/custom property
    path = exportDir + "\\" + name

    ok = True
    if system.file.fileExists(path):
        ok = system.gui.confirm("Overwrite " + path + "?", "File exists")

    if ok:
        csv = system.dataset.toCSV(table.data, 1, 0)
        # decimal comma: switch field delimiter first so columns do not split
        csv = csv.replace(",", ";").replace(".", ",")
        system.file.writeFile(path, csv)
        system.gui.messageBox("Saved: " + path)
  1. For the Text Field variant, delete the showTouchscreenKeyboard line. Read the name from the field instead, for example event.source.parent.getComponent("FileName").text. Keep everything from the character stripping down unchanged.

Which script faults break the rewritten export?

Symptom on screen Cause Fix
Syntax error when the button is pressed Curly quotes (“ ”, ’) copied in from a document or web page Retype every quote as a straight " or '
NameError or syntax error on the line containing "capture the table" Comment lines that have lost their # Restore # on every comment line
Columns shifted when the CSV is opened Replacing . with , in a comma-delimited file creates extra fields Switch the delimiter to ; before converting decimals, as in the script above
Timestamps or text altered in the file The blanket . replacement also changes non-numeric columns Format numeric columns individually if text or dates contain periods
Nothing written and no message shown Operator cancelled the keyboard, or the name was empty Expected behavior: the if name: guard stops the export
Error on writeFile Folder missing, or the Windows account running the client cannot write to it Create the folder and grant write permission to the account that runs the client

system.file.writeFile runs in the client. The path is local to the panel PC, not to the Gateway. A network share must be reachable from the panel under the account that runs the client.

How do I confirm the export works on the panel?

  1. Launch the client on the panel PC itself, not in the Designer on a workstation. Keyboard and touch behavior differ there.
  2. Press the export button.
    • The Ignition keyboard (or the tapped Text Field) should show the timestamped default name.
    • No Windows Save dialog should appear.
  3. Accept the default name.
    • A "Saved:" message should show the full path.
    • Open the Designer console or client diagnostics console and check that no script error was logged.
  4. Press the button again with the same name. The overwrite confirmation must appear.
    • Answer No and check that the file's modified time did not change.
  5. Press the button and cancel the keyboard. No file should be written.
  6. Open the CSV in the spreadsheet application used downstream, with the locale set to decimal comma. Every row should have the same column count as the Table component. Numeric values should read with comma decimals, and the header row should be present.

FAQ

Why does system.gui.showTouchscreenKeyboard not appear over the file save dialog?

Both the keyboard and the exportCSV chooser are modal dialogs that block the script. The keyboard also returns its text to the script instead of typing into another window. Call the keyboard first, then write the file with system.file.writeFile instead of opening a chooser.

Why does osk.exe open from an Ignition client on Windows 7 but not on Windows 10?

First test osk.exe from the Run dialog. If it opens there, the client is probably a 32-bit process being redirected away from System32. Launch C:\Windows\Sysnative\osk.exe through system.util.execute, or run the client on a 64-bit runtime.

Why does my CSV have extra columns after replacing periods with commas?

The file is comma-delimited, so every decimal comma becomes a new field separator. Replace the , delimiter with ; before converting . to ,, then check that every row's column count matches the Table.

Back to blog