This HTML file contains VBScript to create a file called MTSCMD.TXT which contains a command to be executed by WebSync. My-T-Soft 1.70 with the Developer's Kit installed, along with WEBSYNC.EXE, EDITPAGE.HTM, and OVERVIEW.HTM copied into the \WINDOWS\MYTSOFT folder will be required for this example to operate without modifications (Windows 95/98/Me). WebSync must be running, and it requires the My-T-Soft window to be available! You will want your security level set to allow scripts to run.
You will want to edit the script function CreateAFile??? to execute the appropriate DevKit command to manipulate the My-T-Soft/My-T-Touch/My-T-Pen window as desired.
This example uses the MoveWindow (MOVEWMTS) command.
To return to the Edit Page, click here.
Overview
VBScript is a common scripting language for web pages - it has many Visual Basic commands, along with a strong support for file manipulation. Because of security concerns, a client based Execute to directly run a client based program outside the web browser is not readily available. Because kiosk, thin-client, and other developer's can create a straightforward and effective application using only a web browser, there is a need to gain access to the My-T-Soft Developer's Kit directly from a web page.
The VBScript language can easily accommodate the task of creating a file. The method used to accomplish the task of manipulating the keyboard from the web page is done as follows:
- When a page is loaded, the VBScript is run - in these examples it just calls a function that is defined in the script.
- The function creates a file in the default installation folder for My-T-Soft (3 function examples are included, 1 each for My-T-Pen, My-T-Touch, and My-T-Soft)
- WebSync monitors for the MTSCMD.TXT file based on its delay - see below for details on WebSync
- If the My-T-Soft/My-T-Touch/My-T-Pen window is found (FindWindow), and the file exists (FindFirstFile MTSCMD.TXT), then the file is read, and the first line is read in, then passed to CreateProcess to launch.
This effectively gives direct access to the web page developer to the My-T-Soft Developer's Kit. This does assume the Developer has control of the client machines (which is true in the case of kiosks and thin-clients, and other controlled application rollouts). This, of course, would also work for any client system that has the appropriate set of software available.
VBScript
The following is a sample function - (review this page's source for exact details on syntax)
Sub CreateAFileMTS
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\windows\mytsoft\mtscmd.txt", True)
MyFile.WriteLine("c:\windows\mytsoft\devkit\movewmts.exe x:3000 y:360")
MyFile.Close
End Sub
In script mode, the function is called.
- The FileSystemObject is created to allow access to its properties & methods. (CreateObject) (Note: No error handling is done)
- A file is created (CreateTextFile) - the MTSCMD.TXT name is required, as WebSync monitors for this file name.
- The appropriate Developer's Kit command is written to MTSCMD.TXT with WriteLine)
- The file is closed.
VBScript Notes - required changes for different situations
- If you are running on Windows NT / 2000, you will need to change the \windows folder to the \winnt folder in the function definitions
- If you are running My-T-Pen, change the function called to CreateAFileMTP
- If you are running My-T-Touchn, change the function called to CreateAFileMTT
WebSync
WebSync runs and places an icon in the Taskbar Tray (ShellNotifyIcon). You can configure WebSync to open without the splash screen. Run Internet Explorer in kiosk mode (iexplore -k) to hide the various windows components.
WebSync must be run from the same location where the MTSCMD.TXT file will be saved from the VBScript portion. You can view the About option for the current location monitored by WebSync.
- WebSync Menu options
- Enabled - this toggles the monitoring of the file MTSCMD.TXT - a check mark in the menu indicates that WebSync is Enabled and will monitor for MTSCMD.TXT
- Opening Splash - this toggles whether the opening splash screen is displayed or not - a check mark in the menu indicates that the splash screen will appear when WebSync is run
- Delay - this opens a sub-menu with various delay times - depending on the system & speed of web page loads and desired operation, select the appropriate delay time between monitoring for the MTSCMD.TXT file.
- About - this displays an about message box, and also includes which folder is being monitored for the file MTSCMD.TXT
- Close - this ends the WebSync program and saves the Delay, Opening Splash setting, and Enabled setting.
- WebSync Logic
- The delay determines how often the timer triggers
- The Timer code checks the Enabled flag
- If Enabled, the code checks for the existence of the My-T-Soft/My-T-Pen/My-T-Touch window
- If Enabled, FindWindow is TRUE, then FindFirstFile is called. The module path for WebSync is used, so it will only look in the directory where WebSync is run from.
- If Enabled, FindWindow is TRUE, and FindFirstFile succeeds on MTSCMD.TXT, then the MTSCMD.TXT is read in (maximum 1000 characters)
- The read in file is searched for the first carriage return character ('\r', chr(13)), and the string is ended at that character.
- This "command" string is passed off to WinExec (CreateProcess)
- The file is deleted.
- WebSync continues on waiting for another MTSCMD.TXT file.
Other Notes
The WebSync program creates the link from a file created by the VBScript script in a web page and the My-T-Soft Developer's Kit.
WebSync itself does not care anything about the command - it just passes it off to the Windows API call. Any valid command supported by CreateProcess will work, along with command line parameters. Note the carriage return (ANSI character 13) character cannot be part of the command, since this is seen as the end of the command line.
In general, specifying the exact path in the VBScript and in the command saved in MTSCMD.TXT is preferred.
Knowledge of the Developer's Kit is assumed. Note you can have different configurations available by saving them and then using the CPYCNMTS.EXE to display the various configurations.
To "hide" the keyboard, moving to X:3000 is done in the VBScript. Moving the window off-screen is the preferred way to remove it from the end-user. Closing or Minimizing can create other issues - to remove the keyboard from the user, move it off screen. Move it back on-screen with MOVEWMTS, or load a new configuration with CPYCNMTS.
Troubleshooting
Proper Operation: The My-T-Soft keyboard will appear when the Edit page is displayed in the browser (EDITPAGE.HTM), and disappear when the overview page is displayed (OVERVIEW.HTM)
If you don't see this operation, check the following items:
- The My-T-Soft (or My-T-Pen/My-T-Touch) window must be open - run My-T-Soft/My-T-Touch/My-T-Pen, configure to size 8 or 9, and have the keyboard open. Make sure it is not minimized!
- You must have the security settings in the browser to allow scripts to run
- You should probably be on IE 4 or higher - pages tested on IE 5.
- Review the functions in the VBScript (edit the HTM files directly) - you can check to see the location where the MTSCMD.TXT file is created. Use Windows Explorer to verify the file is being created. You can also view the file directly in NOTEPAD.
- WebSync must be running and Enabled - review WebSync logic above to determine possible problems. Also check Delay.
- Developer's Kit must be installed, or the appropriate command file must be in the specified location. You can modify the VBScript and test with a Windows program like NOTEPAD.EXE to verify the process is working.
- As suggested in the IMG Developer's Corner, use a windowed command prompt to test Developer's Kit utilities (pre-compiled executables).
- Use the concepts here and write your own "WebSync", or create your own process & approach to using the Developer's Kit.
To return to the Edit Page, click here.
Copyright (c) 2001 by Innovation Management Group, Inc. All rights reserved.
My-T-Mouse, My-T-Pen, My-T-Soft, and My-T-Touch are registered trademarks of Innovation Management Group, Inc.