+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
Scripts Thread, Script to display a message while it is processed in Coding and Web Development; ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,235
    Thank Post
    894
    Thanked 1,780 Times in 1,534 Posts
    Blog Entries
    12
    Rep Power
    462

    Script to display a message while it is processed

    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

  2. #2

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    The script I posted here does most of what you want.

    You can close the IE window by putting
    Code:
    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 :-(

  3. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,235
    Thank Post
    894
    Thanked 1,780 Times in 1,534 Posts
    Blog Entries
    12
    Rep Power
    462
    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

  4. #4

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,242
    Thank Post
    882
    Thanked 2,743 Times in 2,317 Posts
    Blog Entries
    11
    Rep Power
    784
    Quote Originally Posted by FN-Greatermanchester View Post
    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.

  5. #5

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,235
    Thank Post
    894
    Thanked 1,780 Times in 1,534 Posts
    Blog Entries
    12
    Rep Power
    462
    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).

  6. #6

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,242
    Thank Post
    882
    Thanked 2,743 Times in 2,317 Posts
    Blog Entries
    11
    Rep Power
    784
    Ok, in which case you could still use the script that srochford kindly provided by adding the following code:
    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.

  7. #7

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,235
    Thank Post
    894
    Thanked 1,780 Times in 1,534 Posts
    Blog Entries
    12
    Rep Power
    462
    So they will display a internet explorer page on the “running start-up scripts” before you get to the crtl + alt + del screen?

  8. #8

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,242
    Thank Post
    882
    Thanked 2,743 Times in 2,317 Posts
    Blog Entries
    11
    Rep Power
    784
    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.

  9. #9

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,235
    Thank Post
    894
    Thanked 1,780 Times in 1,534 Posts
    Blog Entries
    12
    Rep Power
    462
    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.

  10. #10
    Iain's Avatar
    Join Date
    Oct 2006
    Location
    Warwickshire
    Posts
    190
    Thank Post
    28
    Thanked 94 Times in 54 Posts
    Rep Power
    32
    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.

    Code:
    <html>
        <HTA:APPLICATION 
    	SysMenu="no" 
    	Border="Thin"
    	Scroll="no"
    	SingleInstance="yes"
    	ApplicationName="Test Script"
    >
    <head>
    <title>Message...</title>
        <script language = "VBScript">
            Sub Window_OnLoad
    	' window width
    	intWidth = 300
    	' window height
    	intHeight = 180
    	window.resizeto intWidth,intHeight
            
            ' Put your script to do something here
    		' e.g. wait 10 seconds then close the application
    		idTimer = window.setTimeout("PausedSection", 10000, "VBScript")
    		
    	End Sub
    
            Sub PausedSection
    		window.close
            End Sub
        </script>
    </head>
        <body>
            <p style="font-weight: bold; font-family: Tahoma; font-size: 0.95em; text-align: center; margin: 50px;">Your message goes here.....</p>
        </body>
    </html>
    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.

  11. #11

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,242
    Thank Post
    882
    Thanked 2,743 Times in 2,317 Posts
    Blog Entries
    11
    Rep Power
    784
    Quote Originally Posted by FN-Greatermanchester View Post
    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.

  12. #12

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    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)

  13. #13

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,235
    Thank Post
    894
    Thanked 1,780 Times in 1,534 Posts
    Blog Entries
    12
    Rep Power
    462
    Its backing up items in a folder called home docs in C Drive.

  14. #14
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    34
    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.


    Code:
     
    #include <GUIConstants.au3>
    ; 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)

  15. #15
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    34
    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.

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: 28th May 2008, 11:37 PM
  2. Display a message
    By FN-GM in forum Scripts
    Replies: 13
    Last Post: 15th February 2008, 11:35 PM
  3. Replies: 5
    Last Post: 16th December 2007, 07:26 PM
  4. Replies: 2
    Last Post: 29th January 2007, 04:25 PM
  5. Display a message whilst installing software
    By richard in forum How do you do....it?
    Replies: 14
    Last Post: 14th December 2006, 02:40 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •