我正在运行可能在x64 Windows下运行的VBScript.我需要从注册表的32位部分读取注册表项.为此,我使用路径HKLM\Software\Wow6432Node\xyz而不是HKLM\Software\xyz.如何检查脚本是否在x64下执行?
给出以下XML:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetMsisdnResponse xmlns="http://my.domain.com/">
<GetMsisdnResult>
<RedirectUrl>http://my.domain.com/cw/DoIdentification.do2?sessionid=71de6551fc13e6625194</RedirectUrl>
</GetMsisdnResult>
</GetMsisdnResponse>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
我试图在VBScript中使用XPath访问RedirectUrl元素:
set xml = CreateObject("MSXML2.DOMDocument")
xml.async = false
xml.validateOnParse = false
xml.resolveExternals = false
xml.setProperty "SelectionLanguage", "XPath"
xml.setProperty "SelectionNamespaces", "xmlns:s='http://my.domain.com/' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"
err.clear
on error resume next
xml.loadXML (xmlhttp.responseText)
if (err.number = 0) then
redirectUrl = xml.selectSingleNode("/soap:Envelope/soap:Body/s:GetMsisdnResponse/s:GetMsisdnResult/s:RedirectUrl").text
end if
Run Code Online (Sandbox Code Playgroud)
但它找不到RedirectUrl节点,因此当我尝试获取.text属性时没有任何内容.我究竟做错了什么
我目前正在编写一个脚本来创建自定义备份脚本,我唯一缺少的是文件监视器.我需要某种形式的脚本来监视文件夹中的文件更改,然后运行一个包含已更改文件的命令.
因此,例如,如果文件发生更改,它将执行"c:/syncbatch.bat%Location_Of_File%"
非常感谢任何有关我应该从哪里开始的帮助.非常感谢!
我有以下.VBS脚本,它可以工作,但它只返回前100行(97)行的数据.我如何获得完整列表?
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue",,48)
For Each objItem in colItems
Wscript.Echo objItem.Name & " - " & objItem.MessagesinQueue
Next
Run Code Online (Sandbox Code Playgroud) 问题:使用vbscript处理传入的电子邮件。
Outlook版本:Outlook 2000
描述:我不能为此使用VBA,因为我相信Outlook 2000不允许您从规则向导中运行VBA脚本,因此我必须使用该Run a Program | VBScript方法。
我的知识:我知道如何处理来自VBA的电子邮件
Sub Sample(MyMail As MailItem)
Dim strID As String, olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
'~~> Rest of the code
Set olMail = Nothing
Set olNS = Nothing
End Sub
Run Code Online (Sandbox Code Playgroud)
我也知道如何在收件箱中已有的电子邮件上运行vbscript 。要在OL2000中运行vbscript,必须使用Run A Program并将其指向vbs文件。该Run A Script在OL2000不可用。
我不知道的地方:这就是我需要帮助的地方。如何获取未命中VBS中邮件收件箱的邮件对象。一旦获得对象,就可以执行其余的必要操作。
在过去,我使用下面的脚本来检测标题为"远程桌面"的活动窗口是否处于活动状态.如果它不活动,脚本将自动启动或再次激活.
问题:有没有办法检测窗口是否处于活动状态并自动关闭它?我正在办公室的Windows 7机器上以chrome kiosk模式设置一个售货亭.主页面在弹出窗口中启动选定的Google表单.表单确认页面标题为"谢谢!" 在标题栏中.脚本有没有办法自动检测此窗口并关闭它?这将是很好的,因为用户会看到他们的响应已提交(一两秒钟),但如果他们没有关闭窗口,当下一个用户去使用信息亭时它将不会打开.
另一种选择可能是如果有一种方法可以在表单上使用Google脚本来编程提交按钮来关闭窗口.我不确定这是否可行.
Option Explicit
'On Error Resume Next
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Do
If (objShell.AppActivate("Window Title Here") = False) Then
objShell.Run "mstsc.exe " & chr(34) & "c:\scripts\Remote Desktop.rdp" & chr(34)
WScript.Sleep 5000
Else
WScript.Sleep 3000
End If
Loop
Run Code Online (Sandbox Code Playgroud)
如果我需要关闭的窗口处于活动状态,然后运行以下脚本,窗口将关闭.这几乎就像我需要将顶部和底部代码拼凑在一起以实现我所需要的,但我不确定如何.Dim oShell
Set oShell = CreateObject("WScript.Shell")
If oShell.AppActivate("Untitled - Notepad") Then
WScript.Sleep 500
oShell.SendKeys "%{F4}"
End If
Run Code Online (Sandbox Code Playgroud)
我正在尝试找到一个将在启动时运行的脚本,并等待打开具有特定标题的窗口,然后在检测到它后将其关闭.如果我可以控制一旦检测到窗口保持打开多长时间会更好,但如果我可以让它关闭就足够了.
我想我找到了一个很好的解决方案.我找到了这篇文章并修改了答案.有没有人看到这个问题?
' Will loop forever checking for the message every half a second
' When it …Run Code Online (Sandbox Code Playgroud) 我有一个很少的vbs代码的小hta文件.它选择文件夹或文件,然后复制到固定位置.
<html>
<head>
<Title>File Copy </Title>
<style>
img.exco
{
position:absolute;
bottom:10px;
right:10px
}
</style>
<!--Put this sub here to avoid resize flickering.-->
<script language = "VBScript">
sub DoResize
'resize
window.resizeTo 690,350
screenWidth = Document.ParentWindow.Screen.AvailWidth
screenHeight = Document.ParentWindow.Screen.AvailHeight
posLeft = (screenWidth - 700) / 2
posTop = (screenHeight - 430) / 2
'move to centerscreen
window.moveTo posLeft, posTop
end sub
DoResize()
</script>
<HTA:APPLICATION ID=""
applicationName=""
version="1.1"
BORDER="thin"
BORDERSTYLE="static"
CAPTION="Yes"
CONTEXTMENU="no"
ICON="C:\icon\32x32.ico"
INNERBORDER="no"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
NAVIGATABLE="no"
SCROLL="no"
SCROLLFLAT="no"
SELECTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes" …Run Code Online (Sandbox Code Playgroud) 我在Excel中使用它,它工作正常.
dim varScreen (0 to 2) as string
varScreen(0) = "sample 1"
varScreen(1) = "sample 2"
varScreen(2) = "sample 3"
Run Code Online (Sandbox Code Playgroud)
我试图将此数组转换为VBScript但我不断收到此错误:
Line: 14
Error: Expected ')'
Run Code Online (Sandbox Code Playgroud)
我已经尝试了各种选项,删除了as string,dim varScreen as array但我仍然得到错误.
什么是正确的语法?
我使用UFT自动化Inventor 2013如下: -
Set oApp = GetObject(,"Inventor.Application")
Set oDoc = oApp.ActiveDocument
Here I'm using GetObject()
这里我使用GetObject()函数来获取运行Inventor Application的参考.但我对 Set oApp = GetObject(,"Inventor.Application")
Set oDoc = oApp.ActiveDocument
Here I'm using GetObject()功能有疑问
1)如何发现任何应用程序存在或处于运行状态?
2)如何访问特定应用程序的头类,以便我们访问该应用程序类的所有方法和属性?
任何人都能解释一下吗?
vbscript ×10
qtp ×2
64-bit ×1
arrays ×1
autodesk ×1
batch-file ×1
dictionary ×1
hta ×1
kiosk ×1
kiosk-mode ×1
msxml ×1
namespaces ×1
outlook ×1
registry ×1
windows ×1
wmi ×1
wsh ×1
xml ×1
xpath ×1