tomscaper Posted January 17, 2007 Posted January 17, 2007 hi could anyone help me with the following problem or explain if using a script is the best way to go, or if my problem is a little to complex. i am currently deploying a piece of software using a batch file which runs in the group policy as a start up script. even though many times i have explained to the teachers that the software is installing and the laptop has not crashed or frozen, they still reboot the machine when it says running start up scripts message. as the software takes about 5 minutes to install. i am looking to create some kind of popup message that says installing please wait. i have looked on the internet about using msgbox and setting a timer on it. but i was hoping there was some way of using a vbs script to run at the begining of the batch file and start the message and once the batch file has got to a point then it will tell the script to finish and close the message. i know it is abit of a frivalous thing to have but it would make life a bit easier. hopefuly you can understand what i am asking. thanks tom
webman Posted January 17, 2007 Posted January 17, 2007 It'd be possible to create an AutoIt script (then compile to an EXE) with a non-closable GUI (to display your message, in big writing.. ) and continually check for the presence of the installation dialog by it's window title, and only close the message once that has closed.
Guest Posted January 17, 2007 Posted January 17, 2007 Could you not convert your batch file to a vbs and then have that show up a message to indicate that software is being installed, click ok to continue for example. and then the script contiunes to install software and pops up with another window at the ned saying completed click ok? I'm no script kiddie but use a similar method for a laptop backup routine.
Ric_ Posted January 17, 2007 Posted January 17, 2007 You could also package the installation so that you can deploy it via GPO... there would then be a message saying 'Installing Managed Software X'
mattx Posted January 17, 2007 Posted January 17, 2007 Agree with Webman on this - I have written tons of AutoIT Scripts and this would be straight forward to code. Better than knocking up a VBS script which would have about 100 lines of code to do something straight forward - the same could be done in AutoIT with around 15 to 20 lines. Get your batch file to call the AutoIT message box - maybe even put a BlockInput command in so the user cannot do anything with the keyboard and mouse until the install is finished.
webman Posted January 17, 2007 Posted January 17, 2007 The script could be crafted in such a way you can specify the text and style of the message, what to wait for finishing and whether to block input (good idea!) from the command line (best method - allowing different messages depending on what you're installing for example) or an INI file.
mattx Posted January 17, 2007 Posted January 17, 2007 I've been going through some of my old AutoIT stuff and the only thing that came close to what you wanted to do was this AOE script I did quite a while ago - I've commented what may be handy for you [ plus I have removed PASSWORD details !! ] ; AutoIt Version: 3.10 ; Language: English ; Platform: WinXP ; Author: Matt Marsh ; Script Function: Script that turns off firewall then launches Age Of Empires 2 ; Version: 3 SplashImageOn("resource_gui", "p:\misc\splash.jpg", "172", "168", "-1", "-1", 3) Sleep(2000) SplashOff() ; A splash screen which inform users whats about to happen !! SplashTextOn("aoe2", "Getting Ready To Launch Age Of Empires." & @CRLF & "Please Wait...", "350", "70", "-1", "-1", 3, "", "", "") Sleep(3000) ; Blocks keyboard and mouse action for a while BlockInput(1) ; Need to stop the windows firewall. Needs admin access so local admin details should do. RunAsSet("administrator", @ComputerName, "PASSWORD") Run(@ComSpec & ' /c net stop SharedAccess', '', @SW_HIDE) RunAsSet() Sleep(5000) ; Remove the splash screen SplashOff() BlockInput(0) ; Fire off the AOE prog, needed to fire it off using a batch command, I cannot remember why now. Run("c:\logs\empires2.cmd") WinWait("Age of Empires II - End User License Agreement") Send("{TAB 4}") Send("{ENTER}") Sleep(20000) ; This may be of interest to you if you are waiting for your install batch to finish running - I used this to monitor the actual ; AOE exe so when it closes, the firewall will start up again. ProcessWaitClose("empires2.exe") RunAsSet("administrator", @ComputerName, "PASSWORD") Run(@ComSpec & ' /c net start SharedAccess', '', @SW_HIDE) RunAsSet() SplashTextOn("aoe2", "Closing Down Age Of Empires." & @CRLF & "Please Wait...", "350", "70", "-1", "-1", 3, "", "", "") Sleep(3000) Exit Thinking about it though, I bet you could knock something up in AutoIT which will install your prog you need - it would stop any spaghetti code...
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 Thanks for all the tips, i had tried to convert it to a vbs script but i was unable. As for the popup box in vbs i would use it but it needs the user to click ok and i would rather then not need to click anything as they would probably end up bugging me why is this box saying ok. lol i tried repackaging it to a msi but it never worked from that, they only way i have found is running at startup from a share luckily the exe can be installed silently this is the batch file if anyone would know how to change it to vbs. if exist "c:\program files\sims\installed1" goto :eof ELSE @echo off net use q: \\ast-sr-001\packages xcopy q:\sims\connect.ini "c:\program files\sims\" /y q: cls echo.******************************************************************************* echo.******************************************************************************* echo.**************Installing Sims Please wait for wait for************************* echo.***************this screen to close before continuing************************** echo.******************************************************************************* echo.******************************************************************************* q:\sims\Setups\SIMSInfrastructureSetup.exe -a {QuietMode} q:\sims\Setups\SIMSapplicationsetup.exe /s {QuietMode} {NoServerApps} [sIMSDirectory]="K:\SIMS\" [sIMSDotNetDirectory]="C:\Program Files\SIMS\SIMS .net" q:\sims\Setups\SIMSMAnualSetup.exe /s {QuietMode} {NoServerManuals} [sIMSDirectory]="K:\SIMS\" [sIMSDotNetDirectory]="C:\Program Files\SIMS\SIMS .net" q:\sims\Setups\SIMSAMPARKSetup.exe /s {QuietMode} {NoServerApps} [sIMSDirectory]="K:\SIMS\" [sIMSDotNetDirectory]="C:\Program Files\SIMS\SIMS .net" md "c:\program files\sims\installed1" xcopy q:\sims\connect.ini "c:\program files\sims\sims .net\" /h /y net use q: /d /y i had a go but the extra lines after the exe never worked properly as for the AutoIT script i have never used it and i have no idea what it is. do you need anything to run it? all i need the script to do is run at start saying installing..... then at the end somehow tell the message to close and say installation complete and close after a few seconds.
webman Posted January 18, 2007 Posted January 18, 2007 Ok is this any good? @echo off rem Centre window on screen and do not close after a pause message.exe "Please wait" "Installing Software\n\nDo NOT restart!" 0 ... [rest of batch file] ... rem Close it taskkill /im message.exe rem Tell user its finished and close after 8 secs message.exe "Setup complete" "Installation complete!" 8 message.exe message.zip
mattx Posted January 18, 2007 Posted January 18, 2007 AutoIT is at http://www.autoitscript.com/ Looking at your batch, you could do that very easily in AutoIT and have a better element of control as to whats happening, IE you can block the keyboard and mouse until its finished installing and show a splash or message box. This UN-TESTED script will pop up a message box, block keyboard and mouse, run your batch file - [ you need to change file paths etc ], monitor the window till it closes, then will pop up another box saying its finished, give keyboard and mouse back and then close. Like I said though - its un-tested and just written ad hoc. ; AutoIt Version: 3.2.0.1 ; Language: English ; Platform: WinXP ; Author: Matt Marsh ; Script Function: Fires of a batch with message box ; Version: BETA 1 ; Date: Jan 2007 SplashTextOn("Sims Install","Installing Sims - please wait.","500","50","-1","-1",2,"","","") BlockInput(1) run ('Your Batch Prog Loaction\File.exe') ; Pauses execution of the script until the requested window does not exist. You can put a timeout setting on this if you wish WinWaitClose(file.exe) Splashoff() SplashTextOn("Sims Install","Installation complete","500","50","-1","-1",2,"","","") sleep(3000) BlockInput(0) SplashOff() Exit
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 hi thanks that work really good, i am trying to incorporate the batch file into the autoit script, i tried running it the way you said by calling the batch file but as it is a batch file i cant work out how to tell the program to wait till it closes as the cmd prompt runs instead with the batch file inside it.
mattx Posted January 18, 2007 Posted January 18, 2007 You can use the ProcessExists function: If ProcessExists("notepad.exe") Then MsgBox(0, "Example", "Notepad is running.") EndIf Is the example from the help manaul. There are other Process functions too.
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 The only part i am having trouble with is the winwaitclose part, i can get the batch file running but i cant get it to wait till the batch file has finished. run ('N:\My Documents\utilities\batch\sims.bat') ; Pauses execution of the script until the requested window does not exist. You can put a timeout setting on this if you wish WinWaitClose('N:\My Documents\utilities\batch\sims.bat') this is what i have up to now from modifying your script
mattx Posted January 18, 2007 Posted January 18, 2007 Does the sims.bat when it launches open up a window ? If so run the AU3INFO.exe to see how AutoIt is seeing the window. Check the Window Details. Does the Batch file close after its finished running ? Someone correct me if I am wrong but I think windows opens up a WOW.exe [ windows on windows session when running a CMD or Batch file ] bring up task manager and see if thats the case with your batch file. You can then use the ProcessWaitClose function on that exe [ May be worth just re-naming it to a cmd also to see if that helps ] - don't forget to change WinWaitClose though. I would certainly run AU3INFO first to see how its seeing the open window though...
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 the windows detail when the bat file runs is Title: C:\WINDOWS\system32\cmd.exe Class: ConsoleWindowClass Size: X: 223 Y: 83 W: 669 H: 338 i changed it to run ('N:\My Documents\utilities\batch\sims\sims.bat') ; Pauses execution of the script until the requested window does not exist. You can put a timeout setting on this if you wish ProcessWaitClose('C:\Windows\system32\cmd.exe') but it still didnt wait till it finishes i have set the batch file to pause so it is my interaction that should end it.
webman Posted January 18, 2007 Posted January 18, 2007 Have you tried running my message.exe from within the batch file to see if that works how you want?
bossman Posted January 18, 2007 Posted January 18, 2007 tomscaper, just a question? do you have WOL active on your network? if you do then can you not do the installs before the users logon say 7 in the morning, this is what i do and i have no irritating problems with the teachers being held up for 5 mins while software is installing. This gives me street cred with the teachers and they give me no grief.
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 to webman i tried your message.exe version it shows the message fine, and the mouse wont move, but it doesnt then move on to install the software it just freezes at that point. bossman i dont know what WOL is how would i find out if that is on my server.
webman Posted January 18, 2007 Posted January 18, 2007 Ah, you'd maybe have to use START to run it then (will execute it then carry on with the script), sorry: @echo off start message.exe "Please wait" "Installing SIMS" 0 WOL (Wake-on-LAN) allows computers to be turned on when a "magic packet" is sent to them. It has to be support at each computer at their network card level (or motherboard).
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 that works great now. as for the wake on lan, some of the network cards or motherboards can do this as i start them up on a morning that way, but there are a odd few that do not let me do this. i am still curious about getting the other autoit script to work though any ideas what could be wrong with it
webman Posted January 18, 2007 Posted January 18, 2007 I think I read somewhere that to run batch files from autoit you have to run something like "cmd.exe /c "
ajbritton Posted January 18, 2007 Posted January 18, 2007 Be aware that there is a limit on the length of time a computer waits for startup scripts to complete. There is a GP setting which can change this.
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 sims takes about 5 minutes to complete. how would i go about altering this do you happen to know where you can change this. also anyone insterested i solved the other problem with autoit run ('sims.bat') ; Pauses execution of the script until the requested window does not exist. You can put a timeout setting on this if you wish WinWaitClose('C:\WINDOWS\system32\cmd.exe') i needed to use the WinWaitClose command on cmd as that is what the batch file opened,i dont know how fool proof it is but it waited till the script finished then displayed the completed message.
tomscaper Posted January 18, 2007 Author Posted January 18, 2007 Well it all works fine now, well when i run it manually but when i go to run it at start up, due to not being able to run unc paths it wont run the batch file. is it possible to convert what i have in my batch file to work inside the autoit script @echo off if exist "c:\program files\sims\installed1" goto :eof ELSE net use q: \\ast-sr-001\packages\ xcopy q:\sims\connect.ini "c:\program files\sims\" /y q: q:\sims\Setups\SIMSInfrastructureSetup.exe -a {QuietMode} q:\sims\Setups\SIMSapplicationsetup.exe /s {QuietMode} {NoServerApps} [sIMSDirectory]="K:\SIMS\" [sIMSDotNetDirectory]="C:\Program Files\SIMS\SIMS .net" q:\sims\Setups\SIMSMAnualSetup.exe /s {QuietMode} {NoServerManuals} [sIMSDirectory]="K:\SIMS\" [sIMSDotNetDirectory]="C:\Program Files\SIMS\SIMS .net" q:\sims\Setups\SIMSAMPARKSetup.exe /s {QuietMode} {NoServerApps} [sIMSDirectory]="K:\SIMS\" [sIMSDotNetDirectory]="C:\Program Files\SIMS\SIMS .net" md "c:\program files\sims\installed1" xcopy q:\connect.ini "c:\program files\sims\sims .net\" /h /y net use q: /d /y
mattx Posted January 18, 2007 Posted January 18, 2007 Sorry you have lost me there Tom, what won't run at startup ? The actual AutoIT Script ? How are you starting it ? In the logon script for the user ? Also have you compiled it to an EXE ?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now