Open ramarivera opened 5 months ago
Now this is fun lol
If I use instead
async function showNotificationUsingPowershell(message: string) {
const script = `Add-Type -AssemblyName System.Windows.Forms
$notifyIcon = New-Object System.Windows.Forms.NotifyIcon
$notifyIcon.Icon = [System.Drawing.SystemIcons]::Information
$notifyIcon.BalloonTipIcon = 'Info'
$notifyIcon.BalloonTipText = '${message}'
$notifyIcon.BalloonTipTitle = 'Notification'
$notifyIcon.Visible = $true
$notifyIcon.ShowBalloonTip(10000)`;
const results = await term({
command: script,
shell: "powershell.exe",
});
console.log("RESULTS", script, results);
}
it does open powershell, but it executes the lines in the inverse order 🙃 e.g. $notifyIcon.ShowBalloonTip(10000)
first
Try await exec(script, { shell: 'powershell' })
for powershell, and the builtin notify
helper for native notifications. It uses https://www.npmjs.com/package/node-notifier under the hood
Yeah the notifications wwere just a random example, because I needed something very bright and loud, akin to a console.log
:D
I have the following simple script
However when I execute it, it tries to use bash, even tho I told it to use powershell and can see in the dev console that $.shell is set to powershell.
What am I doing wrong? 😢