vbscript

WinPE 2.0 (Vista) - Looking for a solution for BrowseForFolder using VBSCRIPT & HTA application

Hi, I am creating an HTA application to be run inside of a WinPE 2.0 environment. The purpose of this HTA app is to prompt the user to select a back-up location. I am currently using BrowseForFolder to prompt the user folder location. Script works fine in Vista. However, this does not work in winpe 2.0 - and a dialog appears with n...

What's the difference between "<%" and "<%=" in embedded VBScript?

I am working on a code base which as VBScript code embedded in HTML. I've noticed the following two different tags around said lines of code <%= MyFunc(val1) %> and <% MyFunc(val1) %> What is the difference in using the "=" character at the beginning of these sections? ...

How do I turn a .NET System.String into a string usable by VBScript?

I'm trying to call a .NET component using interop from a classic ASP page (VBScript). If a .NET function returns a "System.String", is there a way for me to use that as a VBScript string? Is there something I need to do to convert it? ...

Can I use the .NET Framework from JavaScript (JScript) or VBScript?

I want to write a script that can run on a vanilla Windows (XP or later) system and call methods in an installed (GAC'd) .NET assembly. (I need to deliver the script to other people and I don't want to assume that they have anything in particular installed (other than the the assembly in question). Can I use JavaScript (JScript) or VBS...

Writing to the history of a SQL Agent Job

Having just created a SQL Agent Job I thought it would be handy to be able to write a little bit of information into the job's history, in case I wanted to check it later. I was using VBScript in this instance, and noted that I could use the Error object to record info in the history, for example: Err.Raise 999, "The code died" If yo...

How does one loop through a set of string value names in a registry key?

Hey all, I need to use VBScript and loop through a set of registry string value names located within a specific key such as: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" and delete all the string values except for ones that I specifiy. I was able to successfully delete a specific string value using DeleteValue and...

ASP Round function not behaving as expected

I'm rounding up my decimal values to integer values ex: I have 5 numbers whose % sum should end up being 100% but i get 101% my values are 11.11111, 80.55555, 5.55555, 2.77777 and on rounding them i get 11, 81, 6, 3 => 101 In above for example 5.555556 rounds up to 6 (correct value) but is screwing up my total for percentage wh...

save all email attachments in outlook folder to folder

Hi, I have about 80 emails, all with attachments which I would like to save to a folder on my hard drive. Rather than open each message and go to save attachments, I'm looking for a script that can do this? Anyone know of how this can be done? Thanks, ...

Passing objects as arguments in VBScript

I'm working on a project to capture various disk performance metrics using VBScript and would like to use a sub procedure with an object as an argument. In the following code samples the object I'm referring to is objitem.AvgDiskQueueLength which will provide a value for the disk queue length. I haven't found a way to make it work since ...

Using xcopy in VBScript

This is a follow-up to my previous questions (Copy Update Create VBScript and File Folder copy). So far I have the following script to copy files using xcopy: Set objFSO = CreateObject("Scripting.FileSystemObject") Set wshShell = WScript.CreateObject("WScript.Shell") strUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%") ' Disco...

ADO Recordset Decimal value issue

I have code similar to Dim A, B, C Set rs = Server.CreateObject("ADODB.Recordset") strSql = "Exec [dbo].[some_sp] IND" rs.open strSql,CN,3,3 Do While Not rs.EOF 'these columns are returned as decimal(10,2) format A = rs("col1") B = rs("col2") rs.MoveNext Loop C = A + B 'i get type mismatch error here And I used response.write to c...

What is the C# analog of this VBScript code that checks the Active Directory password expiration?

I have the following VBScript script that checks the password expiration of an Active Directory user account. Could someone please help me convert this code to C#? Thanks a lot. Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000 Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D Const ONE_HUNDRED_NANOSECOND = .000000100 Const SECONDS_IN_DAY ...

Automate an application using VBScript

I am new to VB Scripting. I want the VB script to act according to an event of an application. Eg : The VBScript should wait till a popup message appears in an application. ...

Find and replace string in my text with VBScript

I am searching for a VBScript that does a search and replace in files (e.g. 1.txt 2.xml). I have file "1.txt" that inside there is the word "temporary" and I want to change it to "permanent". Because I get this file a lot I need a script for it. Every time that I try to write a script that contains open a txt file and the command replac...

VBScript Issue in ASP.net page

Hello, I have a VBScript function in my ASP.net Page I have a small test function as shown below <script type="text/vbscript"> sub testmePlease() msgbox("Hello World") end sub </script> I have a button in my webform and I am calling the function onclientclick as shown below <asp:Button ID="btnAccept" runat="...

Creating a .NET StreamWriter object from classic ASP - constructor parameter problem

I'm trying to create and use a .NET StreamWriter object inside a classic ASP page (VBScript). Normally I would create the object like this: Dim writer Set writer = Server.CreateObject("System.IO.StreamWriter") However, the constructor for StreamWriter takes a Stream object as a parameter, and the call to CreateObject fails. Even if I...

How to measure code execution time in VBScript or JavaScript?

What is a good way to measure code execution time in VBScript? Or failing that how to do it in JavaScript? ...

How do I call DotNetFactory from VBScript in a stand-alone .vbs file?

I've been exploring options for expanding my QuickTest Professional scripting capabilities, and came across this article this morning, so I decided to experiment a bit. The code below works fine when executed inside the QTP environment, but I could see a use for this outside of the QTP environment as well. Unfortunately, it is causing an...

How to print directly to label printer from Internet Explorer without prompt

I have a mysql database containing upc numbers that I would like to print to labels with a zebra printer (LP2824). I would like to somehow be able to send those numbers directly to my label printer, which is not the default printer without the user being prompted. As far as I can tell, IE is the only option as some type of activeX contr...

Batch File and VBS script not Getting URL

I have a .bat file that I run every night to "hit" a webpage. The batch file has one argument, the URL webrun.vbs http://www.... Here is the webrun.vbs script below. Anyway, I'm running this script on two servers. One has DNS set up and is accessed like http://www.domainname.com The other server doesn't have DNS set up yet and is ...