Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use wildcards to select an object.

Status
Not open for further replies.

Oldnmbr7

Technical User
Sep 19, 2013
3
US
Hello,
I am having trouble figuring something out and hopefully someone can help.
I am trying to write a script that takes a value from a point and then do something with it.
The value could vary and is user defined. The first Part of the value will always be the same. Then depending on the last part the path to find that value will change.

this is what i have.

sub upload
dim days, number
days = Server.Getopcvalue(".Days")
number = Server.Getopcvalue (".Number")

Call server.setopcvalue("Filename.Filename." & number & ".Filename", days)

the above part works. what i am having trouble with is the number has two possiblities. possibility 1 is in this format (for security reasons i cant actually say the number) L = Letter N= Number
LNNL$LLNNN the reason i put a $ is because this is the deciding letter on what path to take. it will either be an H or a C
how would i get anything with an H to goto Filename.Filename and anything with a C to goto Namefile.Namefile?

i was thinking some kind of IF statement that would look at the user defined "number" and depending on what the 5th character is but i cant make it work. what wildcards could be used?

Thank You
 
Something like this ?
Code:
If Mid(number,5,1) = "H" Then
  Call Server.SetopcValue("Filename.Filename." & number & ".Filename", days)
Else
  Call Server.SetopcValue("Namefile.Namefile." & number & ".Filename", days)
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I have one more question about this same script.
once the user types in a number and clicks a button the script will run. is there any way to put a time limit on the script so it will only run every 2 min. so the user does not go crazy on the button?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top