I am trying to get a result if a particular model is in one text file and another if in another text file do something else.
My text files are located on c:\test\full.txt and c:\test\part.txt
full.txt has
model 1
model 2
model 3
Part.txt has
Model 4
Model 5
Model 6
I tried using an array and got it to work but I have to "hard code" the array number for it to work. I would also like it to "pull" from the text files. I only tried with the "full" array first.I would like for it to scroll through the list and if it is in there then "do this" if not "do that.
Here is what I have partially:
Dim MyFull (2)
myfull (0)= "model 1"
myfull (1)= "model 2"
myfull (2)= "model 3"
strComputer = "."
Set objWMIService = GetObject("winmgts:\\" & strComputer & "\root\CIMV2)
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystems")
For Each objItem In colItems
strRawModelNumber = objItem.model
If strRawModelNumber = myfull(1) Then
spanModelNumber.innerhtml = strRawModelNumber
Else spanModelNumber2.innerhtml=strRawModelNumber
End if
Next
Note:Spanmodelnumber prints green font to the screen
Spanmodelnumber2 prints red font to screen.
On the "If strRawModelNumber = myfull(1) line I have to put a number between the () in order for it to work. I would like it to automatically scroll through list and if it is in there print to screen the appropriate color. I didn't finish then else code either.
Any help would greatly be appreciated. Thanks
My text files are located on c:\test\full.txt and c:\test\part.txt
full.txt has
model 1
model 2
model 3
Part.txt has
Model 4
Model 5
Model 6
I tried using an array and got it to work but I have to "hard code" the array number for it to work. I would also like it to "pull" from the text files. I only tried with the "full" array first.I would like for it to scroll through the list and if it is in there then "do this" if not "do that.
Here is what I have partially:
Dim MyFull (2)
myfull (0)= "model 1"
myfull (1)= "model 2"
myfull (2)= "model 3"
strComputer = "."
Set objWMIService = GetObject("winmgts:\\" & strComputer & "\root\CIMV2)
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystems")
For Each objItem In colItems
strRawModelNumber = objItem.model
If strRawModelNumber = myfull(1) Then
spanModelNumber.innerhtml = strRawModelNumber
Else spanModelNumber2.innerhtml=strRawModelNumber
End if
Next
Note:Spanmodelnumber prints green font to the screen
Spanmodelnumber2 prints red font to screen.
On the "If strRawModelNumber = myfull(1) line I have to put a number between the () in order for it to work. I would like it to automatically scroll through list and if it is in there print to screen the appropriate color. I didn't finish then else code either.
Any help would greatly be appreciated. Thanks