创建批处理框架? [英] Creating a frame in Batch?

查看:147
本文介绍了创建批处理框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,是否有可能创建一个框架,如批量一个JFrame?如果是的话我真的很想知道如何让我写程序会更好看。我知道,是的JFrame的Java,我给它作为例子,但是否真的有可能创造一些批处理类似于一个JFrame ??

I was wondering, is it possible to create a frame such as a JFrame in Batch? If so I'd really like to know how so that the program I am writing will look better. I'm aware that JFrame is for java, I was giving that as an example, but is it really possible to create something that resembles a JFrame in Batch??

推荐答案

希望你会发现这个答案更令人满意的:

Hope you'll find this answer more satisfying:

mshta "about:<button type='button' onclick='alert("clckd!")'>clck here</button>"

rem bat file version
mshta "about:<img src='http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%%2C_by_Leonardo_da_Vinci%%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%%2C_by_Leonardo_da_Vinci%%2C_from_C2RMF_retouched.jpg'>"

rem paste in command prompt
mshta "about:<img src='http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg'>"

您可以创建 HTA直接在命令行/ bat文件。虽然它有很大的局限性也可以是有用的。

You can create HTA directly from command line / bat file. Though it has a lot of limitations it can be useful.

修改

更多的例子(它们保存为的.bat 文件):

more examples(save them as .bat files):

1.Submit密码:

1.Submit password:

@if (@X)==(@Y) @end /*JScript comment
@echo off
mshta "about:<body onload='prepare()'><script language='javascript' src='file://%~dpnxf0'></script><input type='password' name='pass' size='15'></input><hr><button onclick='pipePass()'>Submit</button><body>" |findstr "^"
exit /b 0

**/

function prepare(){
    //document.write("<input type='password' name='pass' size='15'></input><hr><button onclick='pipePass()'>Submit</button>");
}

function pipePass() {
    //alert("blabla");
      var pass=document.getElementById('pass').value;
      var fso= new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
      close(fso.Write(pass));

}

2。选择一个文件

2.Select a file

@if (@X)==(@Y) @end /*JScript comment
@echo off
mshta "about:<body onload='prepare()'><script language='javascript' src='file://%~dpnxf0'></script><input type='file' name='file' size='30'></input><hr><button onclick='pipeFile()'>Submit</button><body>" |findstr "^"
exit /b 0

**/

function prepare(){

}

function pipeFile() {

      var file=document.getElementById('file').value;
      var fso= new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
      close(fso.Write(file));

}

3。选择按钮:

3.Choose button:

@if (@X)==(@Y) @end/*JScript comment
@echo off
mshta "about:<title>chooser</title><body onload='prepare()'><script language='javascript' src='file://%~dpnxf0'></script><span id='container'>buttons:</span></body>" |findstr "^"
exit /b 0

**/

function clckd(a){
     // alert(a);
    var fso= new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
     ;
    close(fso.Write(a));
}

function prepare(){
    var element1 = document.createElement("input");
    element1.setAttribute("type", "button");
    element1.setAttribute("value", "yes");
    // this will not work on IE or MSHTA
    //element1.setAttribute("onclick", "clckd('yep');");
    element1.onclick= function() {clckd('yep');};

    var element2 = document.createElement("input");
    element2.setAttribute("type", "button");
    element2.setAttribute("value", "no");
    // this will not work on IE or MSHTA
    //element2.setAttribute("onclick", "clckd('nope');");
    element2.onclick= function() {clckd('nope');};


    var container = document.getElementById('container');
    container.appendChild(element1);
    container.appendChild(element2);

    //alert(document.getElementById('container').innerHTML);    
}

这篇关于创建批处理框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆