vbscript

"subscript out range" error (vbscript on pageload)

Hi, my name is Edd and I need your help. This error occurs on page load in my classic ASP application: Microsoft VBScript runtime error '800a0009' Subscript out of range: 'cont' /admin/cadastros_apz_material.asp, line 173 The associated code is: do while not rs.eof for i = 1 to tpp if i = 1 then matriz(cont) = Rs("id_mater...

VBScript: What is the simplest way to format a string?

I have the following format: Value1 is {0} and Value2 is {1}. I need to replace the numbers in the brackets with strings. This is easily done in most languages using string.Format or something along those lines. How can I do this using only vbscript? I've tried: Replace (strFormat, "{0}", value1) Replace (strFormat, "{1}", value...

VBScript function to create a two-dimensional array, like GetRows does

This is asp classic using VBScript, and no, it ain't moving to .net anything, so don't even ask. OK, so the classic way to get data out of a database is to use GetRows: Dim MyRecords Dim rs, conn [...database opening stuff...] If Not rs.EOF Then MyRecords = rs.GetRows End If [...close database & set to Nothing...] Note how MyReco...

MICROSOFT.XMLDOM -- selecting a node that contains a specific node

Here is an extract from the XML: <?xml version="1.0" encoding="utf-8"?> <usa_map_locator> <map_data> <state> <id>2</id> <link/> </state> <state> <id>3</id> <link/> </state> </map_data> </usa_map_locator> I need to assign a value to the link node for state 2 (or 3 or 4 or 5 and so on)...

VBScript And Windows Mobile

Hello, I've started learning VBScript because of PowerShell, but I want to know if I can run VBScripts(*.vbs) in a Windows Mobile device. Thanks. ...

[DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error - connecting to SQL database in VB script

I have a VB script which connects to a local SQL database to retrieve a value. The exact same script runs on about 100 servers, but a few of the servers produce this error: [DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error. Check your network documentation Here is the code that runs: Function GetPrimaryServerID On...

How do I load data into the Data Portal of DIAdem with VBScript?

I want to load a ".tdm" file into DIAdem (National Instruments) with a VBScript but can't find how to do this. I have Dialog which opens a browse-window, which returns the path as a string. So I was hoping to have a function which would work something like this: Call Data.Root.ChannelGroups.Load(myStringWithThePath) ...

Script to list non-Microsoft Services

Hi guys Been lookin' for a way to list the non-Microsoft Services to a *.txt file. Either using vbs or a batch file will be sufficient. I've tried numerous ways with WMI and the sc.exe command, but can't seem to put my finger on it. Thanks, Tim ...

Reverse CreateObject in VBScript

Hi, I have an old vbscript the runs the command, foo = CreateObject(x.y). I want to run this script on another computer (which it doesn't run on now btw) but I don't know which dll's I should register, or what else I should do, to run the CreateObject command. How can I figure out what dll's I need to copy into the new computer, and do...

How to determine the language currently in use for browser in classic ASP?

Is there ASP code which can retrieve the users current language? In javascript I know this works... if (navigator.appName == 'Netscape') var language = navigator.language; else var language = navigator.userLanguage; But is there an equivalent for ASP/VBScript? ...

Regex with 'include' list and 'exclude' list

I have a sentence (words delimited by spaces). I then have two lists of phrases (full or partial words i.e. contain no spaces): one is an 'include' list and the other is an 'exclude' list. A matching sentence will contain all phrases in the 'include' list (overlaps are OK, case insensitive) and none of the phrases in the 'exclude' lis...

Make a directory and copy a file

In VBS how do you make a directory and then copy a file into it? Id like to make a folder in the root of C e.g. C:\folder and then copy a file from \server\folder\file.ext into that new folder ...

HTTP GET Request, ASP - I'm lost!

Hi, Using VBScript with ASP I am trying to set up an HTTP GET Request which will visit a page which in turn generates a line of ASCII (non-HTML). I then want to extrapolate that ASCII line which will have 4 values delimited by semicolons back into 4 variables in my original ASP page so that I can take those values and do something with ...

Get current Sub name for a VB-script

Hi I am developing VBscript for GUI testing. And I wonder if there is possibilites to get the current Sub name. I have divied the GUI testing into different Sub and want to log the Sub name to the logg file to track what is run. So this i that I want Sub TestCase1 Log.Message(SubName) ' Rest of test End Sub By using this I don't...

Is there ways to create optional arguments to functions in vb script?

Is there ways to create optional arguments to functions in vb script allowing you to write functions something like... myFunc("happy") myFunc("happy", 1, 2, 3) myFunc("happy", 1) etc. ...

How to get program files environment setting from VBScript

In a batch file you can use %PROGRAMFILES% to get the location of the program files directory, how do you do it in a VBScript? ...

latest image upload asp.net 2.0 applet

hey everyone, I use the following coding to show six images from the latest photo album i uploaded picture to. However the images being shown are the 1st six images in the folder (which are the ones the oldest uploaded) not the final six images uploaded. Anyone can help me what should i change in the following coding to show the last si...

Classic ASP checkbox question

I understand that if the all the inputs being entered as a, b, and c and all the checkbox are checked then the output would look like this. response.write( request.form("a1") ) = a, b, c response.write( request.form("chk") ) = 1, 1, 1 Is there a way to determined if the corresponding input text checkbox is checked if not all checkbox ...

VBSCipt LOGON Script - Evaluate two items and map shares accordingly

I have a logon script mapping user drives Windows Network. Some users are now logging into a terminal server these days and I'd like to map a different drive, based on computer name they are logging in to. I am looking at which user AD group they are in (departmental group so I know which shares to map). If IsAMemberOf(objNetwork.UserD...

Traversing all nodes in an XML file with VBScript

I have written a VBScript which is supposed to tranverse all nodes in an XML file, irrespective of the depth of the tree. This it does well except that the node names for the those nodes which are 2 or more levels deep are not displayed. I need the node names as well as the values so that I have name/value pairs for further processing by...