Forum Discussion
3 Replies
- iamraj09Contributor
Hello vinodkumar_chau,
Are they connected scripts..? But generally you can check whether the process is existing ot not by the following syntax.
if(Sys.Process("YXQ").Exists)
{
//Execute scripts;
}
function for getting the type of Operating System
function OSName ()
{
var strComputer, objWMIService, colOperatingSystemsList;
var colOperatingSystems, objOperatingSystem;
strComputer = ".";
objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!//" + strComputer + "/root/cimv2");
colOperatingSystemsList = objWMIService.ExecQuery("Select * from " + "Win32_OperatingSystem");
colOperatingSystems = new Enumerator(colOperatingSystemsList);
for ( ; !colOperatingSystems.atEnd(); colOperatingSystems.moveNext() )
{
objOperatingSystem = colOperatingSystems.item();
Log.Message("OS: " + objOperatingSystem.Name);
}
return objOperatingSystem.Name;
}//From the above function you will get a long string with operating system and some other text extract the req string and compare
var OS_Name=OSName (); // getting and storing the extracted string in the variable using the above function ....
if(Sys.Process("Word").Exists)
{
if(OS_Name=="Windows7") //Comparing the extracted string ....
{
//Test Scripts
}else
{
Log.Message("Doesnt satisfy the conditions");
}
}
- vinodkumar_chauContributor
Hi ,
Thanks iamraj09 for the reply.
What i am looking for is that before my all 10 scripts run , there should be some method or mechanism where in i first check the OS , IE version etc on the system where these 10 scripts will run and if it satisfies the conditions , then the scripts should run otherwise not.
- AlexKarasChampion Level 3
Hi,
The variation of the above advice is to create a function that will check conditions that you need and store the result into one or more (temporary) project variables (e.g. OSName and IsWordRunning).
Then at the beginning of every function called from those 10 units you can add something like this:
If (Not ("Win7" = Project.Variables.OSName And Project.Variables.IsWordRunning)) Then
Exit Function
End If
...
Related Content
- 4 years agoryanterronez
- 4 years agobflynnbyx
Recent Discussions
- 2 hours agoSubhraDas
- 8 hours agoJacobjacob44