turtlepopupmaster
Version:
eaisily create popups!
30 lines (25 loc) • 928 B
JavaScript
// index.js
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
/**
* Creates and runs a VBScript file with a MsgBox.
* @param {string} message - The message to display in the MsgBox.
* @param {string} title - The title of the MsgBox.
* @param {number} type - The type of MsgBox (e.g., 0 for OK button only).
*/
function createAndRunVBS(message, title, type = 0) {
const vbsContent = `MsgBox "${message}", ${type}, "${title}"`;
const filePath = path.join(__dirname, 'message.vbs');
// Write the VBScript file
fs.writeFileSync(filePath, vbsContent);
// Execute the VBScript file
exec(`cscript //nologo "${filePath}"`, (error, stdout, stderr) => {
if (error) {
console.error(`Error executing VBScript: ${error.message}`);
return;
}
console.log(stdout || stderr);
});
}
module.exports = { createAndRunVBS };