Город МОСКОВСКИЙ
00:06:22

VBScript Basics, Part 31 | Internet Explorer - Existing Window (Automation)

Аватар
Искусство и Мастерство
Просмотры:
48
Дата загрузки:
11.09.2023 03:46
Длительность:
00:06:22
Категория:
Обучение

Описание

VBScripting (.vbs) Basic tutorial on how to use an existing or already opened Internet Explorer Window instead of creating a new one to run your script.

Code Example:
______________________________________________________

Option Explicit
Dim objApp, nIE, oIE, Window

Set objApp = CreateObject("Shell.Application")
Set oIE = Nothing


For Each Window In objApp.Windows
If InStr( Window.Name, "Internet Explorer" ) Then
Set oIE = Window
End If
Next

If oIE is Nothing Then
Call NewIE
Else
Call OpenIE
End If


'Internet Explorer is closed.
Sub NewIE
Set nIE = CreateObject("InternetExplorer.Application")
nIE.Navigate2 "http://www.youtube.com/user/thesimplycoded/",2048
nIE.Visible = True
End Sub

'Internet Explorer is already opened.
Sub OpenIE
oIE.Navigate2 "http://www.youtube.com/user/thesimplycoded/",2048
oIE.Visible = True
End Sub


'navOpenInNewTab = 2048
'navOpenInBackgroundTab = 4096

______________________________________________________

Рекомендуемые видео