Как на vbs или bat или cmd изменить размер окна браузера?
Формулировка задачи:
Здравствуйте.
Нужен скрипт vbs для изменения уже открытого окна мазилы размером 600х800.
Нашёл код 2014г. для мазилы,не работает.
Листинг программы
- function get_ww(window) {
- var frameWidth = 800;
- if (window.self.innerWidth)
- frameWidth = window.self.innerWidth;
- else if (window.document.documentElement && window.document.documentElement.clientWidth)
- frameWidth = window.document.documentElement.clientWidth;
- else if (window.document.body)
- frameWidth = window.document.body.clientWidth;
- return frameWidth;
- }
- function get_wh(window) {
- var frameHeight = 600;
- if (window.self.innerHeight)
- frameHeight = window.self.innerHeight;
- else if (window.document.documentElement && window.document.documentElement.clientHeight)
- frameHeight = window.document.documentElement.clientHeight;
- else if (window.document.body)
- frameHeight = window.document.body.clientHeight;
- return frameHeight;
- }
Решение задачи: «Как на vbs или bat или cmd изменить размер окна браузера?»
textual
Листинг программы
- Option Explicit
- Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExW" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
- Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthW" (ByVal hWnd As Long) As Long
- Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextW" (ByVal hWnd As Long, ByVal lpString As Long, ByVal cch As Long) As Long
- Private Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
- Private Sub Form_Load()
- Dim hWnd As Long
- Dim cbCount As Long
- Dim wszBuffer As String
- Do
- hWnd = FindWindowEx(0, hWnd, StrPtr("MozillaWindowClass"), 0)
- If hWnd = 0 Then Exit Sub
- cbCount = GetWindowTextLength(hWnd)
- If cbCount > 0 Then
- wszBuffer = Space$(cbCount)
- GetWindowText hWnd, StrPtr(wszBuffer), cbCount + 1
- If InStr(1, wszBuffer, "Mozilla Firefox", vbTextCompare) > 0 Then
- Exit Do
- End If
- End If
- Debug.Assert DoEvents >= 0
- Loop
- MoveWindow hWnd, 100, 100, 400, 400, 1
- End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д