vbscript

How to find and replace text strings in multiple files using Visual Basic

回眸只為那壹抹淺笑 提交于 2020-01-26 02:49:28
问题 I have a basic question about a simple vbs script. My goal is to find a replace multiple text strings in multiple files. (The 21 text strings to replace are the same across files.) The file names have about 12 prefixes and then will have numbers 1 to 200 at the end. The basic code I am using for just one of the strings in one of the files is as follows. Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:

VBScript Activate open Excel spreadsheet without URL

大憨熊 提交于 2020-01-25 21:45:09
问题 I have a project where the application will be used for multiple spreadsheets and naming formats are always going to be different. They want me to use File → Open from the menu to open a window where they select the spreadsheet from their desktop. I've got the VBScript code for that, but I can't activate the workbook to gather, or enter, data. WShell.SendKeys "%FO" objExcel.Wait (Now + TimeSerial(0, 0, 3)) For i = 1 to 3 WShell.SendKeys "+{TAB}" Next WShell.SendKeys "{HOME}" WShell.SendKeys

VBScript access network share from domain

佐手、 提交于 2020-01-25 16:39:06
问题 I'm trying to access and run setup.exe from a server on the same network. The pc where i'm trying to access the file from is in a domain. The server is not in the domain. This code works only if both pc's are without domain: Set WshNetwork = WScript.CreateObject("WScript.Network") WshNetwork.RemoveNetworkDrive "M:", True, True WshNetwork.MapNetworkDrive "M:", "\\192.168.0.10\share", myUserName, myPassword Set shell = WScript.CreateObject("Wscript.Shell") shell.CurrentDirectory = "M:\Setup"

Start/Stop methods for embeded Windows Media Player via VBScript

微笑、不失礼 提交于 2020-01-25 12:46:41
问题 I have following code working fine. <object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer" width="242" height="202" style="position:absolute; left:1;top:1;"> <param name="URL" value="C:\HTML\Sounds\oos.wav"> <param name="autoStart" value="0"> </object> I would like to crearte Start/Stop methods in VBScript for this object. So I am doing like Sub Start Dim oElm Set oElm = document.getElementById("WindowsMediaPlayer") if oElm Is Nothing then MsgBox("element does

vbscript to read lines from csv file, match data and write to same file

人走茶凉 提交于 2020-01-25 12:13:14
问题 I am trying to write a VBScript that will read lines from a csv file and be able to match data from one line to another. Here is an example of what the CSV contains: ID,Uplink,Value1,Value2,Downlink,Profile ID,UPLINK,156,145,DownlinkP,Profile1 ID,UPLINK,156,145,DownlinkG,ProfileUnknown This is just the header which must be saved, the first line type and the second line type. My Task: I need to find a way to have the script do the following: check if line contains DownlinkG, if so it needs to

vbscript to read lines from csv file, match data and write to same file

天涯浪子 提交于 2020-01-25 12:12:45
问题 I am trying to write a VBScript that will read lines from a csv file and be able to match data from one line to another. Here is an example of what the CSV contains: ID,Uplink,Value1,Value2,Downlink,Profile ID,UPLINK,156,145,DownlinkP,Profile1 ID,UPLINK,156,145,DownlinkG,ProfileUnknown This is just the header which must be saved, the first line type and the second line type. My Task: I need to find a way to have the script do the following: check if line contains DownlinkG, if so it needs to

Can I use VBScript to base64 encode a gif?

孤人 提交于 2020-01-25 07:38:06
问题 What I'm trying to do is encode a gif file, to include in an XML document. This is what I have now, but it doesn't seem to work. Function gifToBase64(strGifFilename) On Error Resume Next Dim strBase64 Set inputStream = WScript.CreateObject("ADODB.Stream") inputStream.LoadFromFile strGifFilename strBase64 = inputStream.Text Set inputStream = Nothing gifToBase64 = strBase64 End Function 回答1: I recently wrote a post about this very subject for implementations in JScript and VBScript. Here is the

how to wrap text in a cell by increasing the height of the cell in ASP with fpdf?

谁说我不能喝 提交于 2020-01-25 06:50:12
问题 I would like to wrap within a cell if the number of characters present is greater than 80 I try to use Multicell but a whole line is skipped pdf.SetTopMargin 0 pdf.SetFont Font_Family_T,"",Font_5 pdf.Cell 5,Dist_6,"" & ZZ,"TBL",0,"C" pdf.SetTopMargin 0 pdf.SetFont Font_Family_T,"",Font_5 pdf.Cell 107,Dist_6,"" & getvalue(objrs ,"w_orcdar") & " | " & getvalue(objrs ,"w_ordesa") & "-" & getvalue(objrs ,"w_ornote") ,"BTL",0,"L" pdf.SetTopMargin 0 pdf.SetFont Font_Family_T,"",Font_5 pdf.Cell 15

Running Python script using WshShell.Run in VBS does not generate output file

回眸只為那壹抹淺笑 提交于 2020-01-25 05:38:40
问题 I've got a problem with some VB scripting - it doesn't seem like it should be terribly difficult to solve, but even after trudging through many a page of Google I have yet to find a solution. [The problem] Here is my python file (test.py), simplified to just show the problem: f = open("testing.txt", 'w') f.write("oh hai\n") f.close() Of course, when run directly from the command line, this generates the file as you'd expect. However, when run in a simple .vbs script (WARNING: My vbs skills

How do I rename a file using VBScript?

吃可爱长大的小学妹 提交于 2020-01-25 04:42:09
问题 I am trying to rename a file and was using the below code but it does not seem to work. Can someone please tell me why? What is the correct way to rename a file from VBScript? FSO.GetFile("MyFile.txt).Name = "Hello.txt" I am using this thread for reference: Rename files without copying in same folder 回答1: You can rename the file using FSO by moving it: MoveFile Method. Dim Fso Set Fso = WScript.CreateObject("Scripting.FileSystemObject") Fso.MoveFile "A.txt", "B.txt" 回答2: I see only one reason