Javascript - 将文件路径放入HTA [英] Javascript - getting path of file dropped into HTA

查看:398
本文介绍了Javascript - 将文件路径放入HTA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个个人使用的HTA,并希望能够将文件拖放到界面。一旦文件被删除,我将自动运行它(假设它适合我设置的一些参数,如文件扩展名),或至少填写HTA界面上的输入框。



我广泛搜索过,但找不到解决方案。想法?

解决方案

HTA显然不能成为shell drop操作的目标–至少在我的系统上,在HTA上放下东西是不可能的。



这意味着你不能直接做你想要的。 >

然而,.vbs可以是放下目标。删除的文件的完整路径可通过 WScript.Arguments.Unnamed 集合获取。



HTA可以访问它的命令行参数通过命令行属性。这意味着您可以构建一个小帮手VBScript,将删除的文件转换为命令行,并为您调用HTA。



请注意,您不能在.vbs上放下无数量的文件,命令行也不会无限制。在几kB的区域将有一个长度限制(我没有试图找到确切的限制,只是准备面对极限。)


I am building a little HTA for personal use, and would like to be able to drag and drop a file to the interface. Once the file is dropped, I would either automatically run it (assuming it fits some parameters I set, like file extension), or at least fill in the input box on the HTA interface.

I've searched extensively, but can't find a solution. Thoughts?

解决方案

An HTA obviously cannot be target of a shell drop operation – at least on my system, dropping something on an HTA is impossible.

This would imply you cannot directly do what you intend.

A .vbs can however be a drop target. Full paths of the dropped files are available via the WScript.Arguments.Unnamed collection.

HTA has access to it's command line arguments via the commandLine Property. This would mean you could build a small helper VBScript that translates the dropped files into a command line and calls the HTA for you.

Note that you cannot drop endless amounts of files on a .vbs, and command lines are not unlimited either. There will be a length limit in the area of a few kB (I have not tried to find where exactly the limit is, just be prepared to face a limit.)

这篇关于Javascript - 将文件路径放入HTA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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