Что нового

[Окна, Диалоги] Перемещение Окна браузера IE

PraxisIn

Новичок
Сообщения
5
Репутация
0
При заходе на сайт "Одноклассники" либо "В контакте" через Браузер IE , окно IE начинает уменьшаться и передвигаться и т.д. и еще хотелось бы сделать чтобы параметры WinMove циклически менялись по любому правилу. На выходе программы окно Браузер IE должно передвигаеться постоянно по монитору. Пробовал разные комбинации но мне явно нехватает понимания работы вложенных циклов или последовательности выполнения операторов... просьба ткнуть куда нибудь либо намекнуть. :wacko: :wacko:
Код:
Opt("WinTitleMatchMode", 2)

While 1
    Sleep(1000)
    if WinWaitActive("Microsoft Internet Explorer", "vkontakte") then block_2()
    if WinWaitActive("Microsoft Internet Explorer", "odnoklassniki") then block_1()
     
WEnd

Func block_1()
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 0, 500, 200,600)
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 200, 500, 200,600)
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 400, 500, 200,600)
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 600, 500, 200,600)
EndFunc

Func block_2()
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 0, 500, 200,600)
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 200, 500, 200,600)
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 400, 500, 200,600)
    Sleep(300)
    WinMove("Microsoft Internet Explorer", "", 600, 500, 200,600)
EndFunc
 

beve

Осваивающий
Сообщения
104
Репутация
31
Код:
Opt("WinTitleMatchMode", 2)
Global $TempFile="~tmp.au3"

Global $Pid_TempFile1
Global $Pid_TempFile2
GUICreate("Невидимое окно") ;нужно для того, чтобы если главный скрипт завершит работу, то второстепенные скрипты тоже завершат свою работу...

While 1
	$hWin=WinActive("В Контакте", "")
	if $hWin<>0 and ProcessExists($Pid_TempFile1)=0 then $Pid_TempFile1=block(WinGetTitle($hWin), $TempFile)

	$hWin=WinActive("Одноклассники.ru", "")
	if $hWin<>0 and ProcessExists($Pid_TempFile2)=0 then $Pid_TempFile2=block(WinGetTitle($hWin),$TempFile)

	Sleep(1000)
WEnd


Func block($sWinTitle, $TempFile)
Local $width=200, $height=600
Local $hfileopen = fileopen(@tempdir & "\"&$TempFile, 2)
Local $string = '#NOTRAYICON' & @lf & _
'While WinExists("'&$sWinTitle&'", "")=1' & @lf & _
'WinMove("'&$sWinTitle&'", "", Random(0, '&@DesktopWidth-$width&', 1), Random(0, '&@DesktopHeight- $height&', 1), '&$width&','& $height&')' & @lf & _
'Sleep(700)' & @lf & _
'if Not WinExists("Невидимое окно","") then Exit' & @lf & _
'Wend'
filewrite($hfileopen, $string)
fileclose($hfileopen)
$Pid_TempFile=run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @tempdir & "\"&$TempFile& '"')
Return $Pid_TempFile
EndFunc
 
Верх