Send text with Esc key
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Send text with Esc key
Hi, The script below is working properly. But i am looking for a way, that the text in the text-field is written to Text.txtwhen the escape key (Esc) is pressed, instead of clicking the Send button. Any help will be highly appreciated._____________________________________________<Script Language="VBScript">Dim fso, oFileSet fso = CreateObject("Scripting.FileSystemObject")Set objShell = CreateObject("WScript.Shell")Sub WriteSet oFile = fso.OpenTextFile("Text.txt",8,true)sTxtArea = document.all("TxtArea").ValueoFIle.Write sTxtAreaMsgBox "The text has been added to Text.txt", 64oFile.closeEnd Sub</SCRIPT><TextArea style="Height:200;Width:400;font-Size:12;color:Black;background-color:bisque;font-weight:Normal;font-family:Microsoft Sans Serif"Name=TxtArea TabOrder=2 Wrap=off></TextArea><!--I would like to change the following line, so that the text is written to Text.txt when the Esc key is pressed--><input type="Button" value="Send" onclick="Write">_____________________________________________Regis
Send text with Esc key
Hi, The script below is working properly. But i am looking for a way, that the text in the text-field is written to Text.txtwhen the escape key (Esc) is pressed, instead of clicking the Send button. Any help will be highly appreciated._____________________________________________<Script Language="VBScript">Dim fso, oFileSet fso = CreateObject("Scripting.FileSystemObject")Set objShell = CreateObject("WScript.Shell")Sub WriteSet oFile = fso.OpenTextFile("Text.txt",8,true)sTxtArea = document.all("TxtArea").ValueoFIle.Write sTxtAreaMsgBox "The text has been added to Text.txt", 64oFile.closeEnd Sub</SCRIPT><TextArea style="Height:200;Width:400;font-Size:12;color:Black;background-color:bisque;font-weight:Normal;font-family:Microsoft Sans Serif"Name=TxtArea TabOrder=2 Wrap=off></TextArea><!--I would like to change the following line, so that the text is written to Text.txt when the Esc key is pressed--><input type="Button" value="Send" onclick="Write">_____________________________________________Regis
Send text with Esc key
The code works every time you press the escape key. The 'body' element has to hav an id so the keystrokes are caught by the code and filtered.
There is NO html that can do what you ask. It MUST be done in script.
The native language of an HTA is VBScript but you can convert it to JavaScript if you know hoew to use JavaScript event capture.
To filter for a single keystroke the event has to be on the body element.
If the code is not working you copied it wrong. Just place the code inside of a file with an HTA extension and execute the file.
There is NO html that can do what you ask. It MUST be done in script.
The native language of an HTA is VBScript but you can convert it to JavaScript if you know hoew to use JavaScript event capture.
To filter for a single keystroke the event has to be on the body element.
If the code is not working you copied it wrong. Just place the code inside of a file with an HTA extension and execute the file.