Advertisement
BoredErcia

Skyrim Script

May 31st, 2023 (edited)
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv
  2. ListLines Off        
  3. SetBatchLines -1
  4. SendMode Input
  5. #KeyHistory 0
  6. SetWinDelay, -1
  7. CoordMode, Mouse, Client
  8. Splitpath(Path){
  9.     SplitPath,Path,FileName,Dir,Ext,NNE,Drive
  10.     return {FileName:Filename,Dir:Dir,Ext:Ext,NNE:NNE,Drive:Drive}
  11.     }
  12. SaveFolder = C:\Users\Erica\Documents\My Games\Skyrim Special Edition\Saves\    ;Where saves are at
  13. SaveIn = C:\Users\Erica\Documents\My Games\Skyrim Special Edition\Saves         ;Location to move saves to
  14. ScreenshotPath = C:\Reprise\Steam\steamapps\common\Skyrim Special Edition\Screenshots ;Reshade screenshot path
  15. Global Keywords = "AlftandWorld,Blackreach,BlindCliffCaveWorld,BloatedMansGrottoWorld,BrinewaterGrottoWorld,DeepwoodRedoubtWorld,DLC01FalmerValley,DLC1AncestorsGladeWorld,DLC1ForebearsHoldout,DLC1HunterHQWorld,DLC1VampireCastleCourtyard,DLC2SolstheimWorld,EastEmpireWarehouse,EldergleamSanctuaryWorld,FallowstoneCaveWorldEnd,FallowstoneCaveWorldStart,FrostmereCryptWorld,JaphetsFollyWorld,KarthspireRedoubtWorld,KatariahWorld,LabyrinthianMazeWorld,LabyrinthianWorld,LabyrinthianWorld03,LabyrinthianWorld04,MossMotherCavernWorld,RedEagleRedoubtWorld,ShadowgreenCavernWorld,SkuldafnWorld,SouthfringeWorld,Sovngarde,Tamriel" ;DLC01Boneyard
  16. Random, X, -10, 1800
  17. Random, Y, -400, 300
  18. Random, MONumber, -330, 600
  19. Random, NX, -640, 520
  20. Random, NY, -200, 160
  21.  
  22. f12:: ;Move saves, take screenshot. Main script.
  23. SetWorkingDir, C:\Users\Erica\Desktop\Mod            ;Remove file paths before mod folder
  24. Loop Files, *.dds, R                                 ;R means recursive.
  25.     storedPath .= A_LoopFileFullPath "`n"`     
  26. path := StrSplit(storedPath,"`n") ;Split long list. storedpath = list of all dds file paths. storedpath.
  27. Loop {              ;path[1] = textures\Clutter\Door.dds. path[2] = textures\Clutter\wow.dds, etc.
  28. Path%A_Index% := path[A_Index]                       ;Raw answer now in Path1... etc. "Clutter\Door.dds"
  29.     Dir%A_Index% := Splitpath(Path%A_Index%).dir     ;Dir[1] = "Clutter"
  30.     SavePath := SaveFolder Dir%A_Index%     ;SavePath = "C:\Users\Desktop\Saves\Clutter". SaveFolder + Dir[1]
  31. FileName := Splitpath(Path%A_Index%).nne             ;FileName1 = "Door" ...etc
  32. If (Filename = "")                          ;If no file name, all textures processed. Break loop.
  33. Break
  34. Filemove, %SavePath%\*%FileName%*.ess, %SaveIn%    ;Move saves. "C:\Users\Desktop\Saves\Clutter\Door.ess" move to SavesIn.
  35. WinActivate Skyrim ahk_class Skyrim Special Edition  ;Tab to Skyrim.
  36. FileList := "" , Count = 0              ;Count and FileList are reset at start of each loop to prevent old data.
  37. Loop, %SaveIn%\*.ess                                 ;Asterisk = Wildcard
  38. Count++                                     ;Count = # of loops (saves) to load in game. Variable ready.
  39. Loop Files, %SaveIn%\*.ess                  ;Numeric sort for save number. List all saves again and sort.
  40. FileList .= A_LoopFileName "`n"`
  41. Sort, FileList, P5 N
  42. msgbox %Filelist%
  43. sleep 200 ;100
  44. Loop % Count {
  45.     File := StrSplit(FileList,"`n"),File%A_Index% := File[A_Index]                          
  46.     Clipboard := "load " Splitpath(File%A_Index%).nne
  47.     Load()
  48.     }
  49. Filemove, %SaveIn%, %Savepath%                       ;Saves processed, moving back to original location
  50. }
  51. WinActivate ahk_exe explorer.exe
  52. Exit
  53.  
  54. Load() {
  55. Restart:
  56. sendinput, {~ down}
  57. sleep 30
  58. sendinput, {~ up}
  59. send {ctrl down}
  60. sleep 40   ;30
  61. send {v down}
  62. sleep 40
  63. send {ctrl up} {v up} {Enter}
  64. sleep 25     ;Delay after entering command to load save. Wait for loading screen to start. 25 ok? 15 fail.
  65. Loop {
  66.     PixelGetColor, color1, 3800, 1079 ;Check pixel color (Pixels at very edge of screen shouldn't be tested.)
  67.     PixelGetColor, color2, 2000, 79                    
  68.     PixelGetColor, color3, 2500, 1600                      
  69.     if (color1 !== 0x000000) OR (color2 !== 0x000000) OR (color3 !== 0x000000)
  70.     Break ;If not black, loading screen gone.
  71.     }
  72. Loop {
  73.     if Clipboard contains %Keywords%  ;Determine post-save delay for grass fade in based on save name/keywords
  74.     sleep 1750                        ;1750 long delay
  75.     else sleep 450                    ;Short delay (interior save or holds). 450 for Boneyard.
  76.     loop {
  77.         if winexist("ahk_class Skyrim Special Edition") {   ;Check if Skyrim crashed.
  78.             Break 2
  79.         } else {
  80.             msgbox Skyrim not detected ;Resume after msgbox is removed. Crashed=1 for Restart jump later.
  81.             sleep 3000
  82.             Goto Restart
  83.         }
  84.     }
  85. }
  86. SendInput {' down}
  87. sleep 10
  88. SendInput {' up}
  89. }
  90.  
  91. f10:: ;Take screenshots for each save game can see currently.
  92. WinActivate Skyrim ahk_class Skyrim Special Edition
  93. FileList := "" , Count = 0
  94. Loop, %SaveIn%\*.ess
  95. Count++
  96. Loop Files, %SaveIn%\*.ess
  97. FileList .= A_LoopFileName "`n"`
  98. Sort, FileList, P5 N
  99. sleep 700                                                               ;100? 300 maybe overkill
  100. Loop % Count {
  101.     File := StrSplit(FileList,"`n"),File%A_Index% := File[A_Index]                          
  102.     Clipboard := "load " Splitpath(File%A_Index%).nne  
  103.     Load()
  104. }            
  105. WinActivate ahk_exe explorer.exe
  106. Exit
  107.  
  108. f5::
  109. WinMove, C:\Users\Erica\AppData\Local\ModOrganizer\Skyrim Special Edition\mods\zzz\textures,,,,435,1566
  110. WinMove, E:\zSkyrimTextureWork\Skyrim PNG Originals,,,,635,1566
  111. exit
  112.                
  113. f1::        ;Renames screenshots in screenshot folder based on clipboard.
  114. f2::        ;Include se tag.
  115. storedname := "", Count = 0
  116. Loop Files, %ScreenshotPath%\*.png
  117.     storedName .= A_LoopFileName "`n"`, path := StrSplit(storedName,"`n") ;Split long list in storedpath.
  118.     Sort, storedName, P5 N
  119. Loop, %ScreenshotPath%\*.png                               
  120. Count++
  121. Loop % Count {    
  122.         Name := path[A_Index]          
  123.         If (A_ThisHotkey = "f1") {
  124.             FileMove, %ScreenshotPath%\%Name%, %ScreenshotPath%\%Clipboard%%A_Space%%A_Index%.png
  125.         } Else FileMove, %ScreenshotPath%\%Name%, %ScreenshotPath%\%Clipboard%%A_Space%%A_Index%%A_Space%se.png
  126.     }
  127. Winactivate ahk_exe ABIC.exe
  128. sleep 500 ;50
  129. PixelGetColor, Compression, 890, 246 ;If color is 0xD77800, slider is at 80%
  130. if (A_ThisHotkey = "f1" ) && (Compression = 0xD77800)  ; Told to compress normal and slider is at 80%, so we move to 10%.
  131. Send {Click 877, 175 Down}{Click 372, 175 Up}
  132. if (A_ThisHotkey = "f2") && (Compression != 0xD77800) ;Told to compress non-normal. Slider is at 10%, moving to 80%.
  133. Send {Click 372, 175 Down}{Click 877, 175 Up}
  134. send {click, 360 312}{click, 116 311}{click, 227 361};Better to clear list here since dunno how long conversion takes.
  135. sleep 325                                               ;Is 300 spotty? 350 seems fine?
  136. send {ctrl down}{a}{ctrl up}{enter}
  137. sleep 25
  138. click 329 219
  139. Exit
  140.  
  141. f3::        ;Renames save file to include texture the save tests, based on clipboard.
  142. Loop Files, %SaveFolder%\*.ess
  143. {
  144.     StringReplace, New, A_LoopFileName, _00000000_0, _%Clipboard%_00000000_0  
  145.     FileMove, %SaveFolder%\%A_LoopFileName%, %SaveFolder%\%new%
  146.     FileDelete, %SaveFolder%\*.skse                 ;While we're at it, delete any SKSE cosave files.
  147. }
  148. Exit
  149.  
  150. ]::                                                 ;Brings all folders to front, displaying them.
  151. WinGet, id, list, ahk_class CabinetWClass
  152. loop 2 {
  153.     Loop, 10 {
  154.         this_id := id%A_Index%
  155.         WinActivate, ahk_id %this_id%
  156.     }
  157. }
  158. Exit
  159.  
  160. [::             ;Starts Skyrim work related programs/folders.
  161. Process, Exist, ModOrganizer.exe
  162. If ErrorLevel = 0
  163. run C:\Reprise\MO2\ModOrganizer.exe
  164. Process, Exist, Notepad++.exe
  165. If ErrorLevel = 0
  166. run C:\Program Files\Notepad++\notepad++.exe
  167. Process, Exist, ABIC.exe
  168. If ErrorLevel
  169. Exit
  170. run C:\Users\Erica\Documents\Archived Documents\Skyrim Modding Folders\ABIC.exe
  171. run E:\Bethesda Mods\Screenshot Comparison\Normal Stuff
  172. run C:\Users\Erica\Documents\My Games\Skyrim Special Edition\Saves
  173. run C:\Reprise\Steam\SteamApps\common\Skyrim Special Edition\Screenshots
  174. sleep 750 ;1000 is fine, 500 fail? 750 seems fine
  175. WinMove, E:\Bethesda Mods\Screenshot Comparison\Normal Stuff,,-16+X,380+Y,635,1566
  176. WinMove, C:\Users\Erica\Documents\My Games\Skyrim Special Edition\Saves,,317+X,380+Y,635,1566
  177. WinMove, C:\Reprise\Steam\SteamApps\common\Skyrim Special Edition\Screenshots,,750+X,380+Y,635,1566
  178. run E:\zSkyrimTextureWork\Skyrim SE\textures
  179. run C:\Users\Erica\AppData\Local\ModOrganizer\Skyrim Special Edition\mods\zzz\textures
  180. run E:\zSkyrimTextureWork\Skyrim PNG Originals
  181. sleep 400 ;400 is fine
  182. WinMove, E:\zSkyrimTextureWork\Skyrim SE\textures,,1083+X,380+Y,635,1566
  183. WinMove, C:\Users\Erica\AppData\Local\ModOrganizer\Skyrim Special Edition\mods\zzz\textures,,1416+X,380+Y,635,1566
  184. WinMove, E:\zSkyrimTextureWork\Skyrim PNG Originals,,1749+X,380+Y,635,1566
  185. sleep 3200
  186. WinMove, ahk_class Notepad++,,600+NX,160+NY
  187. Winactivate, ahk_exe ModOrganizer.exe
  188. WinMove, ahk_exe ModOrganizer.exe,,950+MONumber,250+MONumber
  189. Exit
  190.  
  191. Alt & Escape::
  192. reload
  193. Exit
  194.  
  195. Alt & V:: ;At 60 nits. Go to 35nits and apply C2 profile.
  196. send {alt down}{h down}{alt up}{h up}   ;Activating ColorControl's hotkey to change brightness to 35nits.
  197. run colorcpl.exe                        ;Open Color Management to switch ICC profile
  198. sleep 70       
  199. winactivate Color Management
  200. send {tab}{tab}{tab}{up}{down}{down}{tab}{tab}{tab}{enter}
  201. sleep 40           
  202. process,close,colorcpl.exe
  203. exit
  204.  
  205. Alt & B:: ;At 35 nits. Go to 60nits and apply Cowabunga profile.
  206. send {alt down}{k down}{alt up}{k up}   ;Activating ColorControl's hotkey to change brightness to 60nits.
  207. run colorcpl.exe                        ;Open Color Management to switch ICC profile
  208. sleep 70       
  209. winactivate Color Management
  210. send {tab}{tab}{tab}{up}{down}{down}{tab}{tab}{tab}{enter}
  211. sleep 40           
  212. process,close,colorcpl.exe
  213. exit
  214.  
  215. #IfWinActive ahk_class Skyrim Special Edition
  216. ,::                                                 ;Instant noclip
  217. NoClip()
  218. Exit
  219.  
  220. NoClip() {
  221. sendinput, {~ down}
  222. sleep 30
  223. sendinput, {~ up}
  224. sendevent {Click, 200 100 0}{click}{click}
  225. sendevent, tcl
  226. sleep 10
  227. sendinput, {enter down}{enter up}
  228. sleep 10
  229. sendinput, {~ down}
  230. sleep 30
  231. sendinput, {~ up}
  232. }
  233.  
  234. DllCall("QueryPerformanceFrequency", "Int64*", freq)
  235. DllCall("QueryPerformanceCounter", "Int64*", CounterBefore)
  236. DllCall("QueryPerformanceCounter", "Int64*", CounterAfter)
  237. MsgBox % "Elapsed QPC time is " . (CounterAfter - CounterBefore) / freq * 1000 " ms"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement