ruanm-popup
v1.0.2
Published
将alert/confirm/prompt转换为VBScript的MsgBox/InputBox
Maintainers
Readme
ruanm-popup
将浏览器的 alert、confirm 和 prompt 函数转换为 Windows 系统的 VBScript MsgBox 和 InputBox。
功能特性
alert(message, title): 显示一个提示对话框
message: 对话框显示的消息title: 对话框标题,默认为 "提示"
confirm(message, title, icon, buttons): 显示一个确认对话框,返回布尔值
message: 对话框显示的消息title: 对话框标题,默认为 "确认"icon: 图标类型,默认为 16(警告图标)buttons: 按钮类型,默认为 1(确定按钮)
prompt(message, defaultValue, title): 显示一个输入对话框,返回输入值或 null
message: 对话框显示的消息defaultValue: 默认输入值,默认为空字符串title: 对话框标题,默认为 "输入"
安装
# 使用 npm
npm install ruanm-popup
# 使用 pnpm
pnpm add ruanm-popup
# 使用 yarn
yarn add ruanm-popup使用示例
const { alert, confirm, prompt } = require('ruanm-popup');
// 显示提示对话框
alert('Hello, World!');
// 显示确认对话框
const isConfirmed = confirm('你确定要执行此操作吗?');
console.log('用户选择:', isConfirmed);
// 显示输入对话框
const name = prompt('请输入你的名字:', '默认名字');
console.log('用户输入:', name);注意事项
- 此包仅在 Windows 系统上工作,因为它依赖于 VBScript
- 调用函数时会创建临时 VBScript 文件并执行,执行完成后会自动删除
- 支持的系统:Windows XP 及以上版本
作者
RuanMingze
许可证
MIT
