Jump to content
LaunchBox Community Forums

AutoHotKey Start Script for Visual Pinball


megashub

Recommended Posts

Hi All,

I've spent a lot of time refining and troubleshooting my AHK start script for Visual Pinball. I don't profess to be an AHK expert, and I'm sure there are fancier tricks you could use, but this is a decidedly uncomplicated approach that results in what I feel is a pretty clean experience, both in transitioning to Visual Pinball, and back to LaunchBox/Big Box. It accounts for the use of Pin Up Player (PUP Packs) if your chosen table uses them, while also working cleanly for typical directb2S, Freezy DMDext and UltraDMD tables.

A prerequisite is that you have already hidden your Windows desktop, as it relies on a totally blank desktop background.

You'll notice I repeat a few actions here. This is because Visual Pinball is dumb and moves the mouse around on you, which keeps the taskbar active when it shouldn't. So I move the mouse and hide (and re-hide) the taskbar to ensure Windows stays out of the way during the transitions from frontend to emulator and back again.

You'll want to adjust the screen dimensions to fit your display because I didn't bother using the screen width and height variables. You'll also need to change the button definition to match the exit key you've defined in Visual Pinball. 

Hope this helps.

 

; Minimize all open windows and move mouse off screen
WinMinimizeAll
MouseMove, 1920, 0

; Hide Frontend Launcher
WinHide, LaunchBox Big Box
WinHide, LaunchBox

SetKeyDelay, -1, 110

; Hide taskbar
WinHide, ahk_class Shell_TrayWnd
WinHide, ahk_class Shell_SecondaryTrayWnd
WinHide, Start ahk_class Button

; Wait for Visual Pinball to finish loading
WinWaitActive, Visual Pinball Player

; Hide taskbar a second time
WinHide, ahk_class Shell_TrayWnd
WinHide, ahk_class Shell_SecondaryTrayWnd
WinHide, Start ahk_class Button

; Move Mouse off screen
MouseMove, 1920, 0 

; Startup Complete

; NORMAL GAMEPLAY HAPPENS HERE

; VPX Exit Button Pressed
2Joy3::
{
; If PUPPacks are in use, wait for PuP Player to fully exit
Process, WaitClose, Pinupdisplay

; Wait for VPX to exit
WinWaitNotActive, Visual Pinball Player

; Restore Taskbar
WinShow, ahk_class Shell_TrayWnd
WinShow, ahk_class Shell_SecondaryTrayWnd
WinShow, Start ahk_class Button

; Restore Frontend Launcher
WinShow, LaunchBox Big Box
WinShow, LaunchBox
}

 

 

 

Edited by megashub
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...