我有一个.js选择一些文本并启动一个C#程序将所选文本解析为Main()作为参数。我想知道是否存在.js可以将文本解析为Winform程序的现有实例。例如,将所选文本显示在富文本框中。
这是我目前的实施:
<script type="text/javascript">
function getSelectionText(input) {
var text = "";
if (input.getSelection)
{
text = input.getSelection().toString();
}
else if (input.document.selection && input.document.selection.type != "Control")
{
text = input.document.selection.createRange().text;
}
return text;
}
var extInput = external.menuArguments;
var selected = getSelectionText(extInput);
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "MyFileLoc";
oShell.ShellExecute(commandtoRun,"\""+selected+"\"","","open","1");
</script>