FAQ Database Discussion Community


Batch Get specific PID

batch-file,vbscript,pid
I am trying to kill a vbscript from Batch, and I got this so far: for /f "tokens=2" %%a in ('tasklist^|find /i "wscript.exe"') do (set pid=%%a) That gets a wscript PID, so I guess if there is more than one running wscript it will just take a random? I do...

Get a process path with VBS

vbscript,process
I want to kill a process with vbs, i know the command is : oShell.Run "taskkill /im software.exe", , True how to get software.exe path before we kill it ? Because i want to launch software.exe again....

how to edit XML files in batch / python

python,xml,batch-file,vbscript,fetch
I'm trying to edit xml files in a batch / python script this is my xml file: <?xml version="1.0" encoding="UTF-8"?> <task name="analyse"> <taskInfo taskId="21a09311-ade3-4e9a-af21-d13be8b7ba45" runAt="2015-05-20 13:48:50" runTime="5 minutes, 53 seconds"> <project name="13955 - HMI Volvo Truck PA15" number="e20d51c0-71dc-4572-8f9b-4c150bf35222" /> <language lcid="1031" name="German (Germany)" /> <tm name="ENG-DEU_en-GB_de-DE.sdltm" /> <settings reportInternalFuzzyLeverage="yes" reportLockedSegments="no"...

for each loop: how to step out of conditions

loops,vbscript,condition
I am stuck at creating a loop for testing filenames with VBScript. To be precise, I am trying to perform something like a jump in a For Each loop. The loop should test all files in a folder and in some cases it should delete some files. But while running,...

Run VBScript from C# with hidden window and capture output

c#,vbscript
I am able to run VBScript from C# and capture standard output and error streams using this code: var process = new Process(); process.StartInfo.FileName = "cscript"; process.StartInfo.WorkingDirectory = @"C:\scripts\"; process.StartInfo.Arguments = "//B //Nologo vbscript.vbs"; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.UseShellExecute = false; process.Start(); ... This works fine but shows...

Close an HTA when the user presses the 'Esc' key

vbscript,hta,onkeyup
I'm trying to capture key presses so that I can close my HTA when the user presses the Esc key. I have confirmed that the onKeyUp event works (I also capture the length of an input), and also that the example below is not working (by adding a MsgBox which...

Searching multiple radio button collections in hta

loops,collections,vbscript,hta
Bellow is a hta/vbs code I wrote to dynamically build a form with radio buttons. The hta is launched by another vbs script that specifies the amount of radio button (yes/no) collections to create. The issue I'm having is in the Sub Write in the loop While x <= ItemListSize....

Extract data out of HTML table cell

html,vbscript,extract
I want to extract an information from a website (non-public intranet) with VBScript. It is a time which is always in the same field on the website, but each date different and afterwards I want to create with this information a meeting in my outlook (duration always exactly 1 hour)...

Changing Whole Page Color via COM object

vbscript,ms-word
I am trying to change the whole page color in MS Word using VBScript COM interface. But the code does not seem to work. I tried the following code: Option Explicit ' Variables Dim objDoc, objFile, objWord ' Create a Word object Set objWord = CreateObject( "Word.Application" ) ' Now...

Selection skipping node on missing childnode

xpath,vbscript,xml-parsing
Here is my XML file: <?xml version="1.0" encoding="iso-8859-1" ?> <data> <metadata> <sector>weather</sector> <title>sourceTitle</title> </metadata> <weather> <countries> <country code="AU" name="Australia" region="Oceania"> <location type="APLOC" code="6700" name="Addington" state="VIC" postcode="3352"> <point_forecasts type="TWC"> <related_location type="TWCID" code="9508" name="Ballarat" state="VIC"> </related_location> <point_forecast...

List USB Devices Like \\?\Device\HarddiskX\PartitionY VBScript

vbscript
Is there any way to get list of connected USB devices in "\?\Device\HarddiskX\PartitionY" Format?

Creating AD-Users from VBScript -> Error Code 0

vbscript,active-directory
I am running into a strange error in VBScript: [...] objUser.sAMAccountName = strNTName On Error Resume Next objUser.SetInfo If (Err.Number <> 0) Then On Error GoTo 0 Wscript.Echo "Unable to create user with NT name: " & strNTName & " - Error-Code: " & Err.Number & " (sAMAccountName)" Else [...]...

Why does VarType() ALWAYS return 8204 for Arrays

vbscript,documentation
In the VarType MSDN Microsoft documentation for VBScript's VarType function it says (With bold emphasis): "Remarks The VarType function never returns the value for Array by itself. It is always added to some other value to indicate an array of a particular type. The value for Variant is only returned...

Cast and Convert functions are not supported on converting the column to date time format (in vbscript - Excel adodb)

sql,excel,datetime,vbscript,adodb
I have written a vbscript to connect the excel file (.xlsx) as a database using ADODB connection. I want to extract the records from excel file which has the values in 'StartDate' column greater than '15/05/2015', but on executing a adodb query an error is thrown as "Data type mismatch...

Append text to text file if it already exists

vbscript
I have a script which is working, to replace some characters in a fixed width file (starting from row 2 onward). What want to avoid overwriting the target file if it already exists. Instead, if it exists, to append the rows (from row 2 onwards of the source file) to...

Write names of files in a folder that have been created/modified today to text file

vbscript
I have written a VBScript to write all the file names in a folder to a text file, but what I actually want is a listing of only the names of .txt files in a specific folder that have been modified or created today. The code: Dim fso Dim ObjFolder...

VBS (MSGBOX)- How can I add multiple attribute numbers (such as 16)

vbscript
I want to create a VBS script that has a message box with multiple numerical attributes, for example having a message box with the 16 icon as well as the 2 value (Abort,Retry,Ignore) In other words, I would want to combine the following two scripts into one. lol=msgbox("Body message",16,"Title") with...

How can I go back one step when processing a list of (user) choices?

vbscript,back,inputbox
I have a series of user choices (implemented as input boxes). Short Example: Answer = InputBox("Choose: 1 - One 2 - Two", "Choose")) If Answer = "1" Then Answer = InputBox("Choose: 1 - Hi 2 - Hello", "Choose")) If Answer = "1" Then.... I want to know if VBScript can...

objShell error, and Shutdown

vbscript
When I try to open this I get this error: 'objShell 800A01A8' I have no clue what it is, but it is quite annoying as it worked just before. Here is my code: WScript.Sleep 0 Const wshYes = 6 Const wshNo = 7 Const wshYesNoDialog = 4 Const wshQuestionMark =...

Close Open Excel Instance

vbscript
Could someone please let me know if the following simple VBScript is correct? It is supposed to close Excel after other processes have run (and left Excel open), but it doesn't work. Set MyApp = CreateObject("Excel.Application") MyApp.Quit ...

VBA produced HYPERLINK formula doesn't actually create workable hyperlink

excel,excel-vba,hyperlink,vbscript
I'm trying to generate a HYPERLINK formula via VBA but when I click on the resulting link I get an Excel error message "Cannot open the specific file." I tried this but same results. This is my code to generate the link. wksUsersSheet.Range(COMMENTARY_COL & lngRowNow).FormulaR1C1 = "=HYPERLINK(" & Chr(34) &...

Unexpected result of StrComp when using vbTextCompare

vba,vbscript,qtp,hp-uft
The goal Compare two strings lexicographically, ignoring case. Possible solutions using StrComp Consider the following script: val1 = "test9999" val2 = "TEST_59895" LexCompare val1, val2, vbBinaryCompare LexCompare LCase(val1), LCase(val2), vbBinaryCompare LexCompare UCase(val1), UCase(val2), vbBinaryCompare LexCompare val1, val2, vbTextCompare LexCompare LCase(val1), LCase(val2), vbTextCompare LexCompare UCase(val1), UCase(val2), vbTextCompare WScript.Echo "ANSI values: '9'="...

How can I make a postgres role that has limited access, no insert update, but can do maintenance tasks like reindex and backups?

postgresql,security,vbscript
I have postgres 9.3 being installed with my windows desktop app on computers all over the place. I don't want Joe Script-kiddy looking at the pgpass.conf, getting the postgres password a running amuck in my Database. I was able to to make a backup role using this article but I...

vbscript to run command

command-line,vbscript
I'm trying to create a script that runs the command: RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255 Right now this errors out Dim objShell Set objShell = Wscript.CreateObject("WScript.Shell") sEXE = """C:\Windows\system32\RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255 """ with CreateObject("WScript.Shell") .Run sEXE & " " , 1, true end with Wscript.Quit Any suggestions? Could I make the script...

Script to query AD for next available computer name fails with error “Loop without Do”

vbscript
I found this VBScript online that is supposed to Query AD for the next available computer name. When I tried to run it I get the following error: Line 51 character 1 Loop without Do The script in question is: StrAvailableName = FindAvailableName("TestWS") Function FindAvailableName(StrPrefix) '***************************************** '* Search for an...

aClassic ASP : How to locate an specific order in array, or record-set. Then move Next or Previous, starting from that order

arrays,vbscript,asp-classic,ado,recordset
I have done a bit of work on my code, and still unsure about how some of the code needs to be done in order to work. So far I got a function named FunctionUp' coded, this is the code that will go in the following sequence: If array of...

Disable “Make new folder” in Select Folder Dialog

vbscript
I'm making a script that uses the dialog box below to select the folder where this run commands the problem is that it is not necessary as an option to create a new folder ... I wonder how can I remove the "make new folder"? My Code: Option Explicit Dim...

How to click a plain button on a webpage using VBScript?

vbscript
I have a button on an website like this <button> Like </button> Does anyone know how to find and click this button using VBScript? Since he have no ID or other things I don't know how to find the button....

Run application.commandbars() outside excel or word

excel,vba,vbscript,ms-word
i'm trying to figure out a way to run a simple line of vba code like: application.commandbars("research").enabled = false without opening excel or word (i would like to ref this line of code both for excel and word) i was thinking of creating a word / excel object in vbs...

How to delete chars in string by position only?

regex,vbscript
I need a regex search & replace pair that will delete 'n' characters from a string, starting at some definable location. For example, to delete 3 characters starting at position 5. In that case the string AAA. 01 Data From July would become AAA. Data from July (Don't know if...

Record without adding to repository?

vbscript,qtp,hp-uft
Imagine creating a new QTP project. You hit record to get your first bit of code in place. By default, you'll get something like: Browser("MyApp").Page("MyPage").WebEdit("MyLogin").Set "Bob" And you'll get the Browser, Page, and WebEdit objects automatically added to the repository. What I would like to be able to do, as...

Write an Entire Array with a Single Write

arrays,vbscript
This may be a very trivial question, but I cannot seem to find the answer on Google. Is there a way to write an entire array of strings to a file without having to loop through the array in VBScript?...

Error Type: Microsoft VBScript runtime (0x800A01A8) Object required in asp

vbscript,asp-classic
I m new asp.. And tried to access with code But it shows error like this., Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: '' on line 163 The error showed because of this lines, <% do while not getgroups2.eof pkOrgGroups2=getgroups2("pkOrgGroups") ogGroup2=getgroups2("ogGroup") ogLogo2 =getgroups2("ogLogo") %> May i know for which...

Microsoft VB Compilation Error

vbscript
I am learner to vbscripting and as a beginner trying to execute the below code. But I keep getting the compilation error [Please see error message below]. I am not sure as I do not see any error in the code. Also, I made sure that I type in all...

remove button and use dropdown box in hta-vbscript

vbscript,hta
I am fairly new to hta & vbscript. I have a **hta** script downloaded from internet to delay reboot of computer. There are button for delay such as 30 min, 45 min, 60 min etc. I would like to use combobox(Dropdown box) instead of button. I also want my vbscript...

Listening to 2 senders on the same USB Port using Docklight

vbscript,port,serial-communication,usbserial,docklight
I am currently working on a script in docklight v2.0. My setup is the following: I have a splitter connected in the USB port of my PC. That splitter is connected on a wire on which a communication is made between 2 devices. Docklight is connected on the USB port...

Operators suddenly not working

time,vbscript,operators
A week ago I wrote this script which starts up when you log in and then greets you according to the time of the day. This morning it suddenly suddenly said: "Invalid time" (it would do that if all other elseif options wouldn't match the time). This used to work...

Exception to overwrite

vbscript
I have a VBScript - if I run it I do not want it repeating the words it is replacing. Is there an If statement I can add to stop it doing this? Option Explicit Const ForReading = 1 Const ForWriting = 2 Dim objFSO,objFile,strText,strNewText Set objFSO = CreateObject("Scripting.FileSystemObject") Set...

Can't read first row of CSV file

csv,vbscript,imacros
I can't figure out why my script is not reading and storing the first row of the CSV file. It is starting with the second row for some reason. I have the following code (reading from a 2 column CSV file): Set rs = CreateObject("ADOR.Recordset") 'this just gets the folder...

Script works on its own but not as a subroutine of a bigger program

vbscript
I have written the following code, tested it, and it works. I then literally copied and pasted it into a larger program as a sub. I'm getting a Type mismatch on the Split Function now. I copied & pasted it out of the subroutine and into a new file and...

How to insert a Hyperlinks VBScript

html,hyperlink,vbscript
This is my signature script. I need to put a Hyperlink in the LinkedIn image. How can i do it? htmlfile.WriteLine(" <p class=MsoNormal><!--[if gte vml 1]><v:shape id=""Picture_x0020_2"" o:spid=""_x0000_i1026""") htmlfile.WriteLine(" type=""#_x0000_t75"" style='width:13.5pt;height:13.5pt;visibility:visible;") htmlfile.WriteLine(" mso-wrap-style:square'>") htmlfile.WriteLine(" <v:imagedata src=""BBCR_arquivos/image002.jpg"" o:title=""""/>") htmlfile.WriteLine(" </v:shape><![endif]--><![if...

VBS- Can I exit a VBS message box that repeats itself without going to the task manager or cmd?

vbscript,taskkill
I have a message box that repeats itself whenever you click ok- which is the only option, by the way. My code: 'Very Annoying script' Set objShell = CreateObject("Wscript.Shell") intMessage = Msgbox("Click ok to say yes",16, "Is this messagebox annoying?") If intMessage = vbOK Then RETRY Else Wscript.Quit End If...

Cannot log WinZip command line process

logging,command-line,vbscript,zip,winzip
I got the following vbscript test code that zip some test files via WinZip Command Line: Dim strWinZipDir, strZipFileToCreate, strFilesToZip, strWinZip, strCommand strWinZipDir = "C:\Program Files\WinZip\Winzip32.exe" strZipFileToCreate = "C:\Users\ext_dirmod_01\Desktop\TestLog.zip" strFilesToZip = """C:\Users\ext_dirmod_01\Desktop\FacturasGRA.vbs"" ""C:\Users\ext_dirmod_01\Desktop\Test Zip Windows.vbs""" Set objFSO = CreateObject("Scripting.FileSystemObject") strWinZip = objFSO.GetFile(strWinZipDir).ShortPath strCommand = strWinzip & "...

Get dates from AUT?

date,vbscript,locale,qtp,hp-uft
My Web-based application (like most) follows the browser locale to format dates. So if you configure British English as the preferred language in the browser, the app will display dates in "DD/MM/YYYY" format. Now QTP (ok, it´s VBScript that is the culprit) does not know about this. It strictly follows...

transfer CurrentDirectory from un-elevated script to elevated one

vbscript,uac
I need to copy my file "manufacturer.bmp", wich is located in the same directory as the script (in my flash drive), to the system32 directory. I succeed, in getting the variables sourcefile, destinationdirectory, and to elevate my script, but when I elevate it, my sourcefile variable is lost, because of...

Classic ASP & Access DB - FROM Clause Error

ms-access,vbscript,asp-classic
it's the first time I post here and hopefully my english will be understood by everyone, I'm trying to create a site in VBScript (classic ASP) based on MS Access, with CSS and Some Ajax/Jquery. I got to the point of managing logins & sessions, so created a pop-up form...

same server, get url: vbscript msxml3.dll 80004005 unspecified error, or msxml6.dll error '80072ee6' System error: -2147012890

vbscript,iis-6,serverxmlhttp
What's the correct way to get the output of an asp page located on the same server? <% GetUrl "/route/to/abc/123/" Function GetUrl(url) Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0") objXMLHTTP.open "GET", URL, false objXMLHTTP.send() If objXMLHTTP.Status = 200 Then Response.Write objXMLHTTP.ResponseText End if Set objXMLHTTP = Nothing End Function %> results in this...

Iterate through the folder and find a particular file

vbscript,folders,subfolder
I have written this code to iterate through the folders and exit the function when it finds the ".c" file. Ideally it should return the path of the ".c" file. But its returning empty string. tval = 1 Function findStlcode(objFSO,fFolder,folderName) Set objFSO = CreateObject("Scripting.FileSystemObject") Set Folder = objFSO.GetFolder(fFolder) Set colfiles...

Give HTML time to render its text

javascript,html,internet-explorer,vbscript,hta
I have a very long VBScript code which runs in an HTA. The script includes DOM manipulation, DLL calls, and other scrips. Now I had a problem because it takes a significant amount of time to render the text on screen because there are a lot of scripts that pause...

How to call csImageFile.dll (com) functions in c#

c#,asp.net,dll,vbscript
I want to convert a classic asp / VB script code section to c#. The code uses a dll csImageFile.dll that specifically merge multiple tif images Legacy function nPage = 1 Set csImg = Server.CreateObject("csImageFile.Manage") do while not rs.eof csImg.ReadStream "tif", rs("imagedata").value csImg.AddToTif nPage nPage = nPage + 1 rs.movenext...

copy file from network share to all windows users desktops on all network computers

windows,powershell,vbscript,network-shares
Essentially, I would like to do something like this (using command prompt merely for a visual example, will gladly try PowerShell/VBScript/other programming methods)... xcopy "\\thisserver\share\something.txt" "\\computer1\c$\users\dude\Desktop\*.*" /Y xcopy "\\thisserver\share\something.txt" "\\computer2\c$\users\dudeette\Desktop\*.*" /Y ... In fact, if I could take it a step further to simply the code, I would like to...

Find and replace with a regular expression in a text file

regex,vbscript,jenkins
I am building a jenkins jobs for build comparison. I want to replace double newline (\n\n) in the text file with single new line (\n). After that I want to replace every instance of word "commit" with a newline and commit i.e "\ncommit". I want to use a vbscript for...

How to run a script on startup in hidden mode

batch-file,vbscript,windows-8.1,startup
I have a batch file, named prova.bat, and I need to launch it at the startup of the computer, and I need to launch it in hidden mode (with no visible prompt). I have found on the net solutions to launch the batch at the startup OR solutions to launch...

How to get target path of a junction?

vbscript,junction
I have a folder C:\the Junction\test, which is actually a junction, and the real path (target) is D:\the real\path\to\the folder. How can I find out that real target path in VBScript?...

Why is my source folder and destination folder merging names? I want source folder inside my destination

vbscript,folders,copying,file-copying
Dim WshNetwork,objNetwork, WshShell, objFSO, objItem Set objNetwork = CreateObject("Wscript.Network") Set WshNetwork = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set WSHShell = CreateObject("WScript.Shell") If not objFSO.FolderExists("C:\Backups") Then objFSO.CreateFolder "C:\Backups" Else End If If not objFSO.FolderExists("C:\Backups\" & strUserName) Then objFSO.CreateFolder ("C:\Backups\" & strUserName) Else End If Set FSO = CreateObject("Scripting.FileSystemObject") strUserName =...

Regular expression to substitute a pattern in VB script

regex,vbscript,expression
I am trying to write a regular expression in VB script to substitute some patterns. My string may contain zero or more following patterns - &USERID &amp;USERID &USERID. &amp;USERID. &USERID(n) &amp;USERID(n) &USERID(n). &amp;USERID(n). &USERID(n1, n2) &amp;USERID(n1, n2) &USERID(n1, n2). &amp;USERID(n1, n2). Sample string - C:\temp\&USERID_&amp;USERID._&USERID(4)_&USERID(2,2)..txt If USERID=ABCDEF, then once substituted...

Unzip files that begin with a particular string

vbscript,wildcard,unzip
This is my second attempt at cracking this problem I am facing. In a nutshell I get some files sent to me on a weekly basis which begin with the same 11 characters and anything after that can differ from week to week. I have some basic code that unzips...

Populate GPO from Text File using VBScript or other

vbscript,text-files,group-policy,gpo
Ok, so we need to create a GPO that allows our users to only use specific programs. GPO Location: User Configuration Policies Administrative Templates [...] System Run only specified Windows applications Then setting the GPO to enabled and clicking on List of allowed applications --> Show... I have created an...

Batch icon message on task bar

batch-file,vbscript
Is it possible to make a Batch, or .vbs if needed, is it possible to make batch have a little icon down there with the flag, battery and volume. I want it to be a "Shutting down in xx minutes/hours", and mayyybbe clicking it cancels' it. Thanks in advance :)...

FormatCurrency giving different results on different pages in different browsers?

vbscript,asp-classic
Given the following VBscript code: FormatCurrency("123",2) written to an html page: <td><%= FormatCurrency("123",2) %></td> Both pages have the same charset "ISO-8859-1", and show the same behavior with charset "UTF-8". I am getting several results across browsers - IE10 and FireFox38 display the following: "Payment Page": £123.00 "Receipt Page": £123.00 while...

Return index of word in string

arrays,vb.net,vbscript
This code: Module Module1 Sub Main() ' Our input string. Dim animals As String = "cat, dog, bird" ' See if dog is contained in the string. If Not animals.IndexOf("dog") = -1 Then Console.WriteLine(animals.IndexOf("dog")) End If End Sub End Module Return start position 5 in string But how to return...

how to get array string value using index in classic asp

arrays,vbscript,asp-classic
I need to retrieve one specific value from a list of values stored in an array using an index position value. This is the location reference coming from url parameter: Dim currentorder Dim nextorderindex Dim rowindex Dim iArray Dim i currentorder = Trim(Request.QueryString("order")) rowindex = CINT(Trim(Request.QueryString("rowindex"))) 'e.g. let's say this...

Use command-line arguments in VBS [duplicate]

batch-file,vbscript,cmd
This question already has an answer here: Using command line arguments in VBscript 2 answers I'm using the following VBS script to delete the first n number for line from a file: strInputFile = "*Filename.txt" Set objFSO = CreateObject("Scripting.FileSystemObject") Const intForReading = 1 Set objInputFile = objFSO.OpenTextFile(strInputFile, intForReading, False)...

Response.write in multiple place with same recordset

vb.net,vbscript,asp-classic
I have two divs <div class="selection mini"> <select name="selfromYear"> <option selected disabled>From</option> <option>1956</option> <option>1986</option> </select> </div> <div class="selection mini"> <select name="selToYear"> <option selected disabled>To</option> <option>1956</option> <option>1986</option> </select> </div> And I want to fill them with same fields <div class="selection mini"> <select...

Read POSTed Binary File And Write To a New Binary File

excel,vbscript,asp-classic
I'm creating a web page that will allow user to upload files to the server. I was able to save the file on the server, but I notice that the office files (e.g. word, excel) are corrupted and can not be opened. My UI is fairly simple <form method="post" enctype="multipart/form-data"...

VBS FileSystemObject.DeleteFolder Path does not exists, yet FileSystemObject.FolderExists is true

vbscript,filesystemobject
I'm close to going insane. I have a configuration of code in VBS and it throws an error that should be logically impossible. Check this code: (You need at least 10 reputation to post images. Well that sure is helpful.) http://i.stack.imgur.com/jjNDm.png If the folder revFolder exists, then (force) delete it....

WshShell.SendKeys - SLASH not allowed?

vbscript,sendkeys
Today I am having difficulties with this following code: x=msgbox("Your Text Here" ,0, "Your Title Here") UserName=inputbox("After this message, you have 5 seconds to switch to Minecraft. Please enter the username you wish to type the song to:") wscript.sleep 5000 WshShell.SendKeys "/msg" + UserName + "I know that we just...

Alternative of IN keyword of SQL in Siebel Server scripting for search spec?

sql,vbscript,siebel,escript
Does anyone know how can we filter BC results based on multiple values in search specification? As IN keyword in SQL ? something like: bc.SetSearchExpr("[Id] in ('a','b','c')"); Or use of OR operator is the only solution? ...

VBScript Regular Expression Insert Line

regex,vbscript
I try to insert a line between 2 specific lines in a files with VBScript : # Ligne 1 # Ligne 2 => # Ligne 1 # Ligne 1 bis # Ligne 2 My script code is : Dim regEx Set regEx = New RegExp regEx.Pattern = "# Ligne 1\r\n#...

How to replace text and symbols in a txt file?

vbscript
I have a web.config file and to change settings I have to manually go in and keep changing the code. What I have found so far is an example script I am trying to adapt: Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\Scripts\Text.txt", ForReading) strText = objFile.ReadAll objFile.Close strNewText =...

Populate fields in multiple dropdowns based on option selected from any drop down list using Classic ASP

sql,asp.net,sql-server,vbscript
I found this solution to populate one combobox, but what if i need to change multiple comboboxes lists? What is best performance will be? Run the same code with required query on each combobox opening each time new connection to Sql Get all row to vbscript array and work with...

VBScript to run a php script from task scheduler but minimized

php,batch-file,vbscript
Yesterday I asked you this question; Running a batch file from windows task scheduler, but hidden or minimized The answer I selected was one suggesting I'd make a VBScript and use that, to run the original .bat file that executed the php script. However, a comment on that suggestion, suggested...

Copy and replace simple text in a txt file using vbs

vbscript
When running the script below I see Error Line 2 Char 1 Invalid procedure call or argument please can someone advise: Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\Users\newtons\Desktop\Text.txt",ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, "Jim ", "James ") Set objFile = objFSO.OpenTextFile("C:\Users\newtons\Desktop\Text.txt",ForWriting) objFile.WriteLine strNewText objFile.Close ...

How to make vbscript popup message always-on-top?

vbscript
Anyone got a clue how to make a vbscript popup-message/box "spawn" on top of everything and not in the background...? This is my script: :) Set objShell = WScript.CreateObject("WScript.Shell") Const wshYes = 6 Const wshNo = 7 Const wshYesNoDialog = 4 Const wshQuestionMark = 32 intReturn = objShell.Popup("Vil du annulere...

Creating VBScript file Excel

excel,vba,vbscript
I don't have much knowledge in creating a VBScript file. I have a code i want to automate to send email out every month. With some research i found the code below: dim EXL set EXL = CreateObject("Excel.Application") 'not required EXL.Visible = true 'your file and macro EXL.Workbooks.Open "full path...

Garbage char returned by Shell.StdOut.ReadAll

batch-file,vbscript,stdout
Here is my code Set objFSO = CreateObject("Scripting.FileSystemObject") a = "@echo off && " & _ "pushd ""\\xxxxx.local\cfs\Development\Docs\Baseline"" &&" & _ "cls &&" & _ "dir /b /a-d &&" & _ "popd" Set objShell = CreateObject("WScript.Shell").Exec("%comspec% /c " & a) execStdOut = objShell.StdOut.ReadAll() msgbox execStdOut Basically I am trying to...

Publishing Excel as Webpage

excel,vbscript,webpage,publish
I am trying to save excel as a webpage using VB Script. The problem I am facing is the sheet names in excel (E.g. Sheet1) also gets saved in webpage. I don't want the sheet name to be present in webpage. One solution that I found was that if the...

getElementByID() parameter explanation

html,vbscript
Im looking at some automation scripts that were working with a web portal to save a lot of grunt work. The commands for selecting windows and such makes sense to me, however there are a lot of lines that look like Set oSelect = wndw.document.getElementById("pvBody:PageTemplate:innerHolder:ctrlAddPassword:ddlSafename") Or Set oSelect = wndw.document.getElementById("pvBody:PageTemplate:innerHolder:ctrlAddPassword:PasswordProperties:rptRequiredProperties:_ctl2:ctrlRequiredProperties:ddlValue")...

VBS - how to run two browser one is full screen and another is minimised?

shell,google-chrome,vbscript,windows-8.1
I have a kiosk where i need to run Chrome.exe as --kiosk and another Chrome.exe minimised. Using regedit run method VBS is executed. Problem is on reboot it is messed up always the minimised chrome.exe does not start as minimised, always its shows on top of --kiosk mode. How can...

Classic ASP and JQuery reloads default.asp page on redirect

javascript,jquery,vbscript,asp-classic
I have integrated an existing Classic ASP site with JQuery (they were using VBScript before). The previous version works fine but the script's needed to be updated so it will work on other browsers. But when I redirect the page with JQuery integrated, the system loads the default.asp file and...

Vbscript detect button in an new IE window

vbscript
I have a vbscript that opens an webpage, then clicks a button. That button opens a new popup webpage on a new window (notice: window not tab). I want after my script press the button and open a new window, to detect and click the button called id="pagesHeaderLikeButton" in that...

I need to create a C# based COM Server for consumption in VBScript

c#,.net,vbscript,com
I am creating a COM server .dll in C# (.NET 3.0 - external requirement). Some clients work well with it but others do not. Specifically, I'm having problems getting VBScript to like it. There are two primary components: a. an interface b. an implementation object they both have their own...

Convert XML tag to specific format

vbscript,asp-classic
I have one ASP file, which I have to read. After reading the ASP file I have to convert some XML format to some specific format. Below is my code: <% dim sbixml, html, oHtml, xml, xml_, http, api <sbixml> <NetSightMessage> <Header> <UserID>GARY</UserID> <Connection>Production</Connection> <CurrentLedgers GL="GL" JL="JL"/> <Mask>POUPPR</Mask> <SubSystem>Purchasing</SubSystem> <Trace...

SCOM Monitor not reporting

vbscript,windows2012,scom
I am running into a bit of an issue with SCOM. I have create the script below to monitor an application. It creates an entry in the Event log when the script runs and I have configured the alerts for a specific group in which the monitor is running on....

Error code 0x8000500D when trying to access PasswordLastChanged

vbscript,active-directory
I'm writing a VBScript that will simply check each user in AD if their password has been changed within a given number of days. When I was trying to get it working for a single user, I came up with the following working code: Option Explicit Dim objUser, strLDAPConnection, intPwdExpLimit...

How can I retrieve the LAN adapter MAC address?

windows,vbscript
I want to retrieve the MAC address from a Windows system, only for LAN Adapter. Can you suggest to me how I'd handle this in VBScript? I'm currently using this VBScript for getting the MAC address, but this is giving me results for all adapters, while I only want the...

Add class to an element within an HTML Application from within VBS function

css,dom,vbscript,hta
I have an HTA that is displayed when a backup routine is complete and I'd like to be able to manipulate the HTA via VBS, showing whether or not a series of folders were backed up correctly. So, using the ID of an element within the HTA, is it possible...

Powershell: Create LNK with Parameter

powershell,hyperlink,vbscript
I fell over this thread here and I tried to make that a funtion to create LNK-Files to Powershell-Scripts (because I am bored to make those manually). function MakeLink { param ( [Parameter(Mandatory=$true,Position=0)] [System.String] $Script ) $wshShellObject = New-Object -com WScript.Shell $userProfileFolder = (get-childitem env:USERPROFILE).Value $wshShellLink = $wshShellObject.CreateShortcut($userProfileFolder+"\Desktop\MeinLink.lnk") $wshShellLink.TargetPath =...

Using R1C1 formula in VBSCRIPT

excel,vbscript,sas
I create a excel document with SAS using VBSCRIPT. Here is the code that work : filename vbscript "&fich_trim..vbs"; DATA _NULL_; FILE vbscript; PUT "Dim Exc, Classeur"; put "Dim Col"; PUT "Set Exc = CreateObject(""Excel.Application"")"; PUT "Exc.Visible = False"; PUT "Set Classeur = Exc.Workbooks.Open (""&FICH_trim..XML"")"; do i = 4 to...

How can I get a one liner xcopy command to run in vbscript?

windows,batch-file,vbscript
I have an xcopy that cannot run correctly in a .bat (batch) file because of some Norwegian characters. The line is: xcopy /I /V /H /R /C /Y /K /O /X "G:\P - cad_files\Drawings\163997 Ø1000XØ90 T7-8-9.PDF" "F:\CAD\P - cad_files\Drawings\163997 Ø1000XØ90 T7-8-9.PDF" If I run it from a batch file it...

Can't open Saleslogix SLX connection

vbscript,asp-classic,saleslogix
I can't open a SLX connection with a Classic ASP (VBScript) page: Set connSlx = Server.CreateObject("ADODB.Connection") connSlx.open "Provider=SLXOLEDB.1;Password=pwd;User ID=uid;Initial Catalog=SLXDB;Data Source=192.168.100.1;PORT=1706;" Error: Provider error '80004005' Unspecified error If I open the SLX connection with an ASPX script and return to my Classic ASP page, the connection is working and I...

Script to Install Font in Windows XP

vbscript,windows-xp
I am trying to install fonts in windows XP using a VBScript. But for some reason my script works fine in Windows 7 but does not work in Windows XP. I need to install fonts without a system reboot so, I had to choose this approach instead of other registry...

Event in MSXML2.XMLHTTP

c#,vbscript,com
Does anyone know how MSXML2.XMLHTTP implement its event like onreadystatechange?Since I need construct a COM component with C# which will raise a event, but the client which use vbscript to call this COM object does not support WScript.CreateObject, so I can't handle the COM event. But I find that MSXML2.XMLHTTP's...

Download file from website with Batch

batch-file,vbscript
I am having problems with downloading files from the internet using a Batch script. I found the following pieces of code - though none of them seem to work xcopy /E /Y "https://website.com/file.bat" wget.exe --no-check-certificate https://website.com/file.bat I am trying to make my batch automatically fetch a file, but I am...

VBScript to detect Facebook IE window, press Like and close the window

facebook,internet-explorer,vbscript
I tryed to make a script to detect the IE window that is opened on Facebook and hit the Like button. Let's say I have 10 IE opened. Only one of them is on a page on Facebook. I want my script to detect that IE window, click this button:...

How to backup a text file with VBS

vbscript
I am getting permission denied error on line 22 but I assume this is because I am not admin, I have updated this with the advice below. Const DestinationFile = "C:\Users\newtons\Desktop\Mock programs\Mock Backup" Const SourceFile = "C:\Users\newtons\Desktop\Text.config" Set fso = CreateObject("Scripting.FileSystemObject") 'Check to see if the file already exists in...

VBScript Redirect to Network Folder

vbscript,asp-classic
I have taken over a web page recently I have some programming knowledge and can usually muddle my way through things but I cant seem to get it today. There is a snippet of code on the website that opens a folder on a network drive when a user opens...

Create a shortcut on the desktop that prompts before shutdown

vbscript,desktop,shortcuts
I need to create a shortcut in which I can be prompted if I would like to shut down windows (Action to shutdown when clicking ok). Any ideas? So far the working shutdown shortcut that I have does not issue the prompt a message asking if I truly want to...

How to detect after system boot if the service is running, if running then start my apps?

windows,vbscript
In VBScript is it possible to query a specific service name if it's started or running? if its running then execute finally my application. So here is how the flow i am trying to prepare: System is booted Windows 8.1 Startup script is executed (VBS) VBScript now wait and keep...

How can I find a node containing a sub-string?

xml,xpath,vbscript,asp-classic
I am able to find nodes in an XML file using the following statement: Set user = objXMLDoc.selectSingleNode("//user[@id = '" & id & "']") But the XML files I'm reading are being generated automatically and sometimes contain spaces after the ID. The id attribute of the user node might look...