Что нового

Не работает пауза в скрипте.

Ksaan

Знающий
Сообщения
207
Репутация
15
Помогите бедолаге а то сам не понимаю :stars:

Было два разных скрипта попытался соеденить все в месте и вот что вышло
НО :scratch:


Код:
#include <MouseOnEvent.au3>

Global $Paused = True
Global $Tiple1 = False
Global $Tiple2 = False



_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "Down")
_MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "Up")





HotKeySet('{NUMPAD1}', 'AK')
HotKeySet('{NUMPAD2}', 'SV')
HotKeySet('{DELETE}', '_Exit')
HotKeySet('{NUMPADADD}', '_return')




While 1
   Sleep(1)
      If $Tiple1 Then
          While 1
   If Not $Paused Then
   
    Send('{з down}')
	 $pos = MouseGetPos()
    Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos1 = MouseGetPos()
  MouseMove($pos1[0] - 4   , $pos1[1] + 5, 0)
    Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos2 = MouseGetPos()
     MouseMove($pos2[0] - 4   , $pos2[1] + 10, 0)
    Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos3 = MouseGetPos()
    MouseMove($pos3[0] - 3   , $pos3[1] + 10, 0)
     Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos4 = MouseGetPos()
     MouseMove($pos4[0] - 5   , $pos4[1] + 9, 0)
     Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos5 = MouseGetPos()
    MouseMove($pos5[0] + 10    , $pos5[1] + 5, 0)
     Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos6 = MouseGetPos()
    MouseMove($pos6[0] - 5    , $pos6[1] + 5, 0)
    Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos7 = MouseGetPos()
     MouseMove($pos7[0] + 11    , $pos7[1] + 4, 0)
     Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos8 = MouseGetPos()
   MouseMove($pos8[0] - 10    , $pos8[1] + 2, 0)
     Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos9 = MouseGetPos()
    MouseMove($pos9[0] + 9    , $pos9[1] - 3, 0)
       Sleep(98)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
	   EndIf
     $pos10 = MouseGetPos()
    MouseMove($pos10[0] + 6    , $pos10[1] , 0)
       Sleep(98)
    If $Paused Then
      Send('{з up}')
	    Sleep(98)
      ContinueLoop
	   EndIf
 Else
    Sleep(1)
  EndIf
          WEnd
	  EndIf
	   
	  If $Tiple2 Then
		  While 1
  If Not $Paused Then
   
    Send('{з down}')
	 $pos = MouseGetPos()
    Sleep(70)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos1 = MouseGetPos()
  MouseMove($pos1[0] + 2   , $pos1[1] + 2, 0)
    Sleep(70)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos2 = MouseGetPos()
     MouseMove($pos2[0] + 2   , $pos2[1] + 2, 0)
    Sleep(70)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos3 = MouseGetPos()
    MouseMove($pos3[0] + 2   , $pos3[1] + 2, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos4 = MouseGetPos()
     MouseMove($pos4[0] + 2   , $pos4[1] + 2, 0)
    Sleep(90)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos5 = MouseGetPos()
    MouseMove($pos5[0] + 2    , $pos5[1] + 2, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos6 = MouseGetPos()
    MouseMove($pos6[0] - 2    , $pos6[1] + 2, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos7 = MouseGetPos()
     MouseMove($pos7[0] + 2    , $pos7[1] - 2, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos8 = MouseGetPos()
   MouseMove($pos8[0] - 3    , $pos8[1] - 4, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf
    $pos9 = MouseGetPos()
    MouseMove($pos9[0] - 3    , $pos9[1] + 1, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
	   EndIf
     $pos10 = MouseGetPos()
    MouseMove($pos10[0]     , $pos10[1] - 1, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
	  Sleep(250)
      ContinueLoop
	   EndIf
     $pos11 = MouseGetPos()
    MouseMove($pos11[0]  - 1  , $pos11[1] + 1, 0)
    Sleep(75)
    If $Paused Then
      Send('{з up}')
      ContinueLoop
   EndIf

 Else
    Sleep(1)
  EndIf
          WEnd
		  
	  EndIf


    Sleep(100)
WEnd

Func AK()
 
   $Tiple1 = True
 EndFunc   
 
 
 Func SV()
   
	$Tiple2 = True
 EndFunc
 
 Func _return()
	$Tiple1 = False
	$Tiple2 = False
 EndFunc
 
 
Func Down()
  $Paused = False
EndFunc

Func Up()
  $Paused = True
EndFunc

Func _Exit()
  Exit
EndFunc   ;==>_Exit


Так почему при использований функций

Код:
Func _return()
	$Tiple1 = False
	$Tiple2 = False
 EndFunc


он не ставит/переводит скрипт на паузу для повторного выбора Tiple1, Tiple2 ???? :mad:
 

ivsatel

Продвинутый
Сообщения
319
Репутация
84
Код:
#include <MouseOnEvent.au3>

Global $Paused = True
Global $Tiple1 = False
Global $Tiple2 = False



_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "Down")
_MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "Up")





HotKeySet('{NUMPAD1}', 'AK')
HotKeySet('{NUMPAD2}', 'SV')
HotKeySet('{DELETE}', '_Exit')
HotKeySet('{NUMPADADD}', '_return')




While 1
	Sleep(10)
	If $Tiple1 Then
		ConsoleWrite($Tiple2 & ' If $Tiple1 Then' & @LF)
		Send("{NUMLOCK off}")
		While 1
			If Not $Paused Then

				Send('{з down}')
				$pos = MouseGetPos()
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos1 = MouseGetPos()
				MouseMove($pos1[0] - 4, $pos1[1] + 5, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos2 = MouseGetPos()
				MouseMove($pos2[0] - 4, $pos2[1] + 10, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos3 = MouseGetPos()
				MouseMove($pos3[0] - 3, $pos3[1] + 10, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos4 = MouseGetPos()
				MouseMove($pos4[0] - 5, $pos4[1] + 9, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos5 = MouseGetPos()
				MouseMove($pos5[0] + 10, $pos5[1] + 5, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos6 = MouseGetPos()
				MouseMove($pos6[0] - 5, $pos6[1] + 5, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos7 = MouseGetPos()
				MouseMove($pos7[0] + 11, $pos7[1] + 4, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos8 = MouseGetPos()
				MouseMove($pos8[0] - 10, $pos8[1] + 2, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos9 = MouseGetPos()
				MouseMove($pos9[0] + 9, $pos9[1] - 3, 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos10 = MouseGetPos()
				MouseMove($pos10[0] + 6, $pos10[1], 0)
				Sleep(98)
				If $Paused Then
					Send('{з up}')
					Sleep(98)
					ContinueLoop
				EndIf
			Else
				Sleep(10)
			EndIf
			Send("{NUMLOCK on}")
		WEnd
	EndIf

	If $Tiple2 Then
		ConsoleWrite($Tiple2 & ' If $Tiple2 Then' & @LF)
		While 1
				Send("{NUMLOCK off}")
			If Not $Paused Then

				Send('{з down}')
				$pos = MouseGetPos()
				Sleep(70)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos1 = MouseGetPos()
				MouseMove($pos1[0] + 2, $pos1[1] + 2, 0)
				Sleep(70)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos2 = MouseGetPos()
				MouseMove($pos2[0] + 2, $pos2[1] + 2, 0)
				Sleep(70)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos3 = MouseGetPos()
				MouseMove($pos3[0] + 2, $pos3[1] + 2, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos4 = MouseGetPos()
				MouseMove($pos4[0] + 2, $pos4[1] + 2, 0)
				Sleep(90)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos5 = MouseGetPos()
				MouseMove($pos5[0] + 2, $pos5[1] + 2, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos6 = MouseGetPos()
				MouseMove($pos6[0] - 2, $pos6[1] + 2, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos7 = MouseGetPos()
				MouseMove($pos7[0] + 2, $pos7[1] - 2, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos8 = MouseGetPos()
				MouseMove($pos8[0] - 3, $pos8[1] - 4, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos9 = MouseGetPos()
				MouseMove($pos9[0] - 3, $pos9[1] + 1, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf
				$pos10 = MouseGetPos()
				MouseMove($pos10[0], $pos10[1] - 1, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					Sleep(250)
					ContinueLoop
				EndIf
				$pos11 = MouseGetPos()
				MouseMove($pos11[0] - 1, $pos11[1] + 1, 0)
				Sleep(75)
				If $Paused Then
					Send('{з up}')
					ContinueLoop
				EndIf

			Else
				Sleep(10)
			EndIf
		WEnd

	EndIf


	Sleep(10)
			Send("{NUMLOCK on}")
WEnd

Func AK()

	$Tiple1 = True
	ConsoleWrite("$Tiple1 = True" & @LF)
EndFunc   ;==>AK


Func SV()

	$Tiple2 = True

	ConsoleWrite("$Tiple2 = True" & @LF)
EndFunc   ;==>SV

Func _return()
	$Tiple1 = False
	$Tiple2 = False
	ConsoleWrite("$Tiple1 = False & $Tiple2 = False" & @LF)
EndFunc   ;==>_return


Func Down()
	$Paused = False
EndFunc   ;==>Down

Func Up()
	$Paused = True
EndFunc   ;==>Up

Func _Exit()
	Exit
EndFunc   ;==>_Exit
 
Автор
Ksaan

Ksaan

Знающий
Сообщения
207
Репутация
15
Тоже самое реакций на паузу 0
 

trizorka

Новичок
Сообщения
53
Репутация
4
может просто фунцию добавить отдельную
Код:
HotKeySet("{PAUSE}", "_TogglePause")
Func _TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(10)
    WEnd
EndFunc
 

madmasles

Модератор
Глобальный модератор
Сообщения
7,790
Репутация
2,322
trizorka,
Предупреждение За нарушение правил форума (пункт В.11):
Любые отрывки AutoIt кода необходимо заключать в тег [autoit]
autoit.gif
(подробнее), а обычный код соответственно в тег [code]
code.gif
(подробнее). Также большие выдержки текста помещайте под тег [spoiler]
spoiler.gif
(подробнее), там где это поддерживается естественно. Как в случае с названием темы, также короткое и эргономичное сообщение привлекает больше внимания, и шансы на получение конкретного ответа увеличиваются.


С уважением, ваш Глобальный модератор.
 
Автор
Ksaan

Ksaan

Знающий
Сообщения
207
Репутация
15
Хорошо кто мне сможет объяснить почему функция
Код:
_return()

не останавливает/завершает скрипт для повторного выбора??
Код:
$Tiple1
 $Tiple2


P.S подправил первый пост.
 

ivsatel

Продвинутый
Сообщения
319
Репутация
84
Ksaan

Код:
#include <MouseOnEvent.au3>

Global $Paused = True
Global $Tiple1 = False
Global $Tiple2 = False

_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "Down")
_MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "Up")

HotKeySet('{NUMPAD1}', 'AK')
HotKeySet('{NUMPAD2}', 'SV')
HotKeySet('{DELETE}', '_Exit')
HotKeySet('{NUMPADADD}', '_return')

While 1
	Sleep(10)
		If $Tiple1 Then
			While 1
				If Not $Paused Then
					Send('{з down}')
					$pos = MouseGetPos()
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos1 = MouseGetPos()
					MouseMove($pos1[0] - 4, $pos1[1] + 5, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos2 = MouseGetPos()
					MouseMove($pos2[0] - 4, $pos2[1] + 10, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos3 = MouseGetPos()
					MouseMove($pos3[0] - 3, $pos3[1] + 10, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos4 = MouseGetPos()
					MouseMove($pos4[0] - 5, $pos4[1] + 9, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos5 = MouseGetPos()
					MouseMove($pos5[0] + 10, $pos5[1] + 5, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos6 = MouseGetPos()
					MouseMove($pos6[0] - 5, $pos6[1] + 5, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos7 = MouseGetPos()
					MouseMove($pos7[0] + 11, $pos7[1] + 4, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos8 = MouseGetPos()
					MouseMove($pos8[0] - 10, $pos8[1] + 2, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos9 = MouseGetPos()
					MouseMove($pos9[0] + 9, $pos9[1] - 3, 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos10 = MouseGetPos()
					MouseMove($pos10[0] + 6, $pos10[1], 0)
					Sleep(98)
					If $Paused Then
						Send('{з up}')
						Sleep(98)
					EndIf
				EndIf
				ExitLoop
			WEnd
		EndIf
		If $Tiple2 Then
			While 1
				If Not $Paused Then
					Send('{з down}')
					$pos = MouseGetPos()
					Sleep(70)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos1 = MouseGetPos()
					MouseMove($pos1[0] + 2, $pos1[1] + 2, 0)
					Sleep(70)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos2 = MouseGetPos()
					MouseMove($pos2[0] + 2, $pos2[1] + 2, 0)
					Sleep(70)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos3 = MouseGetPos()
					MouseMove($pos3[0] + 2, $pos3[1] + 2, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos4 = MouseGetPos()
					MouseMove($pos4[0] + 2, $pos4[1] + 2, 0)
					Sleep(90)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos5 = MouseGetPos()
					MouseMove($pos5[0] + 2, $pos5[1] + 2, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos6 = MouseGetPos()
					MouseMove($pos6[0] - 2, $pos6[1] + 2, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos7 = MouseGetPos()
					MouseMove($pos7[0] + 2, $pos7[1] - 2, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos8 = MouseGetPos()
					MouseMove($pos8[0] - 3, $pos8[1] - 4, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos9 = MouseGetPos()
					MouseMove($pos9[0] - 3, $pos9[1] + 1, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
					EndIf
					$pos10 = MouseGetPos()
					MouseMove($pos10[0], $pos10[1] - 1, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
						Sleep(250)
					EndIf
					$pos11 = MouseGetPos()
					MouseMove($pos11[0] - 1, $pos11[1] + 1, 0)
					Sleep(75)
					If $Paused Then
						Send('{з up}')
					EndIf
				EndIf
				ExitLoop
			WEnd
		EndIf
	Sleep(10)
WEnd

Func AK()
	$Tiple1 = True
EndFunc   ;==>AK


Func SV()
	$Tiple2 = True
EndFunc   ;==>SV

Func _return()
	$Tiple1 = False
	$Tiple2 = False
EndFunc   ;==>_return

Func Down()
	$Paused = False
EndFunc   ;==>Down

Func Up()
	$Paused = True
EndFunc   ;==>Up

Func _Exit()
	Exit
EndFunc   ;==>_Exit
 
Автор
Ksaan

Ksaan

Знающий
Сообщения
207
Репутация
15
Оно то канешно спс но я так и не понял почему скрипт не работал так как надо.
 
Верх