vbscript

Error Running VBScript from NotePad

风格不统一 提交于 2020-07-19 08:58:12
问题 I am new to vbscript and running procedures. I found some code that I'm trying to test so that I can get a feel for how vbscript works, and I am not sure why I am receiving an error message. I have created the below code in NotePad and then saved the file as a .vbs file on my desktop. Here is the code: i=10 If i=10 Then msgbox("This is my first script, Click OK to close") Else msgbox(“Hello world”) End if I thought that I would be able to open the file and get the message. Instead I am

Error Running VBScript from NotePad

北慕城南 提交于 2020-07-19 08:57:50
问题 I am new to vbscript and running procedures. I found some code that I'm trying to test so that I can get a feel for how vbscript works, and I am not sure why I am receiving an error message. I have created the below code in NotePad and then saved the file as a .vbs file on my desktop. Here is the code: i=10 If i=10 Then msgbox("This is my first script, Click OK to close") Else msgbox(“Hello world”) End if I thought that I would be able to open the file and get the message. Instead I am

Read a line from several .txt files and write them into created file

眉间皱痕 提交于 2020-07-19 07:06:48
问题 I have a quite simple task. There is a folder which contains several files with different extensions. I need to make a script which will find all files with .txt extension in this folder, read first line from every file and then write all first lines in newly created file. For now, I've ended up with something like this: Option Explicit Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Dim f, colFiles , objFile Dim tFolder, tFile Dim lineToCopy, fileContents Dim input, output Set

Use of SAPI Speech Recognition in a VBS Script?

无人久伴 提交于 2020-07-19 04:29:32
问题 I found this one-line example that allows to use the Windows SAPI Text-to-Speech feature in VBScript: CreateObject("SAPI.SpVoice").Speak("This is a test") I wonder if the SAPI Speech Recognition could be used in a VBScript program in the same easy way. When I seek for such information the tons of SAPI information that appear are related to C++, like the Microsoft SAPI site, or to Text-to-Speech in VBS. I tried to find documentation about the SAPI COM object Speech Recognition part that could

vbscript: how to convert a date into days and time

孤人 提交于 2020-07-19 04:01:12
问题 I have last boot time from WMI and it looks as '20141103113859.220250+060'. i want to convert it to number of days and time from the current time. is it possible? 回答1: From Help Use the SWbemDateTime object to convert these to regular dates and times. Windows 2000/NT and Windows 98/95: SWbemDateTime is not available. To convert WMI dates to FILETIME or VT_DATE format or to parse the date into component year, month, day, hours, and so on, you must write your own code. Set dtmInstallDate =

VBscript regex replace

孤街醉人 提交于 2020-07-18 21:31:37
问题 I have no idea why this is only applying to the last instance found, not all of them as I would expect. Any help appreciated. Input string: <a href="http://www.scirra.com" target="_blank" rel="nofollow">http://www.scirra.com</a><br /><br /> <a href="http://www.scirra.com" target="_blank" rel="nofollow">http://www.scirra.com</a><br /><hr> Regex: 'SEO scirra links Dim regEx Set regEx = New RegExp ' BB code urls With regEx .Pattern = "<a href=\""http://www.scirra.com([^\]]+)\"" target=\""_blank\

Replace Blank/empty cell with a string value

自闭症网瘾萝莉.ら 提交于 2020-07-18 21:05:58
问题 Hope someone can help. I need to populate any blank/empty cells within a range of cells with a specific string. I also don't know that the last row would be in that range so I am looking for that first, I know that line of code works as I have used it for another function within the script. Below is the code I am using: - LastRow = Cells(Rows.Count, 2).End(xlUp).Row For Each r In Range("AS22:AU" & LastRow) If r.Value2 = vbNullString Then r.Value2 = "Greens" End If Next I don't seem to get any

Excel - convert column letter to number equivalent vbs

余生颓废 提交于 2020-07-09 19:49:54
问题 I'm writing a vbs script to extract some data from an excel spreadsheet. Currently using the function: objSheet.Cells(rowNum, colNum).Value To get cell values, this allows me to do maths on the column number, e.g. add three to move across three columns. But in some instances I want to specify which Columns to get by letter: objSheet.Cells(4, E).Value I therefore need to write a vbs function to convert column letter to numbers E => 5. Needs to be able to handle a spreadsheet more than 26 cols

Classic ASP adding records to MySQL

半腔热情 提交于 2020-07-08 00:35:20
问题 I have had to move on of my old classic ASP projects to a new host, and I'm having problems connecting to their MySQL server. I have attached below the script I used with the old host which now errors Data source name not found and no default driver specified After a bit of digging it seems I have to change the driver to {MySQL ODBC 5.3 Unicode Driver} but it still errors. It seems to point to the cursor/lock type but I have used all option with no success. ODBC driver does not support the

Classic ASP adding records to MySQL

只谈情不闲聊 提交于 2020-07-08 00:34:46
问题 I have had to move on of my old classic ASP projects to a new host, and I'm having problems connecting to their MySQL server. I have attached below the script I used with the old host which now errors Data source name not found and no default driver specified After a bit of digging it seems I have to change the driver to {MySQL ODBC 5.3 Unicode Driver} but it still errors. It seems to point to the cursor/lock type but I have used all option with no success. ODBC driver does not support the