1+ ; prep before running this:
2+ ; also: rebind rotate model keys to , and . (left, right)
3+ ; also: set viewport to "Portrait" in scene editor
4+
5+ ; window configuration before launch:
6+ ; - messages window closed (ctrl+shift+m)
7+ ; - cutscene editor panes shown (f11)
8+
9+ ; need to use 32bit, because the editor is a 32bit process..
10+ #AutoIt3Wrapper_UseX64= n
11+
12+ Opt (" WinTitleMatchMode" , 4 ) ; 1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
13+ Opt (" MouseCoordMode" , 0 )
14+ Opt (" PixelCoordMode" , 0 )
15+
16+ $title_terrain = " [REGEXPTITLE:Terrain.*StarCraft II Editor]"
17+ $title_data = " [REGEXPTITLE:Data.*StarCraft II Editor]"
18+ $title_cseditor = " [REGEXPTITLE:Cutscene Editor.*StarCraft II Editor]"
19+
20+ ; Run("e:\sc2\StarCraft\ II\ Editor.exe")
21+ WinActivate ($title_terrain )
22+ WinWaitActive ($title_terrain )
23+
24+ ; activate messages window
25+ Send (" ^+m" )
26+ ; then hide it away
27+ WinActivate ($title_terrain )
28+ WinWaitActive ($title_terrain )
29+
30+ Dim $i
31+ ; Dim $units = StringSplit("Zergling,Baneling,Banshee", ",")
32+ ; Dim $units = StringSplit("Probe,Zealot,Stalker,Sentry,Observer,Immortal,Colossus,Phoenix,Carrier,Mothership", ",")
33+ Dim $units = StringSplit (" Archon,Carrier,Colossus,Dark Templar,High Templar,Immortal,Interceptor,Mothership,Observer,Phoenix,Probe,Sentry,Stalker,Void Ray,Warp Prism (Transport Mode),Zealot" , " ," )
34+ Dim $unit_count = UBound ($units )
35+
36+ For $i = 1 to $unit_count - 1
37+ ; open data
38+ Send (" {F7} " )
39+ WinWaitActive ($title_data )
40+
41+ ; open search
42+ ; Send("^f")
43+ ; WinWaitActive("Find")
44+
45+ ; nope.. click the search inside the control instead
46+ ; ControlSetText($title_data, "", "[ID:18]", $units[$i])
47+ ; ControlFocus($title_data, "", "[ID:18]")
48+ ; Send("{ENTER}")
49+
50+ ; Oh god, I don't even have to use the search..
51+ ControlFocus ($title_data , " " , " [ID:1023]" )
52+ ControlListView ($title_data , " " , " [ID:1023]" , " SelectClear" )
53+ $idx = ControlListView ($title_data , " " , " [ID:1023]" , " FindItem" , $units [$i ], 0 )
54+ ControlListView ($title_data , " " , " [ID:1023]" , " Select" , $idx )
55+
56+ ; activate the list and press POS1 then Ctrl+P because I can't be arsed
57+ ; to read the docs on how to control the list.
58+ ; ControlFocus($title_data, "", "[ID:1023]")
59+ ; Send("{HOME}")
60+ Send (" ^p" )
61+
62+ ; wait for cutscene editor to open
63+ Local $hWnd = WinWaitActive ($title_cseditor )
64+
65+ ; send shift+f, zoom to fit
66+ Send (" +f" )
67+ Sleep (50 )
68+ ; send ] to rotate 45° to the right
69+ Send (" ." )
70+ Sleep (50 )
71+
72+ ; then, crazy stuff.. right click on the animation element
73+ ; and select "reset animation duration", because we can't fucking assign
74+ ; a hotkey to that that works.
75+ ; ControlClick($title_cseditor, "", "[ID:66]", "menu", 1, 100, 1)
76+ ; n/m, shift+f10 does the trick ("menu key") .. holy shit, this is a fickle bitch
77+ ; ControlFocus($title_cseditor, "", "[ID:66]")
78+ ; ControlClick($title_cseditor, "", "[ID:66]", "left", 1, 5, 5)
79+ ; Now ..I don't know ..color matching I guess
80+
81+ ; MsgBox(0, "", PixelGetColor(948, 683))
82+ ; Exit
83+
84+ ; $pos = PixelSearch(200, 200, 1000, 1000, 6724095, 20, 2, $hWnd)
85+ ; MsgBox(0, "", $pos[0] & $pos[1])
86+ ; MouseClick("menu", $pos[0], $pos[1], 1)
87+
88+ ControlClick ($title_cseditor , " " , " [ID:66]" , " right" , 1 , 200 , 25 )
89+ Sleep (50 )
90+ Send (" {DOWN} " )
91+ Sleep (50 )
92+ Send (" {DOWN} " )
93+ Sleep (50 )
94+ Send (" {ENTER} " )
95+ Sleep (50 )
96+
97+ ; send f11 for huge view (hide all panes)
98+ Send (" {F11} " )
99+ Sleep (50 )
100+
101+ ; send alt+f11 then enter to record video
102+ Send (" !{F11} " )
103+ WinWaitActive (" Record New Video" )
104+ ; ControlSend("Record New Video", "", "[ID:20]", "{SPACE}")
105+
106+ ; Exit
107+
108+ Send (" {ENTER} " )
109+ ; Sleep(100) ; no idea why, pressing enter immediately won't work
110+ ; ControlClick("Record New Video", "", "[CLASS:Button; INSTANCE:5]")
111+
112+ ; ControlFocus($title, "Search", "[CLASS:SysTabControl32; INSTANCE:3]")
113+ ; sleep 10 seconds.. is there any animation that runs longer?
114+ Sleep (10000 )
115+
116+ ; f11 again to reactivate all panes
117+ Send (" {F11} " )
118+ FileCopy (" c:\\Users\\mr\\Documents\\StarCraft II\\Videos\\Video.y4m" , " f:\\_v\\" & $units [$i ] & " .y4m" )
119+ Next
120+
121+ ; hide messages again once we're done
122+ Send (" ^+m" )
123+
124+ MsgBox (0 , " " , " done!" )
0 commit comments