Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance Force
- #Requires AutoHotkey v2.0
- *F1::
- {
- Reload ; this script. doesnt work during a loop T_T if you try it will duplicate the application and you'll have to close like 100 of them
- }
- ^0::
- {
- ; this section sets up our toolbar and only clicks if it can find stock option pricing relevant to A-E
- if ImageSearch(&FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*30 C:\Users\Matthew3\Desktop\images\a.png")
- {
- Click FoundX, FoundY
- }
- Sleep 300
- ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*30 C:\Users\Matthew3\Desktop\images\b.png"
- Click FoundX, FoundY
- RandSleep := Random(300, 500)
- Sleep RandSleep
- ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*30 C:\Users\Matthew3\Desktop\images\c.png"
- Click FoundX, FoundY
- RandSleep := Random(300, 400)
- Sleep RandSleep
- ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*100 C:\Users\Matthew3\Desktop\images\d.png"
- Click FoundX, FoundY
- Sleep 300
- ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*150 C:\Users\Matthew3\Desktop\images\e.png"
- Click FoundX, FoundY
- sleep 1000
- Send "1"
- sleep 500
- ; this section confirms cubes if they are the right dark shade
- if PixelSearch(&OutputVarX, &OutputVarY, 1168, 684, 1173, 694, 0x5f5b4e, 5)
- {
- cube1 := 1
- }
- if PixelSearch(&OutputVarX, &OutputVarY, 1214, 725, 1224, 735, 0x5f5b4e, 5)
- {
- cube2 := 1
- }
- if PixelSearch(&OutputVarX, &OutputVarY, 1166, 763, 1176, 773, 0x5f5b4e, 5)
- {
- cube3 := 1
- }
- if PixelSearch(&OutputVarX, &OutputVarY, 1116, 723, 1126, 733, 0x5f5b4e, 5)
- {
- cube4 := 1
- }
- if PixelSearch(&OutputVarX, &OutputVarY, 1111, 694, 1121, 704, 0x5f5b4e, 5)
- {
- cube5 := 1
- }
- if PixelSearch(&OutputVarX, &OutputVarY, 1218, 684, 1228, 694, 0x5f5b4e, 5)
- {
- cube6 := 1
- }
- if PixelSearch(&OutputVarX, &OutputVarY, 1218, 759, 1228, 769, 0x5f5b4e, 5)
- {
- cube7 := 1
- }
- ; this section searches for cube1 again, and this time, if not found, it will go to shader() which will manually recolour the cube dark enough. if shader cant do it, it will go to shader2() which resets our browser, and loops back to first: to try all over again
- first:
- if PixelSearch(&OutputVarX, &OutputVarY, 1168, 684, 1173, 694, 0x5f5b4e, 5)
- {
- ; no need for code, its already the right shade, so just move on
- }
- shader() ; function to update shade. if there arent enough units to update shade, it'll refresh browser and restart from first.
- }
- ; once i resolve this i need to duplicate first for every cube. and expand amount of cubes.
- shader()
- {
- if PixelSearch(&OutputVarX, &OutputVarY, 1168, 684, 1173, 694, 0x5f5b4e, 5) ; repeat search for cube1. so that i can use OutputVarX and OutputVarY (wont work if only in the main script)
- {
- Click OutputVarX, OutputVarY ; click cube1
- sleep 200
- Click (OutputVarX - 25), (OutputVarY - 15) ; click symbol
- sleep 300
- ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*100 C:\Users\Matthew3\Desktop\images\units.png" ; click send all units
- Click (FoundX + 470), (FoundY + 28)
- sleep 200
- A_Clipboard := ""
- Click (FoundX + 50), (FoundY + 28) ; work out how many units we have, copy to clipboard for use in a variable. so double click.
- Click (FoundX + 50), (FoundY + 28)
- sleep 200
- Send "^c"
- ClipWait(1) ; idk how this works exactly but it wont work without this, google later
- try
- {
- Unitcount := A_Clipboard
- }
- if unitcount = ""
- {
- unitcount := 0
- }
- if unitcount >= 9 ; if we have enough units, so search for the confirm button, click that, then click the duration button and copy to clipboard. should hopefully update shade, and we have the duration saved for later use maybe.
- {
- ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*50 C:\Users\Matthew3\Desktop\images\confirm.png"
- Click FoundX, FoundY
- sleep 200
- A_Clipboard := ""
- ImageSearch &FoundX, &FoundY, 776, 445, 1200, 789, "*120 C:\Users\Matthew3\Desktop\images\duration.png"
- Click (FoundX + 100), FoundY
- Click (FoundX + 100), FoundY
- Click (FoundX + 100), FoundY
- Send "^c"
- }
- else ; not enough units, just reset browser with F5 and start over again
- {
- shader2() ; after it runs shader2, it'll come back here, and then go to first:
- goto first
- }
- }
- }
- shader2()
- {
- Send "{F5}" ; not enough units, just reset browser and try everything all over again. next time, it might be the right colour, or at least the right amount of units.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement