Disable the X button on a message box - vbscript

I'm working on a VBScript program, and I don't know how to disable the X button on a message box. Can you please help me?

Short answer: You basically can't. However...
If you use the VbOkOnly option or Popup function in place of MsgBox, when the user clicks on X this should be interpreted as clicking OK. The execution of the script will be continued.
Click here for more info..

As #Daniel Cook said, you could make an HTA as your message box. (Even though I haven't been using HTA for a while).

Related

Dialog Box Using VB Script

Hello I have some knowledge about VB Script, but i need some help so that it will help me to move further and study in VB Script.
I want to make dialog box which will contain :
Two radio button
one Text field to enter some value
OK and CANCEL button
so, could you please help me out?
VBScript doesn't support custom dialogs. You can either use the Internet Explorer COM object to emulate a dialog, or create an HTA. Either way you're building a web page with a form.

disable message box for programs that was run from cmd

I have util which at the end of it's work shows message box with notification and OK button. I run it under command line and would like to disable all message boxes that can break my process and require user reaction. Does any way to accoplish this task?
I would recommend just adding a --quiet command line switch instead, so users have better control over this kind of thing.
If you want to try to do it automatically, you can check the parent PID right when your app launches, and see if it's cmd.exe. Of course this is not 100% accurate because there are more scenarios where users don't want user interaction.
Well... you could use VBScript to automatically click or press ENTER on the messagebox. But you'll need to know the window name or number of the messagebox.
This code will bring focus to a Window called MESSAGEBOXNAME, and the press ENTER.
Set oShell = CreateObject("WScript.Shell")
oShell.AppActivate("MESSAGEBOXNAME")
WScript.Sleep 500
oShell.SendKeys "~"
Where MESSAGEBOXNAME is the Window Name of the MessageBox, that should be in the upper right corner of the messagebox.

Is it possible to remove window by clicking button?

I am writing an app in which i want a WelcomeWindow.
WelcomeWindow contain some Text , CheckBox Button (with text- Don't want this message again) and one Ok button.
What i want is when my CheckBox state is On like ([checkBox state ]== NSOnState) and if i press Ok button then this WelcomeWindow should be close and
it won't be open again even if i Quit the app and then again run the app.
Is it possible in mac app ?
Any help will be appreciated.
Thanks in advance!!
Yes, Of course. You need to save an info that your app did already pass the welcome window. For instance NSDefaults or Sqlite. It can be stored as a boolean value. Then you just ask for that value in the beginning to display or not display mentioned window.

Task Scheduler - Show me a message when I lock my computer

Here's what I need to happen:
When I leave the office for the day, I lock my computer. We're supposed to fill out our timecards before leaving. I always forget to do it. I want a message to be displayed when I attempt to lock my computer asking me if I've filled out my timecard.
Here's what I've done, and why it doesn't work:
I created a task under Task Scheduler with action = "Display a message" and trigger = "On workstation lock". The problem with this is the task doesn't run until the workstation is literally locked and I don't see the message until I log back in again, which is pointless.
How can I do this so immediately after I press Ctrl-Alt-Del, but before my computer actually locks the message is displayed?
Any help would be appreciated. Bonus points awarded for the following:
1) Display the message only if after say 3:00pm, as I lock my computer multiple times a day and I would get the message every time. The 3:00pm constraint would assume I'm leaving for the day and therefore, it should ask me if I've filled it out.
2) At the end of the message, display "Would you like to visit the timecard site?" and display 2 buttons, Yes and No. If I click yes, the locking of the workstation is cancelled and the timecard site opens up in my browser. If no is clicked, the workstation goes on to be locked.
Thanks.
You could pop your message up by calling MessageBox() with the MB_SERVICE_NOTIFICATION flag. That will cause the message box to be popped up on the console even if the logon screen is showing...
I doubt that this is possible. When you press CTRL+ALT+DEL Windows handles that key press and you can't get a look in.
What you could do would be to put a shortcut on you desktop that locked the computer, but only after having shown the message you so desire. I have a Lock Workstation shortcut on my desktop which is implemented with the following target:
C:\Windows\System32\rundll32.exe User32.dll,LockWorkStation
You could quite easily write your own script, or maybe even a small app. If the latter then you simply need to call the LockWorkStation function that is exported from user32.dll.
change the action to a program, run this program
msg username message
ie: msg patrick Please remember to do this.

Do webdevelopers need "confim resend" protection?

I use firefox for my web development and I bet most of you guys too. I've been doing a lot of form development recently and this annoying message
"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."
is just beginning to piss me off.. I mean, come on! I don't need protection on my localhost, thank you! So, my question is: are you aware of any config, hack, plugin to suppress it? If not, how do you live with it?
Apparently there is neither configuration option nor extension to turn off this annoying confirmation window.
However, the workaround I use is as follows.
Download and install application AutoHotkey from: http://www.autohotkey.com/
Create the following script:
^f5::
Send {f5}
sleep 100
Send {enter}
Save with .ahk extension.
Double click to run it (a new icon should show up in the system tray).
Now every time you press Ctrl+F5, the script presses F5 and then Enter. Voila, the confirmation window supressed.
Here's an equivalent of Patrick's answer for Linux users (Ubuntu in my case).
Install autokey (it's in the repos). Add this python script:
import time
keyboard.send_keys("<f5>")
time.sleep(0.5)
keyboard.send_keys("<enter>")
Hook this script to f5 and you will never see the confirm message again. Tested with latest firefox.

Resources