Skip to content

Instantly share code, notes, and snippets.

@R3V1Z3
Last active December 23, 2015 17:29
Show Gist options
  • Save R3V1Z3/6669428 to your computer and use it in GitHub Desktop.
Save R3V1Z3/6669428 to your computer and use it in GitHub Desktop.
Autohotkey script to load and run user-selected Future Pinball tables for video recording and screen capture purposes. Designed to work alongside MSI Afterburner for video and screen captures.
;Autohotkey script to load and run user-selected Future Pinball tables
;for video recording and screen capture purposes
#NoEnv
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
DetectHiddenWindows On
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
SetWorkingDir, C:\Games\Future Pinball\
;Check for existence of WorkingDir, ask user to locate if not found
IfNotExist, C:\Games\Future Pinball\
;Ask user for WorkingDir
FileSelectFolder, workingDir
SetWorkingDir, workingDir, , 3, Select Future Pinball installation folder
;Check for existence of Table folder, ask user to locate if not found
IfNotExist, %A_WorkingDir%\Tables\
;Ask user for TableDir
FileSelectFolder, tableDir
SetWorkingDir, tableDir, , 3, Select Future Pinball installation folder
VideoDir = %A_WorkingDir%\Videos
;Check for existence of Video folder
IfNotExist, %VideoDir%
;Create Video folder
FileCreateDir, %VideoDir%
ScreenshotDir = %A_WorkingDir%\Screenshots
;Check for Screenshot folder
IfNotExist, %ScreenshotDir%
;Create Screenshot folder
FileCreateDir, %ScreenshotDir%
SelectTables()
MsgBox, Script completed.
SelectTables() {
;Have user select which tables(fpt files) to play/record
FileSelectFile, files, M3, %TableDir%, , Select Tables, Tables (*.fpt)
if files =
{
MsgBox, Operation cancelled.
return
}
Loop, parse, files, `n
{
if a_index = 1
path = %A_LoopField%
else
{
file = %A_LoopField%
LoadTable(path, file)
}
}
return
}
LoadTable(path, file)
{
fullname = %path%\%file%
;Get bare filename for use in renaming screenshots and videos
SplitPath, fullname, , , , filename
;Get filesize to calculate Table loading time
FileGetSize, filesize, %fullname%, K
wait := filesize + 40000
;Run Future Pinball with parameters to play table then exit when done
Run Future Pinball.exe /open "%fullname%" /play /exit
;Wait until game window becomes available, then proceed
WinWaitActive, Future Pinball - © 2008 BSP Software Design Solutions ahk_class FuturePinballOpenGL, , 30
if ErrorLevel {
MsgBox, WinWait timed out.
return
} else
;Wait for table to load
Sleep, %wait%
RecordTable(path, filename)
}
GetRecentFile(folder) {
Loop, %folder%\*
{
FileGetTime, Time, %A_LoopFileFullPath%, C
If (Time > Time_Orig)
{
Time_Orig := Time
File := A_LoopFileName
}
}
Return %file%
}
RecordTable(path, filename) {
global ScreenshotDir
global VideoDir
;Start recording (assumes MSI Afterburner is running with Video Recording hotkey set to F12)
Send, {F12}
;Start by entering coins and commencing game
Send, {5}
Sleep, 1000
;Enter 2 coins to for games requiring 2 credits
Send, {1}
Sleep, 500
Send, {1}
Sleep, 500
;Setup for video recording by setting view mode to Manual then backing up a bit
Send, {F11}
Send, {S Down}
Sleep, 2000
Send, {S Up}
;Set Full Table 2 view
Send, {F2}
Sleep, 1000
;Take screenshot of Full Table 2 view (assumes MSI Afterburner is running with Screen Capture hotkey set to Ctrl-F12)
Send, {LControl Down}
Send, {F12}
Send, {LControl Up}
Sleep, 1000
;Rename screenshot according to view and filename
extension=png
folder = %ScreenshotDir%
addition= - Full View
RenameFile(folder, filename, extension, addition)
;Set low view then Look at Backglass
Send, {F5}
Sleep, 1000
Send, {Tab Down}
Sleep, 500
;Take screenshot of Backglass
Send, {LControl Down}
Send, {F12}
Send, {LControl Up}
Sleep, 1000
;Rename screenshot according to view and filename
extension=png
folder = %ScreenshotDir%
addition= - Backglass
RenameFile(folder, filename, extension, addition)
Sleep, 2000
Send, {Tab Up}
Send, {F8}
Sleep, 500
Send, {F8}
Sleep, 1000
;Take screenshot of Top view
Send, {LControl Down}
Send, {F12}
Send, {LControl Up}
Sleep, 1000
;Rename screenshot according to view and filename
extension=png
folder = %ScreenshotDir%
addition= - Top View
RenameFile(folder, filename, extension, addition)
Send, {F8}
Sleep, 1500
;Take Screenshot of Left External view
Send, {LControl Down}
Send, {F12}
Send, {LControl Up}
Sleep, 500
;Rename screenshot according to view and filename
extension=png
folder = %ScreenshotDir%
addition= - Left View
RenameFile(folder, filename, extension, addition)
Send, {F8}
Sleep, 1500
Send, {F8}
Sleep, 2000
;Take Screenshot of Right External view
Send, {LControl Down}
Send, {F12}
Send, {LControl Up}
Sleep, 500
;Rename screenshot according to view and filename
extension=png
folder = %ScreenshotDir%
addition= - Right View
RenameFile(folder, filename, extension, addition)
Send, {F8}
Sleep, 1000
Send, {F8}
Sleep, 1000
Send, {F2}
Sleep, 1000
Send, {F3}
Sleep, 1000
;Gameplay section
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 2000
Send, {Enter Up}
Sleep, 2000
Send, {LShift Down}
Sleep, 1922
Send, {LShift Up}
Sleep, 563
Send, {LShift Down}
Sleep, 500
Send, {LShift Up}
Sleep, 1578
Send, {LShift Down}
Sleep, 187
Send, {LShift Up}
Sleep, 391
Send, {LShift Down}
Sleep, 78
Send, {RShift Down}
Sleep, 31
Send, {LShift Up}
Sleep, 94
Send, {RShift Up}
Sleep, 47
Send, {RShift Down}
Sleep, 31
Send, {LShift Down}
Sleep, 63
Send, {RShift Up}
Sleep, 31
Send, {LShift Up}
Sleep, 437
Send, {LShift Down}
Sleep, 94
Send, {LShift Up}
Sleep, 16
Send, {RShift Down}
Sleep, 47
Send, {RShift Up}
Sleep, 62
Send, {LShift Down}
Sleep, 16
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 2000
Send, {Enter Up}
Sleep, 100
Send, {RShift Down}
Sleep, 93
Send, {RShift Up}
Sleep, 375
Send, {LShift Up}
Sleep, 32
Send, {RShift Down}
Sleep, 218
Send, {LShift Down}
Sleep, 63
Send, {RShift Up}
Sleep, 47
Send, {RShift Down}
Sleep, 78
Send, {LShift Up}
Sleep, 62
Send, {RShift Up}
Sleep, 407
Send, {LShift Down}
Sleep, 125
Send, {LShift Up}
Sleep, 1750
Send, {LShift Down}
Sleep, 172
Send, {RShift Down}
Sleep, 234
Send, {LShift Up}
Sleep, 78
Send, {RShift Up}
Sleep, 688
Send, {LShift Down}
Sleep, 93
Send, {LShift Up}
Sleep, 1110
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 1000
Send, {Enter Up}
Sleep, 2000
Send, {LShift Down}
Sleep, 406
Send, {RShift Down}
Sleep, 94
Send, {RShift Up}
Sleep, 125
Send, {LShift Up}{RShift Down}
Sleep, 62
Send, {RShift Up}
Sleep, 78
Send, {LShift Down}
Sleep, 156
Send, {LShift Up}
Sleep, 2079
Send, {RShift Down}
Sleep, 62
Send, {LShift Down}
Sleep, 1234
Send, {LShift Up}
Sleep, 94
Send, {RShift Up}
Sleep, 188
Send, {LShift Down}
Sleep, 172
Send, {RShift Down}
Sleep, 125
Send, {RShift Up}
Sleep, 15
Send, {LShift Up}
Sleep, 1875
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 2000
Send, {Enter Up}
Sleep, 100
Send, {LShift Down}
Sleep, 219
Send, {LShift Up}
Sleep, 1812
Send, {RShift Down}
Sleep, 219
Send, {RShift Up}
Sleep, 1078
Send, {RShift Down}
Sleep, 78
Send, {RShift Up}
Sleep, 79
Send, {RShift Down}
Sleep, 93
Send, {RShift Up}
Sleep, 328
Send, {LShift Down}
Sleep, 125
Send, {RShift Down}
Sleep, 329
Send, {LShift Up}
Sleep, 250
Send, {RShift Up}
Sleep, 390
Send, {LShift Down}
Sleep, 422
Send, {LShift Up}
Sleep, 844
Send, {RShift Down}
Sleep, 359
Send, {LShift Down}
Sleep, 16
Send, {RShift Up}
Sleep, 515
Send, {LShift Up}
Sleep, 1000
Send, {LShift Down}
Sleep, 516
Send, {LShift Up}
Sleep, 188
Send, {RShift Down}
Sleep, 93
Send, {LShift Down}
Sleep, 78
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 1000
Send, {Enter Up}
Sleep, 100
Send, {RShift Up}
Sleep, 172
Send, {LShift Up}
Sleep, 391
Send, {LShift Down}
Sleep, 109
Send, {LShift Up}
Sleep, 94
Send, {LShift Down}
Sleep, 63
Send, {LShift Up}
Sleep, 546
Send, {LShift Down}
Sleep, 125
Send, {RShift Down}{LShift Up}
Sleep, 63
Send, {RShift Up}
Sleep, 609
Send, {LShift Down}
Sleep, 141
Send, {LShift Up}
Sleep, 234
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 2000
Send, {Enter Up}
Sleep, 2000
Send, {LShift Down}
Sleep, 234
Send, {RShift Down}
Sleep, 125
Send, {LShift Up}
Sleep, 31
Send, {RShift Up}
Sleep, 1250
Send, {LShift Down}
Sleep, 172
Send, {LShift Up}
Sleep, 156
Send, {RShift Down}
Sleep, 94
Send, {RShift Up}
Sleep, 1328
Send, {LShift Down}
Sleep, 625
Send, {LShift Up}
Sleep, 2969
Send, {RShift Down}
Sleep, 109
Send, {RShift Up}
Sleep, 188
Send, {LShift Down}
Sleep, 156
Send, {LShift Up}
Sleep, 1094
Send, {LShift Down}
Sleep, 156
Send, {LShift Up}
Sleep, 547
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 2000
Send, {Enter Up}
Sleep, 2000
Send, {RShift Down}
Sleep, 31
Send, {LShift Down}
Sleep, 63
Send, {RShift Up}
Sleep, 47
Send, {LShift Up}
Sleep, 531
Send, {LShift Down}
Sleep, 109
Send, {LShift Up}
Sleep, 813
Send, {LShift Down}
Sleep, 391
Send, {LShift Up}{RShift Down}
Sleep, 125
Send, {RShift Up}
Sleep, 4171
Send, {LShift Down}
Sleep, 235
Send, {LShift Up}
Sleep, 656
Send, {RShift Down}
Sleep, 219
Send, {RShift Up}
Sleep, 562
Send, {RShift Down}
Sleep, 625
Send, {RShift Up}
Sleep, 657
Send, {LShift Down}
Sleep, 421
Send, {LShift Up}
Sleep, 782
Send, {LShift Down}
Sleep, 250
Send, {LShift Up}
Sleep, 62
Send, {RShift Down}
Sleep, 125
Send, {RShift Up}
Sleep, 547
Send, {LShift Down}
Sleep, 156
Send, {LShift Up}
Sleep, 719
Send, {LShift Down}
Sleep, 78
Send, {RShift Down}
Sleep, 63
Send, {RShift Up}
Sleep, 140
Send, {LShift Up}
Sleep, 203
Send, {LShift Down}
Sleep, 204
Send, {LShift Up}
Sleep, 546
Send, {RShift Down}
Sleep, 110
Send, {RShift Up}
Sleep, 78
Send, {RShift Down}
Sleep, 94
;Send A for classic tables
Send, {A}
Send, {Enter Down}
Sleep, 1000
Send, {Enter Up}
Sleep, 100
Send, {RShift Up}
Sleep, 843
Send, {LShift Down}
Sleep, 172
Send, {LShift Up}
Sleep, 407
Send, {LShift Down}
Sleep, 156
Send, {RShift Down}
Sleep, 31
Send, {LShift Up}
Sleep, 63
Send, {RShift Up}
Sleep, 734
Send, {LShift Down}
Sleep, 562
Send, {LShift Up}
Sleep, 954
Send, {LShift Down}
Sleep, 203
Send, {LShift Up}
Sleep, 125
Send, {RShift Down}
Sleep, 109
Send, {RShift Up}
Sleep, 78
Send, {RShift Down}
Sleep, 47
Send, {LShift Down}
Sleep, 31
Send, {RShift Up}
Sleep, 78
Send, {RShift Down}
Sleep, 110
Send, {RShift Up}
Sleep, 203
Send, {LShift Up}
Sleep, 266
Send, {RShift Down}
Sleep, 93
Send, {RShift Up}
Sleep, 94
Send, {RShift Down}
Sleep, 78
Send, {RShift Up}
Sleep, 406
Send, {RShift Down}
Sleep, 94
Send, {RShift Up}
Sleep, 110
Send, {RShift Down}
Sleep, 109
Send, {RShift Up}
Sleep, 172
Send, {RShift Down}
Sleep, 640
Send, {RShift Up}
Sleep, 141
Send, {LShift Down}
Sleep, 156
Send, {RShift Down}
Sleep, 63
Send, {LShift Up}
Sleep, 78
Send, {RShift Up}
Sleep, 1203
Send, {RShift Down}
Sleep, 109
Send, {RShift Up}
Sleep, 391
Send, {LShift Down}
Sleep, 375
Send, {LShift Up}
Sleep, 281
Send, {RShift Down}
Sleep, 203
Send, {LShift Down}
Sleep, 79
Send, {RShift Up}
Sleep, 296
Send, {LShift Up}
Sleep, 735
Send, {LShift Down}
Sleep, 719
Send, {LShift Up}
Sleep, 125
Send, {RShift Down}
Sleep, 453
Send, {RShift Up}
Sleep, 640
Send, {LShift Down}
Sleep, 157
Send, {RShift Down}
Sleep, 78
Send, {LShift Up}
Sleep, 31
Send, {RShift Up}
Sleep, 328
Send, {RShift Down}
Sleep, 78
Send, {RShift Up}
Sleep, 110
Send, {RShift Down}
Sleep, 62
Send, {RShift Up}
Sleep, 1094
Send, {LShift Down}
Sleep, 422
Send, {RShift Down}
Sleep, 312
Send, {LShift Up}
Sleep, 16
Send, {RShift Up}
Sleep, 140
Send, {RShift Down}
Sleep, 485
Send, {RShift Up}
Sleep, 312
Send, {RShift Down}
Sleep, 78
Send, {RShift Up}
Sleep, 891
Send, {RShift Down}
Sleep, 94
Send, {LShift Down}
Sleep, 31
Send, {RShift Up}
Sleep, 250
Send, {LShift Up}
Sleep, 203
Send, {RShift Down}
Sleep, 47
Send, {LShift Down}
Sleep, 63
Send, {RShift Up}
Sleep, 171
Send, {LShift Up}
Sleep, 3500
Send, {LShift Down}
Sleep, 297
Send, {LShift Up}
Sleep, 532
Send, {RShift Down}
Sleep, 531
Send, {RShift Up}
Sleep, 31
Send, {LShift Down}
Sleep, 375
Send, {LShift Up}
Sleep, 3656
; Reset view back to Full Table 2 view
Send, {F2}
Sleep, 2797
;Escape and close Future Pinball
Send, {Escape}
Sleep, 2000
;Rename video file according to filename
extension=avi
folder = %VideoDir%
addition=
RenameFile(folder, filename, extension, addition)
Sleep, 1500
}
RenameFile(folder, filename, extension, addition) {
;Get latest file in specified folder
RecentFile := GetRecentFile(folder)
FileMove, %folder%\%RecentFile%, %folder%\%filename%%addition%.%extension%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment