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.
0
votes
0answers
3 views
rename a file using VBScript, launch file, wait, and rename again
I need to create a vbs script (for maintenance purposes) that renames foo.txt to a foo.bat and launch foo.bat and when foo.bat ends, rename foo.bat again to foo.txt
This is my script vbs:
Dim Fso
...
0
votes
0answers
6 views
VBS how to paste user input?
I want to get my vbs program to ask for user input using the command
Sl = InputBox("type something")
I then need later on to write down the user input into a link like
WshShell.SendKeys ("www.")
...
-1
votes
1answer
18 views
When I run a vbs bot it doesn't work becauuse it can't create an object so how to solve it? [on hold]
I am trying to make an internet bot for a little job but I don't know vbs that much and every time I try to run the code I have (800A01AD) error code.
Here is the code:
Set Webbrowser = CreateObject(...
0
votes
0answers
30 views
How to interrupt a VBScript [duplicate]
I copied this chat-bot from a YouTube video and was wondering, is there a way to sort of interrupt the code through, maybe a function key?
Set shell = CreateObject("WScript.Shell")
strtext = ...
-2
votes
0answers
23 views
Comparing two text files word by word using VB Script [on hold]
I am new to vb script.I need to compare two text files word by word using VBA script and save every different word in third file. For example if content of my first file is "My name is Shashank". And ...
-1
votes
0answers
27 views
drop down list to display all the files from the database using VBScript [on hold]
I am new to VBscript, i am trying to display all the project names that are in the database in a table called 'Projects'. I want to populate this data using vbscript from a sql query. when i run the ...
0
votes
1answer
24 views
VBScript to query namespace value and if % then run X.bat
I'm trying to VBScript a process to check the TPM namespace onboard a PC (because I believe it's not possible as a batch file) and if it's version 2.0, return a "YES" echo prompt but so far it appears ...
1
vote
0answers
27 views
Automation of Terminal Emulator using UFT 14.1
I am using for the first time in terminal emulator.
I have a scenario wherein I need to click on File -> Clone Session in Terminal Emulator screen.
This is a mouse event ,how to automate this using ...
-3
votes
0answers
26 views
How can I format the date to YYYYMMDD.csv [duplicate]
How can I format the date to YYYYMMDD.csv from this
Function Today_Date()
thisday = Replace(FormatDateTime(Date(), 2), "/", "")
End Function
0
votes
0answers
29 views
Sendkeys in VBS not working properly in telnet session
I am trying to right a VBS Code in which a telnet session opens and does the command and then saves the output in the telnet session.
My issue is when i run the .vbs file it runs and simultaneously ...
-2
votes
0answers
12 views
I have a requirement to select the day from Present Day to Next Day? The application is web and I am using UFT for Automation
I have a requirement to select the day from Present Day to Next Day? there any way to do this. the present day will be dynamic.
0
votes
0answers
20 views
Differences in QueryTables.add between VBS and Macro
I have a Macro that loads a flat file into the current sheet. It searches a subfolder for a .dat file of the same name as the active sheet and loads in the data. I want to transition this to a vbs ...
0
votes
0answers
20 views
Enumerating volumes and redirect output to a file [duplicate]
The following vbs code will list the drives as messages box, but I need it to redirect the output to an "output.txt" file.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = ...
0
votes
0answers
32 views
Getting Object required:'[object]' error while running VBScript [on hold]
The VBScript was running until yesterday but today it's not working. Now it's returning the error
object required: '[object]'
while running VBScript which is using Internet Explorer.
Line number ...
0
votes
0answers
9 views
How to check the foreground color of an object in uft 14
I have to check wheter the color of a text is black or white in a WPF application, using snoop I've discovered that the color is under the textbox object, afterwards, the object spy only found the ...
0
votes
0answers
27 views
How to simulate a drag and drop function for Moo0 File Shredder?
Moo0 File Shredder is a Windows utility that does use a drop box area and the drag-and-drop function to "select" files and folders to automatically erase them.
In order to make things faster I've ...
0
votes
0answers
16 views
Check a data exist or not in file by checking 2 by 2 line using VBScript [duplicate]
I have a file like this : 7G8h6Tghstwt6Y.y8 .
Then, I have a string data like this : "2w" & "fr" & "7G"
I am going to check whether my string data exist in the file or not.
filepath = "C:\...
0
votes
2answers
44 views
CreateObject(“Excel.Application”) and install Addins
After spending the last 2 days tying to get this to work, I am finally reaching out to the community. I have tried multiple variations of the code below including many of the examples that have been ...
-2
votes
0answers
12 views
Visual Basic detect keystroke down
How do I detect in Visual Basic if a key is pressed in Visual Basic. Say if the w key is pressed.
Thanks.
-1
votes
0answers
24 views
VBScript pull table data in received outlook email to a Outlook Custom Form
This question involves pulling table data from an email I receive into an custom outlook form I've created.
I receive an automated email frequently. In that email is a table with a 2 column table, ...
-1
votes
1answer
36 views
What is mshta.exe in VBScript [on hold]
What does below 2 code snippets means. Can someone explain what objects they create and how those objects are being used?
CreateObject("HTMLFile").ParentWindow.ClipboardData.GetData("Text")
...
-3
votes
0answers
21 views
VBS - how to get today's date of a file name?
I got a program to convert .csv to .xls file but the files has today's date in it name, for example "C:\Users\user\Downloads\arquivo_2019-02-19.csv", then when i need to convert it's necessary to ...
0
votes
0answers
32 views
Using Function Library to Call browser
When I call on my action page to open the browser, it does open it and then it closes it. And then opens it again and then closes it repeatedly. I checked my function library but cannot seem to figure ...
0
votes
0answers
23 views
Access VBA7 and Win64 Conditional Compiler constant through Powershell
I have software that can run either a VBS or Powershell script on a targeted endpoint (these are the only options). I want to use this software to determine whether the version of MS Office that is ...
1
vote
0answers
56 views
How do I create a ListTemplate object (Word) in VBS?
My Main question is in VBS I want a numbered list in my word document that I can restart. When I do currDoc.ListParagraphs(1).Range.Style = "List_Number 1" I get the numbered list but I can't restart ...
-2
votes
0answers
18 views
Activar el checkbox cuando encuentro el valor x en bd
Intente hacer una validación pero me sale error en
check_representante_princ_1.Checked = True
<!-- Representante Principal -->
<input style="margin-left: 10px; float: left; width: 110px;" ...
0
votes
0answers
18 views
VBScript to find same cell positions in two files
I'm trying to find same positions between two excel files.
First step is to read exported data stored in excel file which includes position numbers for example: 1, 2, 3.1, 3.2, 6, 7 etc. and this ...
1
vote
0answers
33 views
Run Excel macro externally with VBS not effective
I have an excel macro that adds certain lines of data to some of the worksheets in an excel workbook. The problem I have is that if i run the macro from within the workbook it all works like a charm, ...
-1
votes
0answers
10 views
How can I make my VBScript FTP tool secured ?? Is there any piece of SFTP code that I can use in VBScript?
ws.Run "%ComSpec% /c sftp -s:"&iniWORKDirName&conFTPScript&" > "&iniWORKDirName&conFTPOutput, 0, True
This is piece of code I have in my VBScript which is FTP. I want to make it ...
0
votes
1answer
90 views
Converting Outlook code from VBScript to C# [on hold]
I am trying to write equivalent code in C# for the following code.
Set objApp = CreateObject("Outlook.Application")
Set objNS = CreateObject("Redemption.RDOSession")
objNS.Logon "appsystemacc", "...
0
votes
1answer
48 views
How to compare array to array using VBScript?
I would like to check a data in my file exist or not in an array data that I have. It will return 1 and 0 if its exit or not. Inside my file is like this:
2j2H4F6d9d0d3hdfasgt.y7
But I cut the last ...
-1
votes
0answers
28 views
Getting specific text from the web [on hold]
I am trying To fix my code. I want to check if the name "Server_CrF" and, if it does, get IP and port.
Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application")
IE....
0
votes
2answers
56 views
VBScript watchdog [closed]
I am trying to create a script that will look at a specific .txt file on the local computer, get it's DateLastModified attribute, and compare it to the last/previous value when it was last checked (in ...
-1
votes
0answers
24 views
datatable.value in UFT
I try read the data from datatable but I can not retrive data..
msgbox comes false
this is my code so far
customerRowcount= datatable.GetSheet(3).GetRowCount
dataRowCount= datatable.GetSheet(4)....
-1
votes
0answers
18 views
Set spath to Scripts Directory [duplicate]
This script will go on thumb drive but due to the nature of thumb drives may not always have the same drive letter. This script will be placed at the top level of the thumb drive and want to set sPath ...
-1
votes
1answer
15 views
VBS Script To Open Certain Applications Depending on Computer Name
Trying to create a VBScript to open one of two different functions depending on the computer name.
Here is my code:
Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Set ...
-1
votes
1answer
29 views
how to post a file or stdout into a http server?
I would like to execute some command then send them into my web server for analysis.
somethink like :
wmic csproduct get | wget http://someserver/cgi-bin/hello.pl
Except that wget is not delivered ...
-1
votes
1answer
45 views
Specified File Can't be Found
Have been created this to do auto-attend of setting up of computers with minimum attention needed. Have been working on this and made some breakthroughs. I want to be able to run this as admin from ...
7
votes
6answers
145 views
How can my code find out if it's running as VBScript, .HTA, or VBA?
Edit: Most responses so far involve checking for possibly non-existent objects, which outright does not work in VBA with Option Explicit on (it throws a compile-time error, so On Error doesn't work, ...
-1
votes
1answer
37 views
Can't find where “Expected End of Statement is”
So I am creating a code in VBS to automate setting up computers. Step 1 of my code works well, Step 2 not implemented in this example but works good, Step 3 throws me a "Expected end of Statement" ...
1
vote
1answer
56 views
ADODB.Command: Prepared statement not returning expected number of records
I'm using ADODB.Command to execute prepared statements in Classic ASP, however the number of records being return by MariaDB is incorrect, and I can't figure out why.
The code below gives an example ...
-1
votes
0answers
13 views
print out line based on a match with a word in two text files [duplicate]
As a continuation of this question.
I have now changed my code to suit the format better and tried to run some tests
here is the file format for targetappwords.txt:
office
nmap
wireshark
...
0
votes
0answers
68 views
Pass values to stored procedure where input values has changed
I am working on a Classic ASP project where I am updating multiple records in a table with single Submit button. Each row has select box and text box and user can update all the rows.
While sending ...
-2
votes
0answers
81 views
Why is my split function not working in vbscript [closed]
EDIT: updated the code to latest changes
EDIT: Revamped code
here is the file format for targetappwords.txt:
office
nmap
wireshark
Here is my code :
on error resume next
Dim ...
1
vote
1answer
56 views
Check for running process on multiple machines
I am new to VBS, but was able to create a simple script to determine if PowerPoint is running on my local machine. My ultimate goal, however, is to check multiple remote machines, and display results ...
0
votes
1answer
26 views
ODBC Data Source Connection Successful but TNS Unresolved in VBScript
I am trying to make a connection to Oracle DB from VBScript. I've added all the environment variables and the code can locate the file of TNSNAMES.ora but cannot resolve the connection.
When I ...
-2
votes
1answer
30 views
VBScript to format the file and date <filename><date>.csv [duplicate]
Hi I need help to set the file name as .csv
currently we could set the file name as 2_10_2018user.csv with the below codes
Set CPY = CreateObject("Scripting.FileSystemObject")
CPY.CopyFile "\\users\...
1
vote
1answer
65 views
How do UBound/LBound support the optional dimension parameter in VBScript?
I've been learning the basics of VBScript, and I'm curious as to how UBound and LBound can take one or two arguments. I have read that VBScript supports neither optional parameters nor overloaded ...
0
votes
1answer
28 views
How to fix error of “Object connection lost from its client” in VBscript"?
my code where I try to login into the website automatically. But it keeps on throwing
The object is lost connection from its client
Dim IE
set IE = WScript.CreateObject("InternetExplorer....
0
votes
0answers
50 views
IBM iSeries AS400 VBscript Array of set values
I'm looking to shorten a potential VBscript in my iSeries. What I need to automate is user entry over 30 queries. I know how to do this via a long method involving copy+paste of the same Do:Loop until ...