' Recovery Scenario example
Browser("Internet Explorer cannot").Page("Internet Explorer cannot").WebButton("Diagnose Connection Problems").Click
Browser("Internet Explorer cannot").Page("Internet Explorer cannot").WebButton("Diagnose Connection Problems");
Recovery.Enabled=True
Recovery.Activate
wait(1)
'MyCurrentStatus=Recovery.Enabled
''msgbox MyCurrentStatus
'If Not( MyCurrentStatus ) Then
'Recovery.Enabled=True
'End If
'Recovery.Activate
'Recovery = MyCurrentStatus
'msgbox "helo"
Sunday, November 21, 2010
This below example will retrieve specified table cell data
' This below example will retrieve specified table cell data
Set oDesc = Description.Create
'oDesc("innerText").Value = "one.*"
oDesc("micClass").Value = "WebTable"
'oDesc("innerText").Value = True
Set allTables = Browser("Browser").Page("Page").ChildObjects(oDesc)
msgbox allTables.Count
For i=0 to allTables.Count-1
'msgbox allTables.item(i).ToString()
If i=2Then
'msgbox "I value is "&i
Set des = Description.Create
des("outertext").Value = "one.*"
des("outertext").RegularExpression = true
val = Browser("Browser").Page("Page").WebTable(des).ColumnCount(i)
msgbox "Coulmn Count is "&val
celldata = Browser("Browser").Page("Page").WebTable(des).GetCellData(1,i)
msgbox celldata
msgbox Browser("Browser").Page("Page").WebTable(des).RowCount
End If
Next
'msgbox objPro.RowCount ' displays the no. of rows present in a web table
'msgbox objPro.ColumnCount(1) ' displays number of columns in the first row
'msgbox objPro.GetCellData(2,1)
'
' ///////////////////////////////////////////
'Set oDesc = Description.Create
''oDesc("micclass").value = "webbutton" 'this statement working, returned 1
'oDesc("micclass").Value = "webtable"
'oDesc("micclass").RegularExpression = True
'set obj = Browser("Browser").Page("Page").ChildObjects(oDesc)
'
''this loop displays only 1,1 info. it wont displays the table name or properties
''For i=0 to obj.count-1
'' msgbox obj.item(i).ToString()
''Next
'
'msgbox "Total webtables " &obj.Count
'' when there was static tables and independent table, means not nested table. For nested table this index will not work
''Set objPro = Browser("Browser").Page("Page").WebTable("index := 0")
'
'' working to identify , when there were nested tables
'Set objPro = Browser("Browser").Page("Page").WebTable("index := 1")
'
'msgbox objPro.RowCount ' displays the no. of rows present in a web table
'msgbox objPro.ColumnCount(1) ' displays number of columns in the first row
'msgbox objPro.GetCellData(2,1)
'
''set res = Browser("Browser").Page("Page").Webtable("").GetTOProperties
'''msgbox res.count
''For k=0 to res.count-1
'' msgbox res(k).Name
'' msgbox res(k).value
''Next
Set oDesc = Description.Create
'oDesc("innerText").Value = "one.*"
oDesc("micClass").Value = "WebTable"
'oDesc("innerText").Value = True
Set allTables = Browser("Browser").Page("Page").ChildObjects(oDesc)
msgbox allTables.Count
For i=0 to allTables.Count-1
'msgbox allTables.item(i).ToString()
If i=2Then
'msgbox "I value is "&i
Set des = Description.Create
des("outertext").Value = "one.*"
des("outertext").RegularExpression = true
val = Browser("Browser").Page("Page").WebTable(des).ColumnCount(i)
msgbox "Coulmn Count is "&val
celldata = Browser("Browser").Page("Page").WebTable(des).GetCellData(1,i)
msgbox celldata
msgbox Browser("Browser").Page("Page").WebTable(des).RowCount
End If
Next
'msgbox objPro.RowCount ' displays the no. of rows present in a web table
'msgbox objPro.ColumnCount(1) ' displays number of columns in the first row
'msgbox objPro.GetCellData(2,1)
'
' ///////////////////////////////////////////
'Set oDesc = Description.Create
''oDesc("micclass").value = "webbutton" 'this statement working, returned 1
'oDesc("micclass").Value = "webtable"
'oDesc("micclass").RegularExpression = True
'set obj = Browser("Browser").Page("Page").ChildObjects(oDesc)
'
''this loop displays only 1,1 info. it wont displays the table name or properties
''For i=0 to obj.count-1
'' msgbox obj.item(i).ToString()
''Next
'
'msgbox "Total webtables " &obj.Count
'' when there was static tables and independent table, means not nested table. For nested table this index will not work
''Set objPro = Browser("Browser").Page("Page").WebTable("index := 0")
'
'' working to identify , when there were nested tables
'Set objPro = Browser("Browser").Page("Page").WebTable("index := 1")
'
'msgbox objPro.RowCount ' displays the no. of rows present in a web table
'msgbox objPro.ColumnCount(1) ' displays number of columns in the first row
'msgbox objPro.GetCellData(2,1)
'
''set res = Browser("Browser").Page("Page").Webtable("").GetTOProperties
'''msgbox res.count
''For k=0 to res.count-1
'' msgbox res(k).Name
'' msgbox res(k).value
''Next
Dynamically reading Frames and its contents
' C:\Perl\html\index.html
Dim frame(2)
frame(1) = "PerlDoc"
frame(0) = "TOC"
On Error Resume Next
For i=0 to ubound(frame)-1
'msgbox frame(i)
If Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame(frame(i)).Link("ASPN Perl").Exist Then
msgbox frame(i)
msgbox "yes"
If Err.Number <= 0 Then
Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame(frame(i)).Link("ASPN Perl").Click
Else
msgbox frame(i)
End If
End If
Next
'Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame("PerlDoc").Link("ASPN Perl").Click
Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame("PerlDoc").Link("ASPN Perl")
'Browser("Internet Explorer cannot").Page("Internet Explorer cannot").Sync
'Browser("Internet Explorer cannot").CloseAllTabs
Dim frame(2)
frame(1) = "PerlDoc"
frame(0) = "TOC"
On Error Resume Next
For i=0 to ubound(frame)-1
'msgbox frame(i)
If Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame(frame(i)).Link("ASPN Perl").Exist Then
msgbox frame(i)
msgbox "yes"
If Err.Number <= 0 Then
Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame(frame(i)).Link("ASPN Perl").Click
Else
msgbox frame(i)
End If
End If
Next
'Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame("PerlDoc").Link("ASPN Perl").Click
Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame("PerlDoc").Link("ASPN Perl")
'Browser("Internet Explorer cannot").Page("Internet Explorer cannot").Sync
'Browser("Internet Explorer cannot").CloseAllTabs
ChildObjects - Frames,Dynamic Array
'http://localhost/sqlitemanager/
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )")_;_script infofile_;_ZIP::ssf7.xml_;_
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0")_;_script infofile_;_ZIP::ssf8.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "ON" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "OFF" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf10.xml_;_
'Dynamic Arrays
Dim dynamicArray()
Set oDesc = Description.Create
oDesc("micclass").Value = "Frame"
set cObj = Browser("WAMP5 Homepage").Page("SQLiteManager").ChildObjects(oDesc)
'msgbox cObj.Count
ReDim dynamicArray(cObj.Count)
' below for loop will convert as below :
' from = [ welcome ] link
' to = welcome
For i=0 to cObj.Count -1
childObjVal = cObj.item(i).ToString() ' msgbox childObjVal
startPos = Instr(1,childObjVal,"[")
newVal = mid(childObjVal,startPos+1,len(childObjVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
dynamicArray(i) = trim(endVal) ' msgbox dynamicArray(i)
Next
'msgbox ubound(dynamicArray)
' below for loop is used click left side frames specific link
For j=0 to ubound(dynamicArray)-1
strArray = dynamicArray(j)
If strArray = "left" Then
Set oDes = Description.Create
oDes("micclass").Value = "Link"
set childLinks = Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).ChildObjects(oDes) ' Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("left").Link("Test").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
For k=0 to childLinks.Count -1
childLinksVal = childLinks.item(k).ToString() ' msgbox childLinksVal
startPos = Instr(1,childLinksVal,"[")
newVal = mid(childLinksVal,startPos+1,len(childLinksVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1) 'dynamicArray(i) = trim(endVal)
endVal = trim(endVal)
msgbox trim(endVal)
If endVal = "Test" Then
Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).Link(endVal).Click
msgbox "Test is clicked"
End If
Next
End If
Next
' How to find co-ordinates of any text in the application
'l = 0
't = 0
'r = 0
'b = 0
'result = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTextLocation("test123",l,t,r,b) @@ hightlight id_;_2164128_;_script infofile_;_ZIP::ssf1.xml_;_
'If result Then @@ hightlight id_;_460284_;_script infofile_;_ZIP::ssf2.xml_;_
' MsgBox "Text found. Coordinates:" & l & "," & t & "," & r & "," & b
'End If
' GetTOProperties example
'set objPro = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTOProperties
'msgbox objPro.Count
'For i=0 to objPro.count-1
' 'msgbox objPro(i).Name
'If objPro(i).Name = "text" Then
' msgbox objPro(i).Name ' property name
'End If
'Next
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )")_;_script infofile_;_ZIP::ssf7.xml_;_
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0")_;_script infofile_;_ZIP::ssf8.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "ON" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "OFF" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf10.xml_;_
'Dynamic Arrays
Dim dynamicArray()
Set oDesc = Description.Create
oDesc("micclass").Value = "Frame"
set cObj = Browser("WAMP5 Homepage").Page("SQLiteManager").ChildObjects(oDesc)
'msgbox cObj.Count
ReDim dynamicArray(cObj.Count)
' below for loop will convert as below :
' from = [ welcome ] link
' to = welcome
For i=0 to cObj.Count -1
childObjVal = cObj.item(i).ToString() ' msgbox childObjVal
startPos = Instr(1,childObjVal,"[")
newVal = mid(childObjVal,startPos+1,len(childObjVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
dynamicArray(i) = trim(endVal) ' msgbox dynamicArray(i)
Next
'msgbox ubound(dynamicArray)
' below for loop is used click left side frames specific link
For j=0 to ubound(dynamicArray)-1
strArray = dynamicArray(j)
If strArray = "left" Then
Set oDes = Description.Create
oDes("micclass").Value = "Link"
set childLinks = Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).ChildObjects(oDes) ' Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("left").Link("Test").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
For k=0 to childLinks.Count -1
childLinksVal = childLinks.item(k).ToString() ' msgbox childLinksVal
startPos = Instr(1,childLinksVal,"[")
newVal = mid(childLinksVal,startPos+1,len(childLinksVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1) 'dynamicArray(i) = trim(endVal)
endVal = trim(endVal)
msgbox trim(endVal)
If endVal = "Test" Then
Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).Link(endVal).Click
msgbox "Test is clicked"
End If
Next
End If
Next
' How to find co-ordinates of any text in the application
'l = 0
't = 0
'r = 0
'b = 0
'result = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTextLocation("test123",l,t,r,b) @@ hightlight id_;_2164128_;_script infofile_;_ZIP::ssf1.xml_;_
'If result Then @@ hightlight id_;_460284_;_script infofile_;_ZIP::ssf2.xml_;_
' MsgBox "Text found. Coordinates:" & l & "," & t & "," & r & "," & b
'End If
' GetTOProperties example
'set objPro = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTOProperties
'msgbox objPro.Count
'For i=0 to objPro.count-1
' 'msgbox objPro(i).Name
'If objPro(i).Name = "text" Then
' msgbox objPro(i).Name ' property name
'End If
'Next
ChildObjects - Click desired link
' Browser("iTKO LISA Functional Testing").Page("iTKO LISA Functional Testing").Link("Key Features").Click
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
'oDesc("Class Name").Value = "Link"
'Set Lists = Browser("iTKO LISA Functional Testing").Page("iTKO LISA Functional Testing").ChildObjects(oDesc)
Set Lists = Browser("iTKO LISA Functional Testing").Page("WAMP5 Homepage").ChildObjects(oDesc)
'Set Lists = Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").ChildObjects(oDesc)
NumberOfLists = Lists.Count()
'msgbox NumberOfLists
bVal = ""
For i = 0 To NumberOfLists - 1
sVal = Lists.item(i).ToString()
'msgbox sVal ' return value like - [ xyz ] link
startPos = Instr(1,sVal,"[")
newVal = mid(sVal,startPos+1,len(sVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
msgbox endVal
Next
'Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").Link("More information").Click
'If endVal="test123" Then
' msgbox endVal
' Reporter.ReportEvent micPass,"Match Found","Success - Found the match"
' Else
' 'Reporter.ReportEvent micFail,"Match Not Found","Fail - Match not found"
' End If
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
'oDesc("Class Name").Value = "Link"
'Set Lists = Browser("iTKO LISA Functional Testing").Page("iTKO LISA Functional Testing").ChildObjects(oDesc)
Set Lists = Browser("iTKO LISA Functional Testing").Page("WAMP5 Homepage").ChildObjects(oDesc)
'Set Lists = Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").ChildObjects(oDesc)
NumberOfLists = Lists.Count()
'msgbox NumberOfLists
bVal = ""
For i = 0 To NumberOfLists - 1
sVal = Lists.item(i).ToString()
'msgbox sVal ' return value like - [ xyz ] link
startPos = Instr(1,sVal,"[")
newVal = mid(sVal,startPos+1,len(sVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
msgbox endVal
Next
'Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").Link("More information").Click
'If endVal="test123" Then
' msgbox endVal
' Reporter.ReportEvent micPass,"Match Found","Success - Found the match"
' Else
' 'Reporter.ReportEvent micFail,"Match Not Found","Fail - Match not found"
' End If
Import Data Shet - example
' Import Data Sheet
DataTable.Import "C:/perldbtesting.xls"
rCount = DataTable.GetRowCount
msgbox rCount
For i=1 to rCount Step 1
DataTable.SetCurrentRow(i)
sno = DataTable.Value("sno",dtGlobalSheet)
name_ = DataTable.Value("name",dtGlobalSheet)
msgbox sno
msgbox name_
Next
DataTable.DeleteSheet "Action1"
DataTable.AddSheet("newsheet").AddParameter "newParam","Added new sheet & and then added new column param and value is filled"
oldVal = DataTable.Value ("newParam","newsheet")
msgbox oldVal
DataTable.Import "C:/perldbtesting.xls"
rCount = DataTable.GetRowCount
msgbox rCount
For i=1 to rCount Step 1
DataTable.SetCurrentRow(i)
sno = DataTable.Value("sno",dtGlobalSheet)
name_ = DataTable.Value("name",dtGlobalSheet)
msgbox sno
msgbox name_
Next
DataTable.DeleteSheet "Action1"
DataTable.AddSheet("newsheet").AddParameter "newParam","Added new sheet & and then added new column param and value is filled"
oldVal = DataTable.Value ("newParam","newsheet")
msgbox oldVal
FSO Examples
Set fso = CreateObject ("Scripting.FileSystemObject")
If fso.FolderExists ("C:\parent") Then
' fso.GetParentFolderName ("C:\parent") '- displays C:/
'msgbox fso.GetFolder("C:\parent").IsRootFolder ' false
'icount = fso.GetFolder("C:\parent").SubFolders.Count ' returns count
Set f = fso.GetFolder("c:\parent")
Set sf = f.SubFolders
For Each f1 in sf
s = s & f1.name
s = s & ";"
Next
ShowFolderList = s
End If
msgbox ShowFolderList
' lst = Array(10)
lst = split (ShowFolderList, ";")
icount = ubound(lst)
For i=0 to icount-1 step 1
msgbox lst(i)
Next
'msgbox arr()
'set obj = CreateObject ("WScript.Shell")
'set oExec = obj.Exec ("perl c:\Perl\eg\example.pl")
'msgbox oExec.Status
'If oExec.Status = 0 Then
' Reporter.ReportEvent micWarning, perlscript, "Success"
' Else
' Reporter.ReportEvent micWarning, perlscript, "Fail"
'End If
'Set fso = CreateObject ("Scripting.FileSystemObject")
'If fso.FolderExists ("C:\QTPPractice") Then
' msgbox "Folder Already Exists"
' Reporter.ReportEvent micWarning, FolderExits, "Folder Already Exists"
'Else
' fso.CreateFolder ("C:\QTPPractice")
' ' set fileobj = fso.CreateTextFile ("C:\QTPPractice\textfile.txt", ForWriting, True)
' set fileobj = fso.CreateTextFile ("C:\QTPPractice\textfile.txt")
' msgbox "Folder and File Created"
' Reporter.ReportEvent micPass, FolderExits, "Folder and File Created"
'End If
If fso.FolderExists ("C:\parent") Then
' fso.GetParentFolderName ("C:\parent") '- displays C:/
'msgbox fso.GetFolder("C:\parent").IsRootFolder ' false
'icount = fso.GetFolder("C:\parent").SubFolders.Count ' returns count
Set f = fso.GetFolder("c:\parent")
Set sf = f.SubFolders
For Each f1 in sf
s = s & f1.name
s = s & ";"
Next
ShowFolderList = s
End If
msgbox ShowFolderList
' lst = Array(10)
lst = split (ShowFolderList, ";")
icount = ubound(lst)
For i=0 to icount-1 step 1
msgbox lst(i)
Next
'msgbox arr()
'set obj = CreateObject ("WScript.Shell")
'set oExec = obj.Exec ("perl c:\Perl\eg\example.pl")
'msgbox oExec.Status
'If oExec.Status = 0 Then
' Reporter.ReportEvent micWarning, perlscript, "Success"
' Else
' Reporter.ReportEvent micWarning, perlscript, "Fail"
'End If
'Set fso = CreateObject ("Scripting.FileSystemObject")
'If fso.FolderExists ("C:\QTPPractice") Then
' msgbox "Folder Already Exists"
' Reporter.ReportEvent micWarning, FolderExits, "Folder Already Exists"
'Else
' fso.CreateFolder ("C:\QTPPractice")
' ' set fileobj = fso.CreateTextFile ("C:\QTPPractice\textfile.txt", ForWriting, True)
' set fileobj = fso.CreateTextFile ("C:\QTPPractice\textfile.txt")
' msgbox "Folder and File Created"
' Reporter.ReportEvent micPass, FolderExits, "Folder and File Created"
'End If
WMI examples
'Set Obj = CreateObject("WScript.Shell")
' val = Obj.Run ("net user rupakala pa$$w0rd /add") -- will execute at command prompt, as background process
'val = Obj.Run ("cmd /K perl c:/Perl/eg/example.pl >c:/testfile.txt") ' output will be written into testfile.txt
'msgbox val ' returns 0
'Obj.CreateShortcut "C:\Users\Administrator\Desktop\aaaaa.lnk"
' msgbox Obj.CurrentDirectory ' -----displays current directory path of script
'set WshSysEnv = Obj.Environment("SYSTEM")
'msgbox WshSysEnv.Item("OS")
'set exe = Obj.Exec ("notepad.exe")
' --- WMI examples
'Set LoginProfiles = GetObject("winmgmts:").InstancesOf ("Win32_NetworkLoginProfile")
' For each Profile in LoginProfiles
' msgbox Profile.Name
' 'msgbox Profile.LogonName
' next
Set net = CreateObject("WScript.Network")
' net.MapNetworkDrive "P:", "file://pc/public%22,%22True%22,%22Administrator",""
'msgbox net.ComputerName
'msgbox net.UserName
Set oDrives = net.EnumNetworkDrives()
msgbox oDrives.Count
For i = 0 to oDrives.Count - 1 Step 2
msgbox "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1)
Next
' val = Obj.Run ("net user rupakala pa$$w0rd /add") -- will execute at command prompt, as background process
'val = Obj.Run ("cmd /K perl c:/Perl/eg/example.pl >c:/testfile.txt") ' output will be written into testfile.txt
'msgbox val ' returns 0
'Obj.CreateShortcut "C:\Users\Administrator\Desktop\aaaaa.lnk"
' msgbox Obj.CurrentDirectory ' -----displays current directory path of script
'set WshSysEnv = Obj.Environment("SYSTEM")
'msgbox WshSysEnv.Item("OS")
'set exe = Obj.Exec ("notepad.exe")
' --- WMI examples
'Set LoginProfiles = GetObject("winmgmts:").InstancesOf ("Win32_NetworkLoginProfile")
' For each Profile in LoginProfiles
' msgbox Profile.Name
' 'msgbox Profile.LogonName
' next
Set net = CreateObject("WScript.Network")
' net.MapNetworkDrive "P:", "file://pc/public%22,%22True%22,%22Administrator",""
'msgbox net.ComputerName
'msgbox net.UserName
Set oDrives = net.EnumNetworkDrives()
msgbox oDrives.Count
For i = 0 to oDrives.Count - 1 Step 2
msgbox "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1)
Next
Subscribe to:
Posts (Atom)