vbscript

Check if folder is there, if not create it on current user logged in VBS

痴心易碎 提交于 2020-01-31 07:03:04
问题 Currently this is my script Set oWS = WScript.CreateObject("WScript.Shell") ' Get the %userprofile% in a variable, or else it won't be recognized userProfile = oWS.ExpandEnvironmentStrings( "%userprofile%" ) What I am trying to do is grab the current user logged in, I want it to check the directory D:\"personsuser"\Appdata\Roaming\Local to see if the folder "Local" is created, if it isn't created I want to create one via createobject in vbs. The script above from what i know grabs the current

xml parse with vbscript

房东的猫 提交于 2020-01-30 11:41:42
问题 Hello i want to parse a specific info from xml. In that xml code i want to read ForexBuying of the US DOLLAR. I get msgbox when it's US DOLLAR but i want to see its ForexBuying I am quite new in vbscript please help me Sub GetExchangeRate() Dim xmlDoc, Currencyy, plot, ForexBuying Set xmlDoc = CreateObject("Msxml2.DOMDocument") xmlDoc.load("......\exchange.xml") Set Currencyy = xmlDoc.getElementsByTagName("CurrencyName") If Currencyy.length > 0 Then For Each x In Currencyy If x.text="US

xml parse with vbscript

限于喜欢 提交于 2020-01-30 11:41:26
问题 Hello i want to parse a specific info from xml. In that xml code i want to read ForexBuying of the US DOLLAR. I get msgbox when it's US DOLLAR but i want to see its ForexBuying I am quite new in vbscript please help me Sub GetExchangeRate() Dim xmlDoc, Currencyy, plot, ForexBuying Set xmlDoc = CreateObject("Msxml2.DOMDocument") xmlDoc.load("......\exchange.xml") Set Currencyy = xmlDoc.getElementsByTagName("CurrencyName") If Currencyy.length > 0 Then For Each x In Currencyy If x.text="US

How to evaluate vbscript expression from javascript via VBA

喜欢而已 提交于 2020-01-30 11:33:27
问题 The latest MS Office update has disabled vbscript which I am using in Excel VBA to evaluate expressions. I have found this to be substantially faster than the VBA "Evaluate" function in the past so want to avoid doing that. Javascript still works so I am trying to migrate to that. However some of our more complex expressions, which use powers or square roots, do not work without re-writing the expressions to use Math.Pow() etc. So my question is if I can run a javascript which evaluates a

Remove the Google Chrome pinned icon on the taskbar

我的梦境 提交于 2020-01-30 08:30:28
问题 I want to remove the Google Chrome pinned icon on the taskbar. The uninstall does NOT remove the icon. I modified code to remove just the Google Chrome.lnk. What I want to do (knowing about VBS) is to loop through all the user folders not just the current user which is I believe defined as strCurrentUserAppData . The other desire I would like to do with this code is to use it with SCCM to do a clean install of Chrome. I installed the x64 version and need to replace it with the x86 version.

How to use Replace function in VBScript

冷暖自知 提交于 2020-01-30 07:44:18
问题 I don't know why this code doesn't work: Dim a a = InputBox("What time do you want?") If InStr(a, "pm") Then (Replace(a, "pm", "")) a = a + 12 c = MsgBox(a, 0, Time) WScript.Quit Else End If b = MsgBox(a & form, 0, "L") Whenever I try to start it, it responds with: "Error: Expected Statement" Is it because the Replace statement isn't right or because there's a mistake in the rest of the script? 回答1: When you try to run that code you should get the following error Microsoft VBScript

How to use Replace function in VBScript

限于喜欢 提交于 2020-01-30 07:44:07
问题 I don't know why this code doesn't work: Dim a a = InputBox("What time do you want?") If InStr(a, "pm") Then (Replace(a, "pm", "")) a = a + 12 c = MsgBox(a, 0, Time) WScript.Quit Else End If b = MsgBox(a & form, 0, "L") Whenever I try to start it, it responds with: "Error: Expected Statement" Is it because the Replace statement isn't right or because there's a mistake in the rest of the script? 回答1: When you try to run that code you should get the following error Microsoft VBScript

Understanding ON ERROR in VBScript

时间秒杀一切 提交于 2020-01-30 06:46:06
问题 I am trying to modify a vbscript and convert it to Powershell as instructed. I have a block of code on my function SearchAD with On Error. on error resume next Set objRS = command.execute SearchAD = objRS.RecordCount on error goto 0 My question would be is what part of the code can trigger RESUME Next and what part is for GOTO 0. 回答1: In VBScript there are two error states (three in other VBs). On Error Goto 0 vbscript handles errors. Your program crashes on errors. On Error Resume Next

Understanding ON ERROR in VBScript

对着背影说爱祢 提交于 2020-01-30 06:46:06
问题 I am trying to modify a vbscript and convert it to Powershell as instructed. I have a block of code on my function SearchAD with On Error. on error resume next Set objRS = command.execute SearchAD = objRS.RecordCount on error goto 0 My question would be is what part of the code can trigger RESUME Next and what part is for GOTO 0. 回答1: In VBScript there are two error states (three in other VBs). On Error Goto 0 vbscript handles errors. Your program crashes on errors. On Error Resume Next

How to use Excel worksheet functions in VBScript?

你说的曾经没有我的故事 提交于 2020-01-29 09:57:11
问题 I need to count the number of active cells in column A of Excel. I can achieve this easily using 'worksheetfunction.countA' in Excel VBA, but unable to get the same in VBScript. I have tried the following code: Dim objXl , objWorkbook, objSheet ,numofactivecells Set objXl = createobject("Excel.Application") set objWorkbook= objXl.Workbooks.open("C:\Users\Username\Desktop\filename.xlsm") 'change filename set objSheet = objWorkbook.Worksheets(1) objXl.visible = true objsheet.cells(1,1).select