Simplify a script

Get help with using AutoHotkey and its commands and hotkeys
Marcosa1020
Posts: 160
Joined: 23 Sep 2015, 19:15

Simplify a script

Post by Marcosa1020 » 18 Sep 2017, 09:02

Hello,
This is part of the script, could you tell me how to simplify this script ?
Thank you.

Code: Select all

16D_S1:
{
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
SetBatchLines -1
Send {Click, 11, 508, 2}
Sleep 2000
GuiControl,1:,card2,1
Loop, % myArray1.length()
{
Sleep %Slider%
Click % "11, " myArray1[A_Index] ", 2"
Sleep 300
GuiControl,1:,card3,%A_Index%
If stop
Exit
}
GuiControl,1:,card2,2
Loop, 20
{
Sleep %Slider%
Click % "17, " myArray2[A_Index] ", 2"
Sleep 300
GuiControl,1:,card3,% 21-A_Index
If stop
Exit
}
GuiControl,1:,card2,3
Loop, 20
{
Sleep %Slider%
Click % "23, " myArray1[A_Index] ", 2"
Sleep 300
GuiControl,1:,card3,%A_Index%
If stop
   Exit
}
GuiControl,1:,card2,4
Loop, 20
{
Sleep %Slider%
Click % "29, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,5
Loop, 20
{
Sleep %Slider%
Click % "34, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,6
Loop, 20
{
Sleep %Slider%
Click % "40, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,7
Loop, 20
{
Sleep %Slider%
Click % "46, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,8
Loop, 20
{
Sleep %Slider%
Click % "51, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,9
Loop, 20
{
Sleep %Slider%
Click % "57, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
Sleep %Slider%
Click % "63, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
}
return

16D_S2:
{
SetBatchLines -1
Send {Click, 75, 508, 2}
Sleep 1000
GuiControl,1:,card2,1
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
Loop, % myArray1.length()
{
	Sleep %Slider%
Click % "75, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,2
Loop, 20
{
	Sleep %Slider%
Click % "81, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,3
Loop, 20
{
	Sleep %Slider%
Click % "87, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,4
Loop, 20
{
	Sleep %Slider%
Click % "93, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,5
Loop, 20
{
	Sleep %Slider%
Click % "98, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,6
Loop, 20
{
	Sleep %Slider%
Click % "104, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,7
Loop, 20
{
	Sleep %Slider%
Click % "110, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,8
Loop, 20
{
	Sleep %Slider%
Click % "116, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,9
Loop, 20
{
	Sleep %Slider%
Click % "121, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
	Sleep %Slider%
Click % "127, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
}
return

16D_S3:
{
SetBatchLines -1
Send {Click, 140, 508, 2}
Sleep 2000
GuiControl,1:,card2,1
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
Loop, % myArray1.length()
{
	Sleep %Slider%
Click % "140, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,2
Loop, 20
{
	Sleep %Slider%
Click % "146, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,3
Loop, 20
{
	Sleep %Slider%
Click % "152, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,4
Loop, 20
{
	Sleep %Slider%
Click % "157, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,5
Loop, 20
{
	Sleep %Slider%
Click % "163, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,6
Loop, 20
{
	Sleep %Slider%
Click % "169, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,7
Loop, 20
{
	Sleep %Slider%
Click % "175, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,8
Loop, 20
{
	Sleep %Slider%
Click % "180, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,9
Loop, 20
{
	Sleep %Slider%
Click % "186, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
	Sleep %Slider%
Click % "192, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
}
return

16D_S4:
{
SetBatchLines -1
Send {Click, 205, 508, 2}
Sleep 2000
GuiControl,1:,card2,1
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
Loop, % myArray1.length()
{
	Sleep %Slider%
Click % "205, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,2
Loop, 20
{
	Sleep %Slider%
Click % "211, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,3
Loop, 20
{
	Sleep %Slider%
Click % "216, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,4
Loop, 20
{
	Sleep %Slider%
Click % "222, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,5
Loop, 20
{
	Sleep %Slider%
Click % "228, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,6
Loop, 20
{
	Sleep %Slider%
Click % "233, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,7
Loop, 20
{
	Sleep %Slider%
Click % "239, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,8
Loop, 20
{
	Sleep %Slider%
Click % "245, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}	
GuiControl,1:,card2,9
Loop, 20
{
	Sleep %Slider%
Click % "250, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
	Sleep %Slider%
Click % "257, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
}
return

16D_E1:
{
SetBatchLines -1
Send {Click, 11, 508, 2}
Sleep 2000
GuiControl,1:,card2,1
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
myArray3:=[17,23,29,34,40,46,51,57]
myArray4:=[57,51,46,40,34,29,23,17]
Loop, 20
{
	Sleep %Slider%
Click % "11, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
Loop, 8
{
	Sleep %Slider%
var:=myArray3[A_Index]
Click, %var%, 326, 2
GuiControl,1:,card2,%A_Index%
GuiControl,1:,card3,20
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
	Sleep %Slider%
Click % "63, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
Loop, 8
{
	Sleep %Slider%
var:=myArray4[A_Index]
Click, %var%, 509, 2
GuiControl,1:,card2,% 10-A_Index
GuiControl,1:,card3,1
Sleep 300
If stop
   Exit
}
}
return

16D_E2:
{
SetBatchLines -1
Send {Click, 75, 508, 2}
Sleep 2000
GuiControl,1:,card2,1
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
myArray3:=[81,87,93,98,104,110,116,121]
myArray4:=[121,116,110,104,98,93,87,81]
Loop, 20
{
 Sleep %Slider%
Click % "75, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
Loop, 8
{
 Sleep %Slider%
var:=myArray3[A_Index]
Click, %var%, 326, 2
GuiControl,1:,card2,%A_Index%
GuiControl,1:,card3,20
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
 Sleep %Slider%
Click % "127, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
Loop, 8
{
 Sleep %Slider%
var:=myArray4[A_Index]
Click, %var%, 509, 2
GuiControl,1:,card2,% 10-A_Index
GuiControl,1:,card3,1
Sleep 300
If stop
   Exit
}
}
return

16D_E3:
{
SetBatchLines -1
Send {Click, 140, 508, 2}
Sleep 2000
GuiControl,1:,card2,1
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
myArray3:=[146,152,157,163,169,175,180,186]
myArray4:=[186,180,175,169,163,157,152,146]
Loop, 20
{
 Sleep %Slider%
Click % "140, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
Loop, 8
{
 Sleep %Slider%
var:=myArray3[A_Index]
Click, %var%, 326, 2
GuiControl,1:,card2,%A_Index%
GuiControl,1:,card3,20
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
 Sleep %Slider%
Click % "192, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
Loop, 8
{
 Sleep %Slider%
var:=myArray4[A_Index]
Click, %var%, 509, 2
GuiControl,1:,card2,% 10-A_Index
GuiControl,1:,card3,1
Sleep 300
If stop
   Exit
}
}
return

16D_E4:
{
SetBatchLines -1
Send {Click, 205, 508, 2}
Sleep 2000
GuiControl,1:,card2,1
myArray1:=[508,499,489,479,470,460,450,441,431,421,412,402,392,383,373,363,354,344,334,325]
myArray2:=[325,334,344,354,363,373,383,392,402,412,421,431,441,450,460,470,479,489,499,508]
myArray3:=[211,216,222,228,233,239,245,250]
myArray4:=[250,245,239,233,228,222,216,211]
Loop, 20
{
 Sleep %Slider%
Click % "205, " myArray1[A_Index] ", 2"
GuiControl,1:,card3,%A_Index%
Sleep 300
If stop
   Exit
}
Loop, 8
{
 Sleep %Slider%
var:=myArray3[A_Index]
Click, %var%, 326, 2
GuiControl,1:,card2,%A_Index%
GuiControl,1:,card3,20
Sleep 300
If stop
   Exit
}
GuiControl,1:,card2,10
Loop, 20
{
 Sleep %Slider%
Click % "257, " myArray2[A_Index] ", 2"
GuiControl,1:,card3,% 21-A_Index
Sleep 300
If stop
   Exit
}
Loop, 8
{
 Sleep %Slider%
var:=myArray4[A_Index]
Click, %var%, 509, 2
GuiControl,1:,card2,% 10-A_Index
GuiControl,1:,card3,1
Sleep 300
If stop
   Exit
}
}
return

Helgef
Posts: 4479
Joined: 17 Jul 2016, 01:02
Contact:

Re: Simplify a script

Post by Helgef » 18 Sep 2017, 09:18


Post Reply

Return to “Ask For Help”