Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/osascript
- -- THIS SCRIPT IS AN uTiP.io AUTOCLICK TOOL FOR MAC OS X, BASED ON :
- -- * A REGULAR SCREENCAPTURE TOOL FOR MAC OS X (already installed)
- -- * A COORDINATES & PIXEL-COLOR BASED FAST ANALYSIS OF THE PICTURE
- -- "IMAGEMAGICK" : must be installed, i use macport but other should be fine
- -- * AN AUTOLICK TOOL
- -- "CLICLICK" : must be installed, i use macport but other should be fine
- -- IT HAS BEEN TESTED ON FIREFOX : THIS GIVES LIMITED ACCESS PER DAY AND PER IP
- -- (~ 30 ADS or 150 points)
- -- BUT ... SEE THE [EXTRA NOTE] TO GET MORE !!
- -- [INSTALLING] : SEE [A] and [B] Below BEFORE, VERY IMPORTANT !!
- -- [RUNNING] :
- -- (a) just start firefox on the right part of the screen
- -- (b) load a utip url
- -- (c) possibly logs-in on utip if you want
- -- (d) run the script and look where the script is moving the mouse (change according to your screen size below ~ see lines 50-60)
- -- [EXTRA NOTE] :
- -- IF you reach the "FireTipR" using this script THEN i will give you the full version WITH EXTRA PROXY ACCESS
- -- * reaching the "FireTipR" is very easy for free:
- -- (1) dont delete the example urls below,
- -- (2) just add few other ones,
- -- (3) run the tool once a day [or] night
- -- * YOU MUST LOG WITH YOUR UTIP ACCOUNT WHEN THE SCRIPT IS RUNNING
- -- (just logs in in firefox BEFORE the script start)
- --
- -- possibilities (i can see) to get in touch with me :
- -- - just put (nice of course ;-) ) comments/thumbs on some of my utube videos to know who u ar.
- -- - just get it touch with me, with your utube account
- -- [A] WHAT IS NEEDED TO SET/FIX BEFORE RUNNING :
- -- * the "cliclick" tool ==> "sudo port install cliclick" after having macports, (or other procedure for homebrew) installed
- Property Cliclick_bin : "/opt/local/bin/cliclick"
- -- * "ImageMagick" tool to get "convert" ==> see just before
- Property Convert_bin : "/opt/local/bin/convert"
- -- * Browser with close warnings disabled (start it/close it on the utip webpage before, start it onnthe right webpage before running the script)
- Property Browser_ap : "Firefox"
- Property Browser_process : "firefox"
- -- [B] TODO DURING FIRST RUNNING :
- -- * "Security and Confidentiality" --> "Confidentiality" -> "Automaton" : Allow "Terminal" to use "System Events"
- -- ** Check with "Cmd"+"Shift"+"4" the approximate coordinates of the middle betwen "Next" and "WatchAdd" buttons and "Start" Button, and put them below /or/ put the browser to the right place ;-)
- -- *** Check also the "Cookie" Button coordinates
- property Utip_urls : {"https://utip.io/stardust","https://www.utip.io/astec","https://utip.io/squeme","https://utip.io/monsieurbidouille","https://utip.io/qtgeekes"}
- -- moving mouse grid for "next"/"start" buttons (mouse coordinates, you have to multiply by 2 to get "pixels")
- property X_Next : 900 + random number from -1 to 1 -- IF BROWSER ON THE RIGHT-PART OF THE SCREEN [x|v] : non-retina : 900 -- retina : 1250
- property Y_Next : 550 + random number from -1 to 1 -- IF BROWSER ON THE RIGHT-PART OF THE SCREEN [x|v] : non-retina : 550 -- retina : 600
- property X_Nb_Next : 2 -- number of steps (1 means "3 steps around", 2 means "5 steps around", ... many will take much more of you CPU !!)
- property Y_Nb_Next : 7
- property X_Jump_Next : 20 -- shifting mouse coordinates (on retina : replace these two values)
- property Y_Jump_Next : 20
- -- moving mouse grid for "cookie" button (mouse coordinates, you have to multiply by 2 to get "pixels")
- property X_Cookie : 1250 + random number from -1 to 1 -- non-retina : 1250 -- retina : 1550
- property Y_Cookie : 750 + random number from -1 to 1 -- non-retina : 750 -- retina : 950
- property X_Nb_Cookie : 1 -- number of steps (1 means "3 steps around", 2 means "5 steps around", ... many will take much more of you CPU !!)
- property Y_Nb_Cookie : 1
- property X_Jump_Cookie : 20 -- shifting mouse coordinates (on retina : x1.5 these two values)
- property Y_Jump_Cookie : 20
- -- SLEEP AND LOADING PARAMETERS
- -- number of tabs simulaneously load (just help to "fast load" and "caching", does not speed "ads watching")
- Property nbTab : 2
- -- last position that was matching (avoid multiple tests), set to -1 when starting
- property X_last_Next : -1
- property Y_last_Next : -1
- property X_last_Start : -1
- property Y_last_Start : -1
- property X_last_Cookie : -1
- property Y_last_Cookie : -1
- property X_last_NoMore : -1
- property Y_last_NoMore : -1
- -- border colors for "start" button (this button is not homogeneous, so i use a vector product)
- property R_Start_A : 60
- property G_Start_A : 123
- property B_Start_A : 234
- property R_Start_B : 250
- property G_Start_B : 107
- property B_Start_B : 190
- -- These variables are set Once !!
- -- Restart parameters (seconds) [one before a Start/Next button, the other is addtional time between several Next ]
- global max_cRestartExtraTime
- set max_cRestartExtraTime to 180
- global max_cNoAction
- set max_cNoAction to 60 * nbTab
- -- [C] These variable will Change along the script !!
- -- Number of No Actions cycles counted (seconds), must restart after some max_cNoAction
- global cNoAction
- set cNoAction to 0
- -- Number of NoMore ads found without any ads !! at some point you mest restart
- global cNoMoreChanges
- set cNoMoreChanges to 0
- -- Set to True when a "Start" or "Next is encountered, Set to False when restarting browser
- global cStart
- set cStart to False
- -- Extra time given to load urls at a new start
- global cRestartExtraTime
- set cRestartExtraTime to max_cRestartExtraTime
- -- Count of the number of "Next" passed since last "restart"
- global cNext
- set cNext to 0
- -- restart and choose URL
- restart_browser(False)
- -- THESE MOUSE MOVES ARE HERE TO SHOW THE GRID PATTERNS USED !!
- -- move clic pos only
- multiclic(X_Next,Y_Next,X_Nb_Next,Y_Nb_Next,X_Jump_Next,Y_Jump_Next,"m")
- -- move cookie pos only
- multiclic(X_Cookie,Y_Cookie,X_Nb_Cookie,Y_Nb_Cookie,X_Jump_Cookie,Y_Jump_Cookie,"m")
- -- cookie test and press before
- cookie_test()
- repeat 100 times
- repeat nbTab times
- -- test a full screenshot
- set value to screen_and_check_color(X_Next,Y_Next,X_Nb_Next,Y_Nb_Next,X_Jump_Next,Y_Jump_Next)
- set aValues to my theSplit(value, ";")
- repeat with a from 1 to length of aValues
- set theCurrentListItem to item a of aValues
- if a = 1 then
- set value to theCurrentListItem
- end if
- if a = 2 then
- set coords to theCurrentListItem
- end if
- end repeat
- if value = "NEXT" then
- tell application Browser_ap to activate
- do shell script Cliclick_bin & " m:" & coords
- do shell script Cliclick_bin & " c:" & coords
- set cNoAction to 0
- set cNoMoreChanges to 0
- set cStart to True
- end if
- if value = "START" then
- tell application Browser_ap to activate
- do shell script Cliclick_bin & " m:" & coords
- do shell script Cliclick_bin & " c:" & coords
- set cStart to True
- end if
- if value = "NO MORE" then
- -- ALLOW ANOTHER ACCOUNT TEST CHANGE
- set cNoMoreChanges to cNoMoreChanges+1
- if cNoMoreChanges > nbTab then
- -- RESTART THE BROWSER
- --say "NO ACTION"
- restart_browser(True)
- else
- -- CLOSE THE TAB
- tell application Browser_ap to activate
- tell application "System Events"
- tell process Browser_process
- keystroke "w" using {command down}
- end tell
- end tell
- -- REOPEN THE TAB
- set Utip_url to some item of Utip_urls
- tell application Browser_ap to open location Utip_url
- end if
- end if
- if (cStart and cNoAction > max_cNoAction + cRestartExtraTime) or (cNoAction > max_cNoAction) then
- --say "NO ACTION"
- restart_browser(True)
- end if
- -- SLEEP
- set randomNumber to (random number from 1 to 4)
- delay randomNumber
- -- NEXT TAB BETWEEN TWO SLEEPS
- tell application Browser_ap to activate
- tell application "System Events" to key code 124 using {command down, option down}
- -- SLEEP
- set randomNumber to (random number from 2 to 12)
- delay randomNumber
- set cNoAction to cNoAction+randomNumber
- -- REDUCE THE RESTART EXTRA TIME
- if cRestartExtraTime > randomNumber then
- set cRestartExtraTime to cRestartExtraTime - randomNumber
- end if
- end repeat
- end repeat
- -- multiclic
- on multiclic(xStart,yStart,xNb,yNb,xJump,yJump,even)
- -- window front
- tell application Browser_ap to activate
- -- double loops coordinates for the grid
- set xPos to (xStart - xNb * xJump)
- repeat 2*xNb+1 times
- set yPos to (yStart - yNb * yJump)
- repeat 2*yNb+1 times
- -- set click on the grid
- set coords to "" & xPos & "," & yPos
- do shell script Cliclick_bin & " " & even & ":" & coords
- set yPos to yPos + yJump
- end repeat
- set xPos to xPos + xJump
- end repeat
- end multiclic
- -- tor restart tool
- on restart_browser(stop_browser)
- set cRestartExtraTime to max_cRestartExtraTime
- set cStart to False
- set cNoAction to 0
- set cNoMoreChanges to 0
- set cNext to 0
- tell application Browser_ap to activate
- -- (1) STOP THE BROWSER
- if stop_browser then
- tell application "System Events"
- tell process Browser_process
- keystroke "q" using {command down}
- delay 3
- end tell
- end tell
- end if
- -- (2) RESTART
- tell application Browser_ap to activate
- -- FIREFOX : SOME EXTRA DELAY TO RESTART
- set randomNumber to (random number from 5 to 10)
- delay randomNumber
- -- (3) LOAD URL
- set Utip_url to some item of Utip_urls
- tell application Browser_ap to open location Utip_url
- repeat nbTab times
- set Utip_url to some item of Utip_urls
- tell application Browser_ap to open location Utip_url
- set randomNumber to (random number from 2 to 5)
- delay randomNumber
- end repeat
- tell application Browser_ap to activate
- set randomNumber to (random number from 8 to 15)
- delay randomNumber
- repeat nbTab times
- -- NEXT TAB
- tell application Browser_ap to activate
- tell application "System Events" to key code 124 using {command down, option down}
- cookie_test()
- set randomNumber to (random number from 2 to 5)
- delay randomNumber
- end repeat
- end restart_browser
- on cookie_test()
- set picPath to ((POSIX path of (path to desktop)) & "Picture.png") as string
- -- FAST COOKIE TEST
- if X_last_Cookie >= 0 and Y_last_Cookie >= 0 then
- -- RANDOMIZE A LITTLE
- set X_last_Cookie to X_last_Cookie + random number from -1 to 1
- set Y_last_Cookie to Y_last_Cookie + random number from -1 to 1
- --
- set coords_cookie to "" & (2*X_last_Cookie) & "," & (2*Y_last_Cookie)
- set srgba_cookie to do shell script Convert_bin & " " & quoted form of picPath & " -format \"%[pixel:p{" & coords_cookie & "}]\" info:"
- if srgba_cookie = "srgba(8,122,244,1)" or srgba_cookie = "srgba(0,113,236,1)" then -- cookie on white/black background
- --say "COOKIE FAST;" & (X_last_Cookie) & "," & (Y_last_Cookie)
- tell application Browser_ap to activate
- do shell script Cliclick_bin & " m:" & (X_last_Cookie) & "," & (Y_last_Cookie)
- do shell script Cliclick_bin & " c:" & (X_last_Cookie) & "," & (Y_last_Cookie)
- return
- end if
- end if
- -- SLOW COOKIE TEST ON GRID
- set value_cookie to screen_and_check_color(X_Cookie,Y_Cookie,X_Nb_Cookie,Y_Nb_Cookie,X_Jump_Cookie,Y_Jump_Cookie)
- end cookie_test
- --
- -- Compute the vector product : must be close to 0 if the 3 dots are aligned
- -- (used for color button match)
- --
- on vector_product(r_1,g_1,b_1,r_2,g_2,b_2,r_3,g_3,b_3)
- set r21 to r_2 - r_1
- set g21 to g_2 - g_1
- set b21 to b_2 - b_1
- set r31 to r_3 - r_1
- set g31 to g_3 - g_1
- set b31 to b_3 - b_1
- return r21*g31-r31*g21 + g21*b31-g31*b21 + b21*r31-b31*r21
- end vector_product
- --
- -- Split according to a list of delimiters
- -- (from https://erikslab.com/2007/08/31/applescript-how-to-split-a-string/ ? )
- --
- on theSplit(theString, theDelimiter)
- -- save delimiters to restore old settings
- set oldDelimiters to AppleScript's text item delimiters
- -- set delimiters to delimiter to be used
- set AppleScript's text item delimiters to theDelimiter
- -- create the array
- set theArray to every text item of theString
- -- restore the old setting
- set AppleScript's text item delimiters to oldDelimiters
- -- return the result
- return theArray
- end theSplit
- --
- -- Screen Capture and Analysis With Position Return
- --
- on screen_and_check_color(xStart,yStart,xNb,yNb,xJump,yJump)
- -- screenshot
- set picPath to ((POSIX path of (path to desktop)) & "Picture.png") as string
- do shell script "screencapture -tpng " & quoted form of picPath
- -- (A) single test if positions already available
- set singleTest to 0
- -- (A.1) test the "Cookie" button fast
- if X_last_Cookie >= 0 and Y_last_Cookie >= 0 then
- set singleTest to singleTest+1
- -- RANDOMIZE A LITTLE
- set X_last_Cookie to X_last_Cookie + random number from -1 to 1
- set Y_last_Cookie to Y_last_Cookie + random number from -1 to 1
- --
- set coords to "" & (2*X_last_Cookie) & "," & (2*Y_last_Cookie)
- set srgba to do shell script Convert_bin & " " & quoted form of picPath & " -format \"%[pixel:p{" & coords & "}]\" info:"
- if srgba = "srgba(8,122,244,1)" or srgba = "srgba(0,113,236,1)" then -- cookie on white/black background
- --say "COOKIE FAST;" & (X_last_Cookie) & "," & (Y_last_Cookie)
- tell application Browser_ap to activate
- do shell script Cliclick_bin & " m:" & (X_last_Cookie) & "," & (Y_last_Cookie)
- do shell script Cliclick_bin & " c:" & (X_last_Cookie) & "," & (Y_last_Cookie)
- end if
- end if
- -- (A.2) test the "Next" button fast
- if X_last_Next >= 0 and Y_last_Next >= 0 then
- set singleTest to singleTest+1
- -- RANDOMIZE A LITTLE
- set X_last_Next_Test to X_last_Next + random number from -3 to 3
- set Y_last_Next_Test to Y_last_Next + random number from -1 to 1
- --
- set coords to "" & (2*X_last_Next_Test) & "," & (2*Y_last_Next_Test)
- set srgba to do shell script Convert_bin & " " & quoted form of picPath & " -format \"%[pixel:p{" & coords & "}]\" info:"
- if srgba = "srgba(247,232,50,1)" then -- yellow next button
- set X_last_Next to X_last_Next_Test
- set Y_last_Next to Y_last_Next_Test
- --say "NEXT FAST;" & (X_last_Next) & "," & (Y_last_Next)
- set cNext to cNext+1
- return "NEXT;" & (X_last_Next) & "," & (Y_last_Next)
- end if
- end if
- -- (A.3) test the "NoMore" button fast
- if X_last_NoMore >= 0 and Y_last_NoMore >= 0 then
- set singleTest to singleTest+1
- -- RANDOMIZE A LITTLE
- set X_last_NoMore_Test to X_last_NoMore + random number from -1 to 1
- set Y_last_NoMore_Test to Y_last_NoMore + random number from -1 to 1
- --
- set coords to "" & (2*X_last_NoMore_Test) & "," & (2*Y_last_NoMore_Test)
- set srgba to do shell script Convert_bin & " " & quoted form of picPath & " -format \"%[pixel:p{" & coords & "}]\" info:"
- if srgba = "srgba(47,46,65,1)" or srgba = "srgba(255,193,7,1)" or srgba = "srgba(255,205,0,1)" then -- gray guy or yellow hat
- set X_last_NoMore to X_last_NoMore_Test
- set Y_last_NoMore to Y_last_NoMore_Test
- --say "NO MORE FAST;" & (X_last_NoMore) & "," & (Y_last_NoMore)
- return "NO MORE;" & (X_last_NoMore) & "," & (Y_last_NoMore)
- end if
- end if
- -- (A.4) test the "Start" Button fast
- if X_last_Start >= 0 and Y_last_Start >= 0 then
- set singleTest to singleTest+1
- -- RANDOMIZE A LITTLE
- set X_last_Start_Test to X_last_Start + random number from -2 to 2
- set Y_last_Start_Test to Y_last_Start + random number from -1 to 1
- --
- set coords to "" & (2*X_last_Start_Test) & "," & (2*Y_last_Start_Test)
- set srgba to do shell script Convert_bin & " " & quoted form of picPath & " -format \"%[pixel:p{" & coords & "}]\" info:"
- if not srgba = "srgba(66,133,244,1)" then -- common color used for game button
- -- test correlation with button
- set r to 0
- set g to 0
- set b to 0
- set srgbaArray to my theSplit(srgba, {"(",")",","})
- repeat with a from 1 to length of srgbaArray
- set theCurrentListItem to item a of srgbaArray
- if a = 2 then
- set r to theCurrentListItem
- end if
- if a = 3 then
- set g to theCurrentListItem
- end if
- if a = 4 then
- set b to theCurrentListItem
- end if
- end repeat
- set vecProd to vector_product(R_Start_A,G_Start_A,B_Start_A,r,g,b,R_Start_B,G_Start_B,B_Start_B)
- if vecProd > -300 and vecProd < 300 then
- set X_last_Start to X_last_Start_Test
- set Y_last_Start to Y_last_Start_Test
- --say "START FAST;" & (X_last_Start) & "," & (Y_last_Start) & "=" & vecProd
- return "START;" & (X_last_Start) & "," & (Y_last_Start)
- end if
- end if
- end if
- -- (B) double loops grid coordinates
- set xPos to 2*(xStart - xNb * xJump)
- set xPosMouse to (xStart - xNb * xJump)
- repeat 2*xNb+1 times
- set yPos to 2*(yStart - yNb * yJump)
- set yPosMouse to (yStart - yNb * yJump)
- repeat 2*yNb+1 times
- -- get pixel colors
- set coords to "" & xPos & "," & yPos
- set srgba to do shell script Convert_bin & " " & quoted form of picPath & " -format \"%[pixel:p{" & coords & "}]\" info:"
- if srgba = "srgba(8,122,244,1)" or srgba = "srgba(0,113,236,1)" then -- cookie on white/black background
- --say "COOKIE"
- set X_last_Cookie to xPosMouse
- set Y_last_Cookie to yPosMouse
- tell application Browser_ap to activate
- do shell script Cliclick_bin & " m:" & (X_last_Cookie) & "," & (Y_last_Cookie)
- do shell script Cliclick_bin & " c:" & (X_last_Cookie) & "," & (Y_last_Cookie)
- return "OTHER;0,0"
- end if
- if srgba = "srgba(247,232,50,1)" then -- yellow next button
- --say "NEXT"
- set X_last_Next to xPosMouse
- set Y_last_Next to yPosMouse
- set cNext to cNext+1
- return "NEXT;" & (xPosMouse) & "," & (yPosMouse)
- end if
- if srgba = "srgba(47,46,65,1)" or srgba = "srgba(255,193,7,1)" then -- gray guy or yellow hat
- --say "NO MORE"
- set X_last_NoMore to xPosMouse
- set Y_last_NoMore to yPosMouse
- return "NO MORE;" & (xPosMouse) & "," & (yPosMouse)
- end if
- if not srgba = "srgba(66,133,244,1)" then -- common color used for game button
- -- test correlation with button
- set r to 0
- set g to 0
- set b to 0
- set srgbaArray to my theSplit(srgba, {"(",")",","})
- repeat with a from 1 to length of srgbaArray
- set theCurrentListItem to item a of srgbaArray
- if a = 2 then
- set r to theCurrentListItem
- end if
- if a = 3 then
- set g to theCurrentListItem
- end if
- if a = 4 then
- set b to theCurrentListItem
- end if
- end repeat
- set vecProd to vector_product(R_Start_A,G_Start_A,B_Start_A,r,g,b,R_Start_B,G_Start_B,B_Start_B)
- if vecProd > -300 and vecProd < 300 then
- --say "START" & "=" & vecProd
- set X_last_Start to xPosMouse
- set Y_last_Start to yPosMouse
- return "START;" & (xPosMouse) & "," & (yPosMouse)
- end if
- end if
- set yPos to yPos + 2*yJump
- set yPosMouse to yPosMouse + yJump
- end repeat
- set xPos to xPos + 2*xJump
- set xPosMouse to xPosMouse + xJump
- end repeat
- return "OTHER;0,0"
- end screen_and_check_color
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement