File size: 4,699 Bytes
8a5f422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
; AutoHotkey v1.1+ script
; F9  = start Sora remix loop
; Esc = abort / exit script immediately

#NoEnv
#SingleInstance Force
#MaxThreadsPerHotkey 1
SetBatchLines, -1
ListLines, Off

; Make coordinates match real screen pixels on DPI-scaled systems
DllCall("SetProcessDPIAware")

CoordMode, Mouse, Screen
SendMode, Input
SetKeyDelay, 50, 50
SetMouseDelay, 50

; =========================
; CONFIG
; =========================

; Pixel position of "remix button"
remixButtonX := 0
remixButtonY := 0

; Pixel position of "picture button"
pictureButtonX := 0
pictureButtonY := 0

; START at CURRENT ID
START_CURRENT_ID := 1

TargetURL := "https://sora.chatgpt.com/g/gen_01kph9ac6sf54a370pd1v039kr"

; =========================
; PROMPTS
; =========================

prompts := []

prompts.Push("a male rogue with a hood and a knife and he looks sneaky") ; 1
prompts.Push("a male warrior with a sword looking mean")                 ; 2
prompts.Push("a female healer who has a white robe looking healy")        ; 3

; =========================
; GLOBAL STATE
; =========================

global gRunning := false
global gClipboardBackup := ""
global gHasClipboardBackup := false

OnExit, __Cleanup

; =========================
; HOTKEYS
; =========================

F9::
    if (gRunning)
        return

    gRunning := true
    RunSoraLoop()
    gRunning := false
return


; The $ prevents the script's own SendInput {Esc} commands
; from triggering this hotkey.
$Esc::
    ExitApp
return


; =========================
; MAIN LOOP
; =========================

RunSoraLoop() {
    global remixButtonX, remixButtonY
    global pictureButtonX, pictureButtonY
    global START_CURRENT_ID
    global TargetURL
    global prompts
    global gClipboardBackup, gHasClipboardBackup

    if (remixButtonX = 0 || remixButtonY = 0 || pictureButtonX = 0 || pictureButtonY = 0) {
        MsgBox, 16, Missing Coordinates, Edit the button pixel positions before running.
        return
    }

    totalPrompts := prompts.Length()

    if (START_CURRENT_ID < 1 || START_CURRENT_ID > totalPrompts) {
        MsgBox, 16, Invalid CURRENT ID, START_CURRENT_ID is outside the prompt list.
        return
    }

    ; Backup clipboard
    gClipboardBackup := ClipboardAll
    gHasClipboardBackup := true

    currentID := START_CURRENT_ID

    while (currentID <= totalPrompts) {

        currentPrompt := prompts[currentID]

        ; wait 1 sec
        Sleep, 1000

        ; CONTROL+L
        SendInput, ^l

        ; type URL
        Sleep, 200
        SendInput, %TargetURL%

        ; press ENTER
        SendInput, {Enter}

        ; wait 3 sec
        Sleep, 3000

        ; press E
        SendInput, e

        ; wait 1 sec
        Sleep, 1000

        ; control+a
        SendInput, ^a

        ; wait 1 sec
        Sleep, 1000

        ; delete
        SendInput, {Delete}

        ; wait 1 sec
        Sleep, 1000

        ; copy CURRENT ID prompt into clipboard
        Clipboard :=
        Clipboard := currentPrompt
        ClipWait, 2

        ; wait 1 sec
        Sleep, 1000

        ; control+V
        SendInput, ^v

        ; wait 1 sec
        Sleep, 1000

        ; click remix button
        Click, %remixButtonX%, %remixButtonY%

        ; wait 60 sec
        Sleep, 60000

        ; press ESC
        SendInput, {Esc}

        ; wait 2 sec
        Sleep, 2000

        ; press top of page button / Pos1 / Home
        SendInput, {Home}

        ; wait 1 sec
        Sleep, 1000

        ; click picture button
        Click, %pictureButtonX%, %pictureButtonY%

        ; wait 1 sec
        Sleep, 1000

        ; press D
        SendInput, d
        Sleep, 2000

        ; Right Arrow
        SendInput, {Right}
        Sleep, 2000

        ; press D
        SendInput, d
        Sleep, 1000

        ; Right Arrow
        SendInput, {Right}
        Sleep, 2000

        ; press D
        SendInput, d
        Sleep, 1000

        ; Right Arrow
        SendInput, {Right}
        Sleep, 2000

        ; press D
        SendInput, d
        Sleep, 1000

        ; press ESC
        SendInput, {Esc}
        Sleep, 1000

        ; CURRENT ID + 1
        currentID++
    }

    ; Restore clipboard after successful completion
    if (gHasClipboardBackup) {
        Clipboard := gClipboardBackup
        gClipboardBackup :=
        gHasClipboardBackup := false
    }

    MsgBox, 64, Finished, Finished all prompts.
}


; =========================
; CLEANUP
; =========================

__Cleanup:
    global gClipboardBackup, gHasClipboardBackup

    if (gHasClipboardBackup) {
        Clipboard := gClipboardBackup
        gClipboardBackup :=
        gHasClipboardBackup := false
    }

ExitApp
return