|
呵呵,感觉你太懒了,代码不写清楚一点,让人看着很吃力!多敲几个字符很累人吗?
帮你修改了一下,看看怎样?
- Dim PackageTypeArray, PackageNameArray
- Dim Corelinkweb
- Dim WebFileIP
- WebFileIP = "10.20.30.40"
- Corelinkweb = "http://" & WebFileIP & "/web"
- PackageTypeArray= Array("bat", "exe", "msi", "linux", "swd")
- packageNameArray = Array("Batch File", "Executable", "MSI", "Linux", "SWD Package")
- 'Loop to save links of each package page
- For packageIndex = 0 to UBound(packageTypeArray)
- curPackageType = PackageTypeArray(packageIndex)
- curPackageName = packageNameArray(packageIndex)
- call SavePackagePageLinks(curPackageType, curPackageName)
- Next
- Public Function SavePackagePageLinks(ByVal PackageType, ByVal PackageName)
- Dim packageDir, packageUrl
- Dim iePath
- Dim linkIndex, curLink
- packageDir = "/" & PackageType & "/"
- packageUrl = Corelinkweb & packageDir
- iePath = ""C:\Program Files\Internet Explorer\iexplore.exe"
- 'Open the package page
- SystemUtil.Run iePath, packageUrl , "C:\Documents and Settings\Administrator", "open"
- 'Init the OR object
- Browser("WebServer").SetTOProperty "name", ".*" & packageDir
- Browser("WebServer").Page("WebServer").SetTOProperty "title", ".*" & packageDir
- 'Loop to save each link of package page, skip the first link
- Set packagePageLinks = browser("WebServer").Page("WebServer").Object.links
- For linkIndex = 1 to UBound(packagePageLinks)
- curLink = curPageLinks(linkIndex)
- Browser("L").Page("sm").Frame("left").Link("Distribution").Click
- Browser("L").Page("sm").Frame("distributionPackagesTree").WebElement("My distribution packages").Click
- Browser("L").Page("sm").Frame("findfrm").Link("New").Click
- Browser("D").Page("D").Sync
- Browser("D").Page("D").WebList("DropDownListPkgType").Select PackageName
- Browser("D").Page("D").WebEdit("_packageNameTextBox").Set curLink
- Browser("D").Page("D").WebEdit("_descriptionTextBox").Set curLink
- Browser("D").Page("D").WebEdit("_primaryFileTextBox").Set curLink
- Browser("D").Page("D").WebButton("Save").Click
- Next
- 'Close browser
- Browser("WebServer").Close
- End Function
复制代码
[ 本帖最后由 yabest 于 2007-9-8 07:20 编辑 ] |
|