Question : How can we have the vbs to run onl if its placed on a particular UNC path and no where else.

Hi,

How can we have the vbs to run onl if its placed on a particular UNC path and no where else.
I want the script to work any script for that matter. If a piece of code is placed in the any script it has to work only from a particular UNC path.

Can anyone help with this.

Regards
sharath

Answer : How can we have the vbs to run onl if its placed on a particular UNC path and no where else.

For HTA, something like this should work:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
<html>
<head>
<title>HTA UNC Check</title>

<HTA:APPLICATION 
     ID="objHTA"
     APPLICATIONNAME="HTA_UNC_Check"
     SINGLEINSTANCE="yes"
/>
</head>

<SCRIPT Language="VBScript">
window.resizeTo 500,200

FullName = replace(objHTA.commandLine,chr(34),"")
pos=InstrRev(FullName,"\")
FileName=Mid(FullName,pos+1)
SourceDir=Left(FullName,pos)

strUNC = "\\MYSERVER\MYSHARE"

If lcase(SourceDir) <> lcase(strUNC & "\") then window.close

</SCRIPT>

<body>
If you see this... UNC path is OK
</body>
</html>
Random Solutions  
 
programming4us programming4us