Advertisement:

Author Topic: Как сделать чтоб скрипт автоматически закрывался через заданное время?  (Read 4860 times)

Offline yuriy09

  • Newbie
  • *
  • Posts: 1
я новичек так что не судите грубо  :)  Скрипт должен завершать работу через например 2 часа когда меня нет возле компа,от только куда что вставлять так и не разберусь уже всё что было на форумах перепробовал!Ну ещё если кто  ещё  знает как его меньше сделать ?
Code: [Select]
#include <GUIConstantsEx.au3>
#include <img/ImageSearch.au3>

Dim $iPause, $i = 0
HotKeySet('{F6}', '_Pause') ; пауза / старт
Opt("MouseClickDelay", 1500)
HotKeySet("{ESC}", "_esc")
$fYes = False
global $y = 0, $x = 0

Func _Pause()
$iPause = Not $iPause
While $iPause
Sleep(250)
WEnd
EndFunc   ;==>_Pause

Func _esc()
Exit
EndFunc   ;==>_esc

$Form1 = GUICreate("Настройки"); Создаёт окно в центре экранa
$tab = GUICtrlCreateTab(0, 0, 400, 400)
GUICtrlCreateTabItem("Действия")
$sss = GUICtrlCreateCheckbox("Ходить по островам", 10, 20, 120, 20)
GUICtrlCreateTabItem("Выбор моба")
$Checkbox1 = GUICtrlCreateCheckbox("Мымра", 10, 30, 120, 20)
$Checkbox2 = GUICtrlCreateCheckbox("Джага", 10, 50, -1, 20)
$Checkbox3 = GUICtrlCreateCheckbox("Злобный Ника", 10, 70, -1, 20)
$Checkbox4 = GUICtrlCreateCheckbox("Макук", 10, 90, -1, 20)
$Checkbox5 = GUICtrlCreateCheckbox("Счастливая Эл", 10, 110, -1, 20)
$Checkbox6 = GUICtrlCreateCheckbox("Гэ-Дэ", 10, 130, -1, 20)
$Checkbox7 = GUICtrlCreateCheckbox("Искуситель", 10, 150, -1, 20)
$Checkbox8 = GUICtrlCreateCheckbox("Курлык", 10, 170, -1, 20)
$Checkbox9 = GUICtrlCreateCheckbox("Матазуу", 10, 190, -1, 20)
$Checkbox10 = GUICtrlCreateCheckbox("Таар Маан", 10, 210, -1, 20)
GUICtrlCreateTabItem("Забрать")
$ddd9 = GUICtrlCreateCheckbox("Серый рецепт", 10, 30, 100, 20)
$ddd1 = GUICtrlCreateCheckbox("Открытка", 10, 50, 100, 20)
$ddd2 = GUICtrlCreateCheckbox("Жетон Дева", 10, 70, 100, 20)
$ddd3 = GUICtrlCreateCheckbox("Жетон Защитник", 10, 90, 110, 20)
$ddd4 = GUICtrlCreateCheckbox("Жетон Разрушитель", 10, 110, 110, 20)
$ddd5 = GUICtrlCreateCheckbox("Жетон Праздник", 10, 130, 110, 20)
$ddd6 = GUICtrlCreateCheckbox("Жетон Скорбь", 10, 150, 110, 20)
$ddd7 = GUICtrlCreateCheckbox("Жетон Ужас", 10, 170, 110, 20)
$ddd8 = GUICtrlCreateCheckbox("Свитки Культ.", 10, 190, 110, 20)
$ddd10 = GUICtrlCreateCheckbox("Рыжый рецепт", 10, 210, 110, 20)
$ddd11 = GUICtrlCreateCheckbox("Ядовитое семечко", 10, 230, 110, 20)
$ddd12 = GUICtrlCreateCheckbox("Благословенное семечко", 10, 250, 150, 20)
GUICtrlCreateTabItem("Лексиры")
$Rrr1 = GUICtrlCreateCheckbox("Колба Магии 1я", 10, 30, 120, 20)
$rr2 = GUICtrlCreateCheckbox("Колба Магии 3я", 10, 50, 120, 20)
GUICtrlCreateTabItem("Умения")
$uu1 = GUICtrlCreateCheckbox("Молния", 10, 30, 120, 20)
$uu2 = GUICtrlCreateCheckbox("Квадрат", 10, 50, 120, 20)
$uu3 = GUICtrlCreateCheckbox("Крест", 10, 70, 120, 20)
GUICtrlCreateTabItem("Культ")
$ku1 = GUICtrlCreateCheckbox("Разруш.Огн.Шар", 10, 30, 120, 20)
$ku2 = GUICtrlCreateCheckbox("Защитник Копьё", 10, 50, 120, 20)
$ku3 = GUICtrlCreateCheckbox("Скорбь вампиризм", 10, 70, 120, 20)

GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("Свернуть", 0, 370, 400, 20)
GUISetState(@SW_SHOW)

;WinWaitActive("Небеса: уникальная MMORPG")

Func get12(); orang semy
$search = _ImageSearchArea("img/1.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
EndIf
EndFunc

Func get11(); zel semy
$search = _ImageSearchArea("img/2.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
EndIf
EndFunc

Func get10();rec orang
$search = _ImageSearchArea("img/3.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
MouseClick("left",$x, $y)
Sleep(500)
MouseClick("left",726, 483)
EndIf
EndFunc

Func get9();рец серый
$search = _ImageSearchArea("img/recs.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
MouseClick("left",726,483)
EndIf
EndFunc

Func get1(); открытка с искусителя
$search = _ImageSearchArea("img/otki.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
EndIf
EndFunc
Func get2() ;deva get
$search = _ImageSearchArea("img/getd.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
   EndIf
 EndFunc
Func get3() ;zahit geton
$search = _ImageSearchArea("img/getz.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
   EndIf
EndFunc
Func get4() ;razrush geton
$search = _ImageSearchArea("img/getr.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
   EndIf
EndFunc
Func get5() ;prazdnik geton
$search = _ImageSearchArea("img/getp.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
EndIf
EndFunc
Func get6() ;skorb geton
$search = _ImageSearchArea("img/gets.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
   EndIf
EndFunc
Func get7() ;uzas geton
$search = _ImageSearchArea("img/getu.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
   EndIf
EndFunc
Func get8() ;svitki kultovich
$search = _ImageSearchArea("img/svik.bmp", 1, 630, 460, 685, 510, $x, $y, 0)
If $search = 1 Then
 MouseClick("left",$x, $y)
Sleep(100)
vz()
   EndIf
EndFunc

Func os1()
$pos1 = PixelSearch(404,591,485,681,0xEFE5DE);мымра}
    If Not @error Then
  MouseClick("left", $pos1[0], $pos1[1],1,5)
  go()
EndIf
EndFunc
Func os2()
$pos2 = PixelSearch(481,652,498,674,0xB1AA88,2);джага}
    If Not @error Then
  MouseClick("left", $pos2[0], $pos2[1],1,5)
      go()
   EndIf
EndFunc
Func os3()
$pos3 = PixelSearch(394,453,464,620,0x12232B);злобный ника}
    If Not @error Then
  MouseClick("left", $pos3[0], $pos3[1],1,5)
  go()
   EndIf
EndFunc
Func os4()
$pos4 = PixelSearch(472,576,519,617,0x655763);макук}
    If Not @error Then
  MouseClick("left", $pos4[0], $pos4[1],1,5)
     go()
  EndIf
  EndFunc
  Func os5()
$pos5 = PixelSearch(436,583,468,618,0x0C0E16);счасливая эл
    If Not @error Then
  MouseClick("left", $pos5[0], $pos5[1],1,5)
  go()
   EndIf
EndFunc
Func os6()
$pos6 = PixelSearch(436,629,483,671,0x858860);великорогий геде}
    If Not @error Then
  MouseClick("left", $pos6[0], $pos6[1],1,5)
  go()
   EndIf
EndFunc
Func os7()
   $pos7= PixelSearch(406,618,464,666,0x332F43) ;искуситель
   If Not @error Then
    MouseClick("left", $pos7[0], $pos7[1],1,5)
  go()
   EndIf
 EndFunc
 Func os8()
   $pos8= PixelSearch(435,619,451,663,0x3F4040) ;курлык
   If Not @error Then
    MouseClick("left", $pos8[0], $pos8[1],1,5)
  go()
   EndIf
 EndFunc
  Func os9()
   $pos9= PixelSearch(414,639,440,666,0x8C3D10) ;матазу
   If Not @error Then
    MouseClick("left", $pos9[0], $pos9[1],1,5)
  go()
   EndIf
 EndFunc
   Func os10()
   $pos10= PixelSearch(436,639,468,686,0x220304,1) ;таар ман
   If Not @error Then
    MouseClick("left", $pos10[0], $pos10[1],1,5)
  go()
   EndIf
   EndFunc

Func go()
      $nap = PixelSearch(716,349,866,540,0x6B0005);нажимает на бой
   If Not @error Then
  MouseClick("left",$nap[0], $nap[1])
   EndIf
 EndFunc

Func co1()
  $mag1=PixelSearch(763,619,817,663,0x002573);magiy 1
   If Not @error Then
  MouseClick("left", $mag1[0],$mag1[1])
   EndIf
EndFunc
Func mag2()
  $magic=PixelSearch(762,619,871,663,0xC9F3CB);magiy 2
   If Not @error Then
  MouseClick("left", $magic[0],$magic[1])
   EndIf
EndFunc

Func cor1()
   $moln1 = PixelSearch(450,620,500,665,0x311611)
   If Not @error Then
  MouseClick("left",$moln1[0],$moln1[1]);molniy
  EndIf
   EndFunc
Func cor2()
   $kub = PixelSearch(500,620,550,665,0xCFAAB6)
   If Not @error Then
  MouseClick("left",$kub[0],$kub[1]);kub
  Sleep(100)
  MouseClick("left",725,417)
  EndIf
   EndFunc
   Func cor3()
   $krest = PixelSearch(550,620,600,665,0xFFD3E6)
   If Not @error Then
  MouseClick("left",$krest[0],$krest[1]);kvadrat
  Sleep(100)
  MouseClick("left",760,390)
   EndIf
 EndFunc
 Func og1()
  $atk= PixelSearch(442,616,717,715,0x7B0A00,1);атака шаром
If Not @error Then
   MouseClick("left",$atk[0], $atk[1])
EndIf
EndFunc
Func og2()
  $atk1= PixelSearch(442,616,717,715,0xF7E78D,1);атака копьём
If Not @error Then
   MouseClick("left",$atk1[0], $atk1[1])
EndIf
EndFunc
Func og3()
  $atk2= PixelSearch(442,616,717,715,0x505C47,1);атака вампиризм
If Not @error Then
   MouseClick("left",$atk2[0], $atk2[1])
EndIf
EndFunc

Func vz() ;забрать в рюкзак
MouseClick("left", 728, 502)
Sleep(2000)
MouseClick("left", 806, 547)
EndFunc   ;==>vz

Func ostr()
   $obb=PixelSearch(513,371,558,399,0x95C1DB,1)
 If Not @error Then
MouseClick("left",941,508)
Sleep(1000)
MouseClick("left",750,635);1
Sleep(1500)
MouseClick("left",803,631);
Sleep(1000)
MouseClick("left",805,637);2
Sleep(1500)
MouseClick("left",860,632);
Sleep(1000)
MouseClick("left",859,636);3
Sleep(1500)
MouseClick("left",915,632);
Sleep(1000)
MouseClick("left",913,634);4
Sleep(1500)
MouseClick("left",844,631);
Sleep(1000)
MouseClick("left",964,634);5
Sleep(1500)
MouseClick("left",881,632);
Sleep(1500)
MouseMove(945,470)
 EndIf

   $kra2=PixelSearch(448,485,568,505,0x701401,2);шщет красный цвет порожение
   If Not @error Then
  MouseClick("left",739,529)
   EndIf
   $boi=PixelSearch(757,448,852,520,0x6B0005,1); напасть полюбому
      If Not @error Then
   Sleep(1500)
   MouseClick("left",$boi[0], $boi[1])
   Sleep(10000)
EndIf

$ost = PixelSearch(996,374,1082,433,0xA77749,2);ищет остров
  If Not @error Then
MouseClick("left", $ost[0], $ost[1]);кликает на него
  ;MouseMove(1053, 402)
  Else
$ost2 = PixelSearch(996,374,1082,433,0xD7D6CB,1);ищет приватный остров
If Not @error Then
MouseClick("left", $ost2[0], $ost2[1]);кликает на него
  EndIf
  EndIf
EndFunc

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
         While 1
GUISetState(@SW_MINIMIZE, $Form1)

If GUICtrlRead ($sss) = $GUI_CHECKED Then
$fYes = True
ostr()
EndIf
If GUICtrlRead ($ddd1) = $GUI_CHECKED Then
$fYes = True
get1()
EndIf
If GUICtrlRead ($ddd2) = $GUI_CHECKED Then
$fYes = True
get2()
EndIf
If GUICtrlRead ($ddd3) = $GUI_CHECKED Then
$fYes = True
get3()
EndIf
If GUICtrlRead ($ddd4) = $GUI_CHECKED Then
$fYes = True
get4()
EndIf
If GUICtrlRead ($ddd5) = $GUI_CHECKED Then
$fYes = True
get5()
EndIf
If GUICtrlRead ($ddd6) = $GUI_CHECKED Then
$fYes = True
get6()
EndIf
If GUICtrlRead ($ddd7) = $GUI_CHECKED Then
$fYes = True
get7()
EndIf
If GUICtrlRead ($ddd8) = $GUI_CHECKED Then
$fYes = True
get8()
EndIf
If GUICtrlRead ($ddd9) = $GUI_CHECKED Then
$fYes = True
get9()
EndIf
If GUICtrlRead ($ddd10) = $GUI_CHECKED Then
$fYes = True
get10()
EndIf
If GUICtrlRead ($ddd11) = $GUI_CHECKED Then
$fYes = True
get11()
EndIf
If GUICtrlRead ($ddd12) = $GUI_CHECKED Then
$fYes = True
get12()
                EndIf
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
$fYes = True
os1()
                EndIf
                If GUICtrlRead ($Checkbox2) = $GUI_CHECKED Then
                $fYes = True
os2()
EndIf
If GUICtrlRead ($Checkbox3) = $GUI_CHECKED Then
$fYes = True
os3()
EndIf
If GUICtrlRead ($Checkbox4) = $GUI_CHECKED Then
$fYes = True
os4()
EndIf
If GUICtrlRead ($Checkbox5) = $GUI_CHECKED Then
$fYes = True
os5()
EndIf
If GUICtrlRead ($Checkbox6) = $GUI_CHECKED Then
$fYes = True
os6()
EndIf
If GUICtrlRead ($Checkbox7) = $GUI_CHECKED Then
$fYes = True
os7()
EndIf
If GUICtrlRead ($Checkbox8) = $GUI_CHECKED Then
$fYes = True
os8()
EndIf
If GUICtrlRead ($Checkbox9) = $GUI_CHECKED Then
$fYes = True
os9()
EndIf
If GUICtrlRead ($Checkbox10) = $GUI_CHECKED Then
$fYes = True
os10()
EndIf
If GUICtrlRead ($Rrr1) = $GUI_CHECKED Then
$fYes = True
co1()
EndIf
If GUICtrlRead ($uu1) = $GUI_CHECKED Then
$fYes = True
cor1()
EndIf
If GUICtrlRead ($uu2) = $GUI_CHECKED Then
$fYes = True
cor2()
EndIf
If GUICtrlRead ($uu3) = $GUI_CHECKED Then
    $fYes = True
    cor3()
EndIf
If GUICtrlRead ($ku1) = $GUI_CHECKED Then
$fYes = True
og1()
EndIf
If GUICtrlRead ($ku2) = $GUI_CHECKED Then
$fYes = True
og2()
EndIf
If GUICtrlRead ($ku3) = $GUI_CHECKED Then
$fYes = True
og3()
EndIf
If GUICtrlRead ($rr2) = $GUI_CHECKED Then
$fYes = True
mag2()
EndIf

        PixelSearch (1017, 493,1017, 493, 0x334501,1)
If Not @error Then
MouseMove(1164, 542)
Sleep(2500)
Else
$Zab1 = PixelSearch(768, 538, 784, 551, 0x284052);ищет пиксель выхода
If Not @error Then
MouseClick("left", $Zab1[0], $Zab1[1])
    $Zab2 = PixelSearch(910, 544, 926, 560, 0x0E171D)
    If Not @error Then
MouseClick("left", $Zab2[0], $Zab2[1])
EndIf
EndIf
EndIf
WEnd
   EndSwitch
Sleep(100)
WEnd

« Last Edit: April 16, 2016, 01:10:38 AM by yuriy09 »