Solved

Hyper links with VB script

Posted on 2011-02-21
7
245 Views
Last Modified: 2012-05-11
I want to include a hyperlink in the following network logon script, Do you know how this can be achieved?
<html>
<head>
<title>Network Drives</title>
<HTA:APPLICATION
  APPLICATIONNAME="Network Drives!"
  ID="myNetworkDrives"
  VERSION="1.0"
/>
</head>

<script language="VBScript">

Sub Window_OnLoad
  'This method will be called when the application loads
  'Add your code here
  window.resizeto 640,480
  window.resizeto 640,480
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  strPath = objFSO.GetAbsolutePathName(".")
  Set objFolder = objFSO.GetFolder(strPath)
  jpgList = ""

  For Each objFile In objFolder.Files
    If InStr(objFile.Name, "NetDrv") <> 0 Then 
      jpgList = jpgList & objFile.Name & "|"
    End If
  Next
  jpgList = Split(jpgList,"|")
  window.document.body.background = jpgList(getRandomNumber(0, UBound(jpgList)-1))

End Sub

Function getRandomNumber(low,high)
  intHighNumber = high
  intLowNumber = low
  Randomize
  getRandomNumber = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
End Function
</script>
</body>

</html>

Open in new window

0
Comment
Question by:resolver1
  • 3
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
TinTombStone earned 500 total points
ID: 34943446
Replace Line 40 on, with


<body bgcolor="buttonface">
<a href="http://www.experts-exchange.com/" target="blank">Expert Zone</a href>
</body>
</html>
0
 

Author Comment

by:resolver1
ID: 34944482
Thanks for your reply.  If I click the picture nothing happens.  I want to be able to click the whole of the window and for it to open IE and take users to an internal website.  All that happens with the code supplied is that it adds expert zone at the top left in text.
0
 
LVL 6

Assisted Solution

by:TinTombStone
TinTombStone earned 500 total points
ID: 34945579
This will hyperlink the whole window

<script language="VBScript">

Sub PopLink( )
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "http://www.experts-exchange.com"  
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=800
objExplorer.Height = 600
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
End Sub

</script>

<body bgcolor="white" onclick="PopLink">

</body>
</html>
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:resolver1
ID: 35093969
Still goto check this one out.  Thanks for the reply.  
0
 

Author Comment

by:resolver1
ID: 35802942
I tried pasting the above code into a seperate html file and the link still wouldnt work.  It is something i would like to get to work.  
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35829888
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now