Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Script to display a message while it is processed


Recommended Posts

Posted

Hi guys

 

This is going to be something so simple, but I can’t find how to do it.

 

What I want is a message box to appear when a script starts and to automatically disappear only when the script has finished. I would also like to make it so the user cannot close the message box.

 

Your help is appreciated

 

Z

Posted

The script I posted here does most of what you want.

 

You can close the IE window by putting

oIe.quit

 

at the end of your script.

 

the problem is that it opens a standard IE window with a nice close button. You can hide the menu, address bar, status bar etc but I can't see how to hide the close button :-(

Posted

Ah that one won't do,

 

What I am doing is making a start-up script that will create a backup of the “home documents” on teacher laptops. It may take a few mins on some laptops, so I would like a message to display explaining what is going on before the teachers ring us up saying how long its taking to load.

 

Thanks anyway

Posted
Ah that one won't do,

 

What I am doing is making a start-up script that will create a backup of the “home documents” on teacher laptops. It may take a few mins on some laptops, so I would like a message to display explaining what is going on before the teachers ring us up saying how long its taking to load.

 

Thanks anyway

 

If it is going to take ages on each logon why not do it in the background. Just use that little message bubble one of yours and keep updating it with the current time elapsed. Could work.

Posted
Well preferably I want it to happen before they logon, its only one folder on each machine. I don’t want them to shutdown with half a backup. Some only ever bring them in to renew the 30 day activation (another script of ours).
Posted

Ok, in which case you could still use the script that srochford kindly provided by adding the following code:

oIe.FullScreen = True

 

This will put the browser into fullscreen mode for the duration.

 

All of the avalible settings for the browser object are listed here:

InternetExplorer Object

so that you can customize it further.

Posted
So they will display a internet explorer page on the “running start-up scripts” before you get to the crtl + alt + del screen?
Posted

I'm not sure if it will work like this as I was under the impression that it was a logon script rather than a machine startup script.

 

As the machine startup scripts are run as system I am not sure whether they will allow interactive actions like this as by design interactive stuff is hidden from the user in this mode.

Posted
Sorry if I gave you the wrong Impression. Yes it’s a start-up script you can display a standard message box I have tried it.
Posted

Unfortunately the usual vbscript methods of message boxes and pop ups interrupt the execution of the script while waitng for user input.

 

srochford's script should work fine as a startup script, and closing the internet explorer window won't stop your script running.

 

If you really want to get rid of the little red x, you could try wrapping up your script as a hta instead e.g.

 

   	SysMenu="no" 
Border="Thin"
Scroll="no"
SingleInstance="yes"
ApplicationName="Test Script"
>

Message...
   <br />
        Sub Window_OnLoad<br />
	' window width<br />
	intWidth = 300<br />
	' window height<br />
	intHeight = 180<br />
	window.resizeto intWidth,intHeight<br />
        <br />
        ' Put your script to do something here<br />
		' e.g. wait 10 seconds then close the application<br />
		idTimer = window.setTimeout("PausedSection", 10000, "VBScript")<br />
		<br />
	End Sub<br />
<br />
        Sub PausedSection<br />
		window.close<br />
        End Sub<br />
    

   
       
Your message goes here.....
   

 

Just save this with a .hta extension and when it is run it will display a small window without any controls.

 

Hope that is of some help,

 

Iain.

Posted
Sorry if I gave you the wrong Impression. Yes it’s a start-up script you can display a standard message box I have tried it.

 

If the message box works then there is a good chance that the browser object will work to which would allow it to work as you want it to.

Posted

If this is just backing up user files, why not use off-line files? That will just sync automatically when the user connects back to the network.

 

If you're running it as a machine start up script, how do you know which files to back up (or are you just backing up everything under documents and settings? Probably OK if machines are generally just used by 1 person)

Posted

Easy in AutoIt, which lets you create custom forms and display them in any way you like. The script can then continue to do its work. Once done, the form is hidden and destroyed.

 

 

 
#include 
; Disable event mode
Opt("GUIOnEventMode", 0)
; Create a form with no control menu/buttons
$Form1 = GUICreate("Backup Script", 333, 49, 193, 115, BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS))
; Add a label
$Label1 = GUICtrlCreateLabel("Backup underway - please be patient", 8, 8, 314, 28)
; Set the label text size
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
; Display the form
GUISetState(@SW_SHOW)

; Code here to do stuff

; End of work code

; Hide the form
GUISetState(@SW_HIDE)
; Destroy the form
GUIDelete($Form1)

Posted

Another thing to watch out for with Startup Scripts is the default timeout. Can't remember what it is OTTOMH but Windows will not wait forever for scripts to complete (Startup or Logon). The timeout can be set with GP.

 

In my experience, the problem with using IE for forms (apart from the ickiness factor) is that the user can easily close the IE form at which point if the script references it, it errors out.

Posted
Another thing to watch out for with Startup Scripts is the default timeout. Can't remember what it is OTTOMH but Windows will not wait forever for scripts to complete (Startup or Logon). The timeout can be set with GP.

 

In my experience, the problem with using IE for forms (apart from the ickiness factor) is that the user can easily close the IE form at which point if the script references it, it errors out.

 

Very good point by default it times out in 10 mins, i may have to re-think this one.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...