vbs转au3,对象为什么不能获取?vbs可以,au3就不能获取了
下面是vbs,能正常运行,用的是vbsedit里面的样本改了下' List Home Networking ICS SettingsstrComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\root\microsoft\homenet")
Set colItems = objWMIService.ExecQuery _
("Select * from HNet_ConnectionProperties")
Dim net
For Each objItem In colItems
WScript.Echo "_________________________"
If objItem.IsICSPrivate Then
WScript.Echo "Is ICS Private: " & objItem.IsICSPrivate
End If
If objItem.IsICSPublic Then
WScript.Echo "Is ICS Public: " & objItem.IsICSPublic
End If
WScript.Echo "Connection: " & objItem.Connection
' Wscript.Echo "Is Bridge: " & objItem.IsBridge
' Wscript.Echo "Is Bridge Member: " & objItem.IsBridgeMember
' Wscript.Echo "Is Firewalled: " & objItem.IsFirewalled
' Wscript.Echo "Is ICS Private: " & objItem.IsICSPrivate
' 'private专用连接 一般是有线网卡?不知道能不能显示拨号连接
' Wscript.Echo "Is ICS Public: " & objItem.IsICSPublic
' 'public公用连接 一般是无线网卡?
Next'List Home Networking Connections
用vbs没问题,下面是au3代码,Local $meige
$strComputer = "."
$netstr = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\microsoft\homenet")
$colItems = $netstr.ExecQuery("Select * from HNet_ConnectionProperties")
;If IsObj($colItems) Then
For $meige In $colItems
ConsoleWrite($meige.Connection)
ConsoleWrite($meige.IsICSPrivate)
ConsoleWrite($meige.IsICSPublic)
Next
;EndIfVariable must be of type "Object"............
For $meige In $colItems
For $meige In $colItems^ ERROR
为毛获取不了$colItems对象,这个应该没问题啊,难道差代码?
{:face (396):} 回复 1# wszhov
给出的AU3代码可以输出内容,无错。
代码运行环境:
操作系统: WIN_7/Service Pack 1
AU3版本: 3.3.9.4 回复 2# user3000
额,我的
系统: win_7 /64 sp1
au3: 3.3.9.21
这个版本到底改了多少了?部分com都失效了 回复 2# user3000
能否给个3.3.9.4这个版本的AutoIt3_x64.exe和AutoIt3.exe给我? 回复 2# user3000
准备换系统了,o(︶︿︶)o 唉,都没用,版本无问题了
页:
[1]