Questions tagged [vbscript]
VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic. VBScript is not the same thing as VBA or VB.NET. They are three different things, so use the correct tags.
18,152
questions
0
votes
0answers
23 views
VB script - If clause with hex const [duplicate]
I'm analyse a VB script with a if clause I don't understand. It works like this:
Const current_status_01 = &H1480781
Const current_status_02 = &H204a2780
Const status_1 = &h00002000
Const ...
2
votes
0answers
50 views
How to hide / get rid of showing .cmd console and icon powershell while executing .vbs script to check numlock enabled? [duplicate]
I have code that I was able to do in .vbs:
If GetNumlockState() = True Then
Else
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{NUMLOCK}"
End If
...
2
votes
0answers
49 views
How to detect Word.Application.SaveAs timeouts?
I have a VBS script that converts a bunch of word (doc, dox, and docm) and powerpoint (pptx) files into PDFs, via Word and PowerPoint application objects and argument SaveAs.
That works fine, but for ...
0
votes
1answer
33 views
in vbscript an Error when using Regexp.Execute
In vbscript while using regular expression EXECUTE function, when there is a match the program proceeds, but when there is no match than the program throws an error and crashes. Is there a way of ...
0
votes
1answer
39 views
How to create an additional attribute in Active Directory from VBScript?
Is it possible to create an additional attribute in Active Directory from VBScript, or do I inevitably have to first create it in the AD Schema?
When I try to set a new attribute, let's say "...
1
vote
0answers
47 views
WINCC and SQL adding new elemnt in table
I've created a project in WINCC where i create table(examples are at bottom) and then put values of temperature transmiter in it, in cycles of one second. My problem is that after some time new data ...
0
votes
0answers
57 views
createObject of vbs vs Activator.CreateInstance of C# [duplicate]
I need to convert a vbs to C# application
The vbs contains the creation of a new object and it works
Set dllApp = CreateObject("MGCPCBReleaseEnvironmentLib.MGCPCBReleaseEnvServer")
I read ...
0
votes
1answer
37 views
How can I read a file and return the content as the result of a function? [duplicate]
I have two functions on Visual Basic for read and write one file
The problem is in the read Function. The return sentence doesn't return anything. I only want read the first line of the file
What Am i ...
1
vote
1answer
116 views
Script to detect if Windows System Locale is using UTF-8 code page?
On recent versions of Win10 it is possible to set the Active Code Page (ACP) to a UTF-8 code page.
And as discussed here, it is possible to set the System Locale (used to map between the "A" ...
0
votes
1answer
31 views
vbscript to read an attribute value in xml and change it depending on what the value is x2
I have a vbscript that changes the port value via cmd: cmd /c cscript "C:\Temp\port.vbs" 12
Heres the script:
Set xmlDoc = CreateObject("FILE.XMLDOM")
xmlDoc.Async = "False&...
3
votes
1answer
54 views
How to capture the output of command window using VBS and notify user with a played sound?
I have successfully managed to use VBS to open cmd for writing data to a database and pressing Enter key twice.
Here is my code:
Set wshshell = wscript.CreateObject("WScript.Shell")
...
0
votes
0answers
28 views
Is it possible to create List Report in Power Designer with granularity of calculated collection?
In SAP PowerDesigner I would like to create a List Report that would have granularity of calculated collection of Column object type. Is this possible?
By granularity of calculated collection I mean - ...
1
vote
0answers
25 views
Is it possible for a vbScript to know which host it is running under?
In my vbScript I would like to write to the command line or event log depending on how it is hosted (cScript or wScript).
If hosted under cScript, I branch to:
wScript.echo "useful message"
...
0
votes
0answers
28 views
where is the InstallerObject.RelatedProducts information is stored for MSI [duplicate]
I have a MSI installer built using WIX. The earlier version is uninstalled. But somehow there is a GUID left in the system and the MSI assumes that old version is available. And this check is wring as ...
-2
votes
2answers
83 views
Attempting to pass variable value to HTA Input box parameter value =
--------------------------------
In the above a selection is made from the lower input box populated from an array. On selection the corresponding index value from a second array is copied to the ...
-1
votes
1answer
52 views
VBScript file copy FileExists return false mounted drive drive
I am under the context of a script executed within an installation package MSI created with InstallShield. I execute the below script:
Set wshShell = CreateObject( "WScript.Shell" )
User = ...
-4
votes
1answer
38 views
Launching Multiple .vbs and .bat scripts at same time [closed]
I'm pretty new to .vbs and .bat, but is there a way to start multiple .vbs and .bat files at once with a few lines of script/code? The reason I'm asking this is because I'm trying to make a prank for ...
1
vote
1answer
47 views
Simulate Pressing Buttons On Keyboard With VBS (I need to force press “/”) [duplicate]
I need help force pressing the key "/" on the user's keyboard with VBS, however I can't seem to find anything to indicate whether this is possible or not. My code so far:
WScript.sleep 900
...
1
vote
1answer
64 views
create a shortcut using vbs, set to 'run as' admin [closed]
[terse]
I am looking for a method of setting a desktop shortcut to "Run As Administrator".
pseudo.code: object.Advanced = "Administrator"
[verbose]
I have scoured the web and ...
2
votes
0answers
69 views
How to move msgbox(vbs) random position [closed]
This is my first post. I only use vbs for things like pranks and tests and etc.
I wanted to make a self-duplicating msgbox just for a prank. since I want it to pop up at random places, I looked at ...
1
vote
2answers
110 views
Detecting the Shift + Enter keyboard combination in an textarea element [duplicate]
Following this question, I want to detect the Shift + Enter keyboard combination in an textarea element. Consider the code block below:
<!DOCTYPE html>
<html lang="en">
<head&...
1
vote
1answer
82 views
List all the wifi around me
I have barely started vbs so I am new. I need help trying to show all wifi networks available around me. I am trying to fit it all in one msgBox. Here is my code so far.
Set objShell = CreateObject(&...
0
votes
1answer
66 views
Can I eliminate VBS duplicated code via a global script?
I'm not overly familiar with VBS and not sure how to best approach this.
I've got this basic code to work whereby when a value from a machine >= 100 it send out an email. The WinCC triggers this ...
2
votes
1answer
42 views
How to open a Pdf with vbscript in Chrome and search by having a # in the url
Good day,
I am trying to open a pdf url using vbscript. The pdf is on a local pc. I am using vbscript to open the url and using chrome. In my Url I use a #Search=Register this will make the pdf open ...
0
votes
0answers
32 views
How to Autofit Contents all tables in Word Document with vbscript
I have a word document with several tables in it with variable column and rows
My Goal is to write a vbscript file which Autofits every table according to its context
Here is a image of the option ...
0
votes
0answers
17 views
Passing Text from Monitoring System to Email using vbs
Relatively new to .vbs scripting.
I am using a monitoring system to generate alerts and would like to put them into an email using .vbs. If I write the alerts to a text file, here is what I get:
...
1
vote
0answers
24 views
Delete file after reboot
Is there some vbscript that can perform a file exclusion after system reboot similar to MoveFileEx api with MOVEFILE_DELAY_UNTIL_REBOOT flag?
0
votes
1answer
59 views
Cant delete scheduled task with vbs [duplicate]
I create task with VBS, task create and run on time perfect
dim fso, f, pather, objShell
set objShell = Wscript.CreateObject("WScript.Shell")
Set fso = createObject("Scripting....
2
votes
2answers
125 views
Is there any way to decode this malware code from infected file?
I'm trying to decode these lines bellow inside "" ,
WriteBytes objFile, "5 240 23 65 0 68 210 237 0 136 29 26 60 65 203 232 214 76 0 0 104 224 218 64 255 232 216 164 0 0 131 196 4 83 28 ...
0
votes
1answer
54 views
How to monitor folder for file that begins with variable string in VBS [duplicate]
I have the following code in a VBS file. How can I monitor files in Folder1\Folder2\Folder3\2020 for files that begin with a specific string
file_starts_with = "abc" & Year(Now()) &...
0
votes
1answer
57 views
How to use variable name in WMI service query in VBS [duplicate]
How can I put the current year in CURRENT_YEAR so the folder I am monitoring is P:\\\\Folder1\\\\Folder2\\\\Folder3\\\\2020
I have the following code in a vbs file:
Set objWMIService = GetObject("...
0
votes
1answer
57 views
Pass user input from HTML into VBScript [duplicate]
I am trying to create a simple user interface in HTML that asks the user to enter an integer for a transfer volume. I want to use that input as a variable in a VBScript, but I keep getting a display ...
0
votes
1answer
27 views
Executing VBS file stored on a network drive through UFT
A VBScript file stored on shared network is to be utilized by UFT (which is installed on CITRIX)
In the below screenshot, Excel file at the same network location can be accessed but I'm unable to open ...
0
votes
1answer
44 views
Script Enterprise Architect, Adding parameters to methods in a class
Is there a way to add parameters to methods in a class.
I have a class as Element in a package. I want to add attributes, methods and its parameters to a class. The attributes and methods could be ...
0
votes
0answers
23 views
I'm trying to target the JavaScript Window Alert OK button from a VBScript [duplicate]
The VBScript is being run from Task Scheduler on the server and an Internet Explorer Object. When I try to use SENDKEYS Enter, the Internet Explorer isn't the currently selected window, so the Enter ...
0
votes
0answers
58 views
HTTP_RANGE is not working on video seek bar
I am trying to stream a mp4 file using ASP/VBscript. I use ADODB.Stream to lunch the file and some codes to detect that which range is requested by user. The video is being loaded successfully but by ...
3
votes
1answer
59 views
VBScript passing value by reference (VarPtr) to ActiveX function
I'm trying this:
Dim oApp
Dim iReturnedResult
Set oApp = CreateObject("Some.Application")
Set F_Ord = oApp.Documents.Open("Window 1", VarPtr(iReturnedResult))
The ActiveX ...
1
vote
1answer
87 views
What options can be specified in `.wsh` files?
I am following this nice tutorial, part of the "Microsoft Windows Script Host 2.0 Developer's Guide" online book by Günter Born. There he mentioned the interesting .wsh files where one can ...
0
votes
1answer
74 views
VBScript - Execute script for each value of array
I want to change the code below, so that it executes the sas guide project (.egp) and changes the parameter value according to the values of the array. (The idea is to open the project, run to the ...
3
votes
2answers
96 views
How does vbscript filesystemobject encode characters?
I have this vbscript code:
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile("tmp.txt", 2, True)
for i = 128 to 255
s = chr(i)
...
1
vote
2answers
52 views
Unable to use batch script to write to a .vbs script
I am using a batch script to create and write into a .vbs file.
The file is named invisible.vbs.
This is the batch script that creates and write the .vbs script.
echo.>"C:\Users\LinFamily\...
-2
votes
1answer
30 views
How Do I Assign Values of 2 or more Fields in VBScript [closed]
Hi sorry for a basic question on VBScript but after scouring the internet. In a If statement I am trying to assign values to 2 fields but when I run this code which is part of an application it does ...
0
votes
0answers
17 views
How to delete a line from a file, with out re-writing the whole file in VBS [duplicate]
In VBS I would like to delete a line from a file, either delete a specific line or overwrite that line with XXXXXXXXXXXX.
I have seen a number of solutions for this where you loop through each line of ...
-1
votes
1answer
32 views
Very slow finding a user in a Group AD VBS [duplicate]
when I try to find a user if is a member of a group it takes too long. Will it be possible to filter base DN for the LDAP search?
Here is the function.
' ***********************************************...
-2
votes
1answer
42 views
Running Jar File via VBScript [duplicate]
I have a jar file that I would like to run using VBScript. But I don't want to leave the command prompt open while the application is running.
Currently, I can achieve this by putting the java command ...
0
votes
0answers
35 views
convert xlsx to xlsb [duplicate]
Hello I have a code mentioned below. I am trying to refresh the connections and save the file with a different format of excel. So if i just refresh connections and close the file works completely ...
-3
votes
2answers
57 views
VBscript - Excel cannot find the value if it comes from a variable
My vbs script is to search excel columns to find the date 7 days from today. then it searches the rows for values and does some action.
below is the main part of the script that should work:
Set ...
1
vote
1answer
36 views
SendKeys not working until I close my program [duplicate]
When I launch a calculator emulator, it asks for the username and password. I want to fill these in automatically. My problem is, my SendKeys isn't activating until I close the program. If I launch ...
-2
votes
1answer
73 views
VBScript Error Type mismatch Code 800A000D [closed]
I copied a script to create a Signature for Outlook and adjusted it to my needs, which surprisingly works quite well, unless for one thing. When I try to insert the Mobile Phone number out of the ...
-1
votes
1answer
55 views
Add a space after every character in VBS [duplicate]
I want to have an input box, you type in a string and it gives you an output but there is a space after every character (even spaces).
Example:
"Hello There." → "H e l l o T h e r e .&...