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!

is this vbscript possible using javascript?

Status
Not open for further replies.

cbsarge

IS-IT--Management
Jun 20, 2001
219
US
I'd like to convert this to javascript so I can use it in a webpage but, don't know where to start. Is something like this possible?

Code:
On Error Resume Next
Dim strProgram
Dim strNum
Dim strURL
Dim WshShell

MsgBox "message text", vbOKOnly, "title"
strProgram = "chrome.exe"
strNum = InputBox("Enter the number of tabs you would like to open.", "title")
strURL = InputBox("Enter the URL for your tabs.", "title")

If strNum = "" Then
MsgBox "You didn't enter a number for how many tabs to create." & VBNewLine & "The program will now end.", VBCritical, "title - ERROR"
WScript.Quit
End If

If strURL = "" Then
MsgBox "You didn't enter a URL." & VBNewLine & "The program will now end.", VBCritical, "title - ERROR"
WScript.Quit
End If

Set WshShell = WScript.CreateObject("WScript.Shell")
i = strNum
Do Until i=0
  i=i-1
  WshShell.Run strProgram & " " & strURL  
  WScript.Sleep(1000)
  If i<1 Then Exit Do
Loop

[!]The AutoSavers![/!] [2thumbsup]
 
You can open a new window / tab in Chrome using JavaScript using the open() method of the window object. Whether a new window is opened, or whether a new tab is opened, depends upon the parameters you pass to the call.

For me, this opens a new tab every time it is executed:

Code:
window.open('[URL unfurl="true"]http://www.google.co.uk',[/URL] '', '');

Hope this helps,

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top