Question : Microsoft VBScript runtime error '800a0005' while using MID

I'm reading in a text file one line at a time with ReadLine. I need to check each line to see if its a hyper-link and if so add "target='_blank'" to the end of the link. I've written a function to find the hyper-link string ("<a href="somefile">) but its in the middle of the line, so I've been trying to use Mid(string, start, end) but I get this error on the line with the mid function:

Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument: 'mid'

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function dohref(theline)
dim thelink
a = Cint(InStr(1,Ucase(theline),"<A HREF",vbtextcompare)) ' start of string
b = Cint(InStr(1,Ucase(d),">",vbtextcompare))             ' end of string
c = b-a                                                   ' length of string	
thelink = mid(theline, a, c)
thelink = replace(thelink,">"," target='_blank'>")
theleft = left(theline, a-1)
theright = right(theline, b+1)
theline = theleft&thelink&theright
end function

Answer : Microsoft VBScript runtime error '800a0005' while using MID

Very simple.
If he is connecting from the owner's home we can safely assume it will either be from the same PC or a small set of known machines.
In that case, get the computer names.
Then change the logon script that runs for everyone in a TS (USRLOGON.CMD) and at the end add something like:

IF NOT %USERNAME% == "that_particular_username" Goto End
IF %CLIENTNAME% NEQ "Computer_Name" TSLOGOFF
:End

So resuming: check if the username matches the user you want to allow. If not, simply skip to the end (meaning do nothing). But if it matches it will go to the next line and check the %CLIENTNAME% (this passes the computer name the client is connecting from). If it does NOT match the one you want to allow, run a TSLOGOFF what will kick him out of the system.
Is this what you are looking for?

Cláudio Rodrigues
Citrix CTP
Random Solutions  
 
programming4us programming4us