Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 25th, 2008, 05:53 PM
careytech careytech is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Location: Melbourne, Australia
Posts: 1 careytech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 56 sec
Reputation Power: 0
Need Help Finishing Script!

Hey!

This is the story. I've written the below script to perform an installation (which will be done silently via SMS) and it
doesn't seem to wait until one installation is finished before it goes to the next.

What my intention is to do is to wait until the process irsetup.exe is no longer running before it moves to the next installation.

The original setup calls upon msiexec which calls upon irsetup.exe. If it tries to do all the setup at once, the setup fails and doesn't work.

Any help would be appreciated!! I've been rattling my brain with this one!

Thanks.



Code:
'Option Explicit 

Dim WshShell, WshFS 

Dim objWMIService 

Dim colProcesses 

Dim ExePkg 

Dim query 

Dim SourcePath 

Dim ProgramFilesDir 

Dim SetupPackage 

Dim IsAppInstalled 

Dim ProcessThatDoesInstalling 

Dim ProgMenu 

Dim AllUsersStartMenu 

'On Error Resume Next 



Set WshShell = WScript.CreateObject("WScript.Shell") 

Set WshFS = WScript.CreateObject ("Scripting.FileSystemObject") 

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") 

Set colProcesses = objWMIService.ExecQuery _ ("SELECT * FROM Win32_Process WHERE Name = '" query "'") 

AllUsersStartMenu = WshShell.SpecialFolders("AllUsersStartMenu") 
ProcessThatDoesInstalling = "Irsetup.exe" 

ProgramFilesDir = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir") 
SourcePath = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - Len(WScript.ScriptName)) 
IsAppInstalled = ProgramFilesDir & "\Early Years Maths Pack\eympmenu.exe" 

SetupPackage = SourcePath & "Maths\setup1.exe /s" 

ProgMenu = "\Early Years Maths Pack" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\iR Games Pack Vol.1\menu.exe" 

SetupPackage = SourcePath & "Games\PG1setup2.exe /s" 

ProgMenu = "\iR Games Pack Vol.1" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\iR Games Pack Vol.2\menu.exe" 

SetupPackage = SourcePath & "Games\PG2setup2.exe /s" 

ProgMenu = "\iR Games Pack Vol.2" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\iR Games Pack Vol.3\menu.exe" 

SetupPackage = SourcePath & "Games\PG3setup2.exe /s" 

ProgMenu = "\iR Games Pack Vol.3" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\iR Games Pack Vol.4\pg4menu.exe" 

SetupPackage = SourcePath & "Games\PG4setup2.exe /s" 

ProgMenu = "\iR Games Pack Vol.4" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\iR Games Pack Vol.5\pg5menu.exe" 

SetupPackage = SourcePath & "Games\PG5setup2.exe /s" 

ProgMenu = "\iR Games Pack Vol.5" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\iR Literacy Pack One\lp1menu.exe" 

SetupPackage = SourcePath & "Literacy\setup.exe /s" 

ProgMenu = "\iR Literacy Pack One" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Maths Pack 1\cdfiles\menu.exe" 

SetupPackage = SourcePath & "Maths\setup1.exe /s" 

ProgMenu = "\Maths Pack 1" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 

IsAppInstalled = ProgramFilesDir & "\Maths Pack 2\menu.exe" 

SetupPackage = SourcePath & "Maths\setup3.exe /s" 

ProgMenu = "\Maths Pack 2" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 

IsAppInstalled = ProgramFilesDir & "\Maths Pack 3\mp3menu.exe" 

SetupPackage = SourcePath & "Maths\setup3.exe /s" 

ProgMenu = "\Maths Pack 3" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Primary Games Vol.1\menu.exe" 

SetupPackage = SourcePath & "Games\PG1setup.exe /s" 

ProgMenu = "\Primary Games Vol.1" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Primary Games Vol.2\menu.exe" 

SetupPackage = SourcePath & "Games\PG2setup.exe /s" 

ProgMenu = "\Primary Games Vol.2" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Primary Games Vol.3\menu.exe" 

SetupPackage = SourcePath & "Games\PG4setup.exe /s" 

ProgMenu = "\Primary Games Vol.3" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Primary Games Vol.4\pg4menu.exe" 

SetupPackage = SourcePath & "Games\PG4setup.exe /s" 

ProgMenu = "\Primary Games Vol.4" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Primary Games Vol.5\pg5menu.exe" 

SetupPackage = SourcePath & "Games\PG5setup.exe /s" 

ProgMenu = "\Primary Games Vol.5" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Teaching Fractions\menu.exe" 

SetupPackage = SourcePath & "Teaching\setup1.exe /s" 

ProgMenu = "\Teaching Fractions" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Teaching Money\menu.exe" 

SetupPackage = SourcePath & "Teaching\setup2.exe /s" 

ProgMenu = "\Teaching Money" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Teaching Measures\menu.exe" 

SetupPackage = SourcePath & "Teaching\setup3.exe /s" 

ProgMenu = "\Teaching Measures" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Teaching Time\menu.exe" 

SetupPackage = SourcePath & "Teaching\setup4.exe /s" 

ProgMenu = "\Teaching Time" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 
IsAppInstalled = ProgramFilesDir & "\Teaching Tables\menu.exe" 

SetupPackage = SourcePath & "Teaching\setup5.exe /s" 

ProgMenu = "\Teaching Tables" 

call Install (IsAppInstalled, SetupPackage, ProgMenu) 



Function Install (IsAppInstalled, SetupPackage, ProgMenu) 

If Not WshFS.FileExists(IsAppInstalled) Then 

Set ExePkg = WshShell.Exec(SetupPackage) 

'Loop until irsetup starts 

While (isprogramrunning(ProcessThatDoesInstalling) = 1) 
Wscript.Sleep 100 
Wend 

' Loop until irsetup finishes 

While (isprogramrunning(ProcessThatDoesInstalling) = 0) 
Wscript.Sleep 100 
Wend 

End If 



If Not WshFS.FolderExists(AllUsersStartMenu & "\Programs\iR") Then 

WshFS.CreateFolder AllUsersStartMenu & "\Programs\iR" 

End If 


If WshFS.FolderExists(AllUsersStartMenu & "\Programs" & ProgMenu) Then 
WshFS.MoveFolder AllUsersStartMenu & "\Programs" & ProgMenu, AllUsersStartMenu & "\Programs\iR" & ProgMenu 
End If 

End Function 



Function isprogramrunning (ProcessThatDoesInstalling) 

if colProcesses.count = 0 then 


isprogramrunning = False 
else 


isprogramrunning = True 
end if 
End Function 

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > Need Help Finishing Script!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT