vbscript

Problems with VBScript - RegRead when running as a service

I am working on a script that runs under a custom installation utility, which is running as a service. To get the current user name the script executes this command: str_Acct_Name_Val = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Logon User Name" str_Acct_Name = RegRead(str_Acct_Name_Val) When I run the script from the c...

How to modify a .png image with VBScript

I have a need to select a portion of a .png file, with specific cordinators, and delete this area then save the file back with the same name. I would appreciate if you can help to come up with a VBScript script that can accomplish this task. It would be great if all proesses happen in the background, but it would be ok too if the image f...

What does the "On Error Resume Next" statement do?

I came to some VBScript examples, and I saw the statement On Error Resume Next basically at the beginning of the script. What does it do? ...

UNION SQL Statement in VBScript

I wrote a little script to get info out if MSI files. It works fine for simple SELECT statements. However when I use the following one it doesn't SELECT Dialog_, Control, Text FROM Control UNION SELECT 'UIText',Key,Text from UIText I get the error msg Microsoft VBScript runtime error 1A8: Object required I open the Database like th...

Looking for the name of a design pattern

VBScript guarantees that the GC will run after every line, so if you create an object and don't keep a reference, its destructor will be called at the end of the line. This allows you to do a number of interesting things, one of which is simulating optional arguments: with foo(mandatoryArg) .optArg = 42 end Another is allowing for...

Is there "\n" equivalent in VBscript?

I want to use the Replace function in VBScript to replacea all line breaks in a string for "\n". I come from java, so using \n inside a string means a line break. Is there an equivalent in VBScript? ...

Suspicious value from WMI Win32_PerfRawData_PerfOS_PagingFile PercentUsage figure.

I've written a little VBScript program to query the page file usage under Windows XP (eventually 2003/2008 Server as well) but the figures I seem to be getting are bizarre. This is the program: Set wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") for i = 1 to 10 Set qry1 = wmi.ExecQuery ("Select * from Wi...

Passing Vbscript to Javascript

Hello, I'm using VbScript to get the current hour from the server, then want to pass it to a JavaScript function as shown below. Can you please advise as to the correct way to write this. <% Dim currentHour currentHour = Hour(Now) %> <script type="text/javascript"> $(function() { var dd = 0 var dsc = ('"&currentHour&"'); if (dsc...

How do I get the dropdown menu to see all the functions in vs2008 When using VBSCRIPT

I wanted to know how do get the dropdown menu that shows all the function so I can browse easily between them in visual studio 2008 when coding in vbscript. I have it in C++ but I have no idea of how to get it to show for VBScript. Thank you. ...

string incorrectly translated by ado

I have a database with collation SQL_Latin1_General_CP1_CI_AS. In that database I have a varchar field. There is a row in that database with the string "ó" (single character 243 in codepage 1252). I have a simple ASP page that sets the codepage to 65001, reads that row (using adodb), and sends it out to the browser. Everything works ...

vbscript to launch internet explorer, navigate to URL and click button

I have been scraping the Internet for some solution to this problem with no success. I need to use vbscript to launch a URL within Internet Explorer and click a button. The challenge that I am having is that the button has no id or name. It only has a specified type and value. I have tried different methods with no success. I would love ...

How to control Windows system volume using JScript or VBScript?

I want to control the volume of my Windows system from a JScript or VBScript script. Any ideas? Also, can I unmute the system volume if it is muted? ...

Problem with porting VBScript from WinXP to Win7

Hi. The attached VBScript displays all available WiFi networks. It works fine on WinXP, but doesn't work on Win7. On WinXP it shows a list of all available WiFi networks, however on WIn7 it shows an empty list. What is the problem? on error resume next set objSWbemServices = GetObject("winmgmts:\\.\root\wmi") set colInstances = objSw...

VBScript Error when calling GetObject("WinNT://JohnDoe,User")

I have code that hasn't been touched in over a year, but the DCs were upgraded from 2008 to 2008 R2. The AD folks claim it’s not the DC upgrade but the issue started promptly after that went in. Microsoft VBScript runtime error '800a0046' Permission denied: 'GetObject' It's failing on the Set Group line. Set Group = GetObject("W...

Does VBScript have a substring() function?

Is there a substring() function in VBScript similar to Java's string.substring()? ...

Add an image element to a td using vbscript

Does anyone know how to add an Image on a td element using vbscript? I need to add a "img" element, not a background image, and it has to be vbscript. <script type="text/vbscript"> function onload() '//Add Image to td1 end function <script> <table> <tr> <td id="td1"></td> </tr> </table> Can anybody help me? Thanks in advance. ...

javascript vbcript seek eof

Hello, I am writing a destop script on windows 2003 and I need to open a file and seek to the end of it and read the last line. I looked for a "seek" but couldn't find. I saw the openTextFile for option but didn't have. I implement it by openning the file with the red flag and then reading line after line. With big file it takes a ti...

Script to start subscribers synchronizing

When I want to force an update of the subscribers to my merge replication publication, I can go into the Replication Monitor, right click on the subscription, and choose Start Synchronizing. I'd like to be able to script this (using vba/vbscript or a command line). I'd also like users to be able to run the script (what permissions woul...

Write Chinese chars to a text file using vbscript

I'm trying to write some Chinese characters to a text file using Set myFSO = CreateObject("Scripting.FileSystemObject") Set outputFile = myFSO.OpenTextFile(getOutputName(Argument, getMsiFileName(Wscript.Arguments)), forWriting, True) outputFile.WriteLine( s ) variable s contains Chinese character that I read from other file. I echo ...

Char to UTF code in vbscript

I'd like to create a .properties file to be used in a Java program from a VBScript. I'm going to use some strings in languages that use characters outside the ASCII map. So, I need to replace these characters for its UTF code. This would be \u0061 for a, \u0062 fro b and so on. Is there a way to get the UTF code for a char in VBScript? ...