Page 2 of 2

Re: script wait until joy8 is pressed

Posted: Sun Apr 06, 2014 6:45 pm
by davhuit
@h3xl3y : Can you share the program or where you found it?

I would be interested in it (I have some games that don't support gamepad that I added to Steam Big Picture and xpadder automatically load/unload the required profile when I load/close the game but that would be nice to have a splash screen displayed before to remember the controls (the spacebar is not a problem for me, as I have a xpadder profile loaded by default with the "ESC" key binded, I can also bind another key with a combo key never used in a game. "ESC" is binded to "LT" (hold) + right click stick", so I can put "LT" (hold) + "left click stick for "spacebar".

Re: script wait until joy8 is pressed

Posted: Sun Apr 06, 2014 7:43 pm
by h3xl3y

Re: script wait until joy8 is pressed

Posted: Wed Apr 09, 2014 12:37 am
by davhuit
Thanks.

Though I searched a bit and I found that AutoIt offer a native function that display a splashscreen (which might be better/easier to use as it can be modified) :

http://www.autoitscript.com/autoit3/doc ... mageOn.htm
http://www.autoitscript.com/autoit3/doc ... ashOff.htm

Would someone be able to make a script that use this function to display a splashscreen and then run a program when a key is pressed?

I managed to display the splash screen but not to write a function which make the splashscreen dissapear then run the program once a keyboard key is pressed.

For the key, I think this function is required for the key press : https://www.autoitscript.com/autoit3/do ... KeySet.htm

Edit : I managed to do that, for now :

Code: Select all

;set the hotkey
HotKeySet("{Enter}", "Start")

;display a splash screen
Local $sDestination = "image.jpg"
SplashImageOn("Splash Screen", $sDestination, 250, 50)

;wait for the hotkey to be pressed
While 1
    Sleep(100)
WEnd

;take this action when the hotkey is pressed
Func Start()
    SplashOff()
EndFunc
Now, I just need to manage to run the program after the "SplashOff" (and also to exit/kill the autoit script once the game is loaded).

Edit 2 :

Code: Select all

;set the hotkey
HotKeySet("{Enter}", "Start")

;display a splash screen
Local $sDestination = "image.jpg"
SplashImageOn("Splash Screen", $sDestination, 250, 50)

;wait for the hotkey to be pressed
While 1
    Sleep(0)
WEnd

;take this action when the hotkey is pressed
Func Start()
    SplashOff()
    Run ("C:\Windows\regedit.exe")
EndFunc
Works fine with Regedit but when I put the path of a game executable, it seems to load it but then stuck (the game works fine). Maybe the basic "Run" function is not adapted for everything?

Edit 3 :

Code: Select all

;set the hotkey
HotKeySet("{Enter}", "Start")

;display a splash screen
Local $sDestination = "image.png"
SplashImageOn("Splash Screen", $sDestination, 250, 50)

;wait for the hotkey to be pressed
While 1
    Sleep(0)
WEnd

;take this action when the hotkey is pressed
Func Start()
    SplashOff()
    Run("cmd /c start C:\Games\PinballArcadeUnleashed\PinballArcade.exe", "C:\PinballArcadeUnleashed\", @SW_HIDE)
EndFunc
This one works fine but not sure if the command line is really a proper one, so if some people have some thoughts about it :)

Now, just need to find how to close the script once the game is loaded because, right now, it load the game each time enter is pressed as the script is still active.

Re: script wait until joy8 is pressed

Posted: Wed Apr 09, 2014 1:22 am
by davhuit
Okay, seems I manage to finalize the script, here's the final (working) version :

Code: Select all

;set the hotkey
HotKeySet("{Space}", "Start")

;display a bmp image as a splash screen
Local $sDestination = "image_1280-720.bmp"
SplashImageOn("Splash Screen", $sDestination, 1280, 720, 0, 0, 1)

;wait for the hotkey to be pressed
While 1
    Sleep(0)
WEnd

;execute this action when the hotkey is pressed
Func Start()
    SplashOff()
    Run("cmd /c start C:\PinballArcadeUnleashed\PinballArcade.exe", "C:\PinballArcadeUnleashed\", @SW_HIDE)
    Exit
EndFunc
Seems it only require "Exit" to close the script :D

If some peoples find some flaws in this script or have a better idea to do the same thing, feel free to comment because I'm not sure if it's a proper one (I don't know much about AutoIt and produced this script with some google search and by taking part of some other scripts).

Edit : I found a problem. If the path have a space in it with the "cmd", it fails, so I modified it this way :

Code: Select all

;set the hotkey
HotKeySet("{ESC}", "Start")

;display a bmp image as a splash screen
Local $sDestination = "xpadder_hitman_blood_money.bmp"
SplashImageOn("Splash Screen", $sDestination, 1280, 720, 0, 0, 1)

;wait for the hotkey to be pressed
While 1
    Sleep(0)
WEnd

;execute this action when the hotkey is pressed
Func Start()
    SplashOff()
    Run("cmd /c start PinballArcade.exe", "C:\PinballArcade Unleashed\", @SW_HIDE)
    Exit
EndFunc
(renamed my directory "PinballArcadeUnleashed" to "PinballArcade Unleashed" to test and it's now working even with a space in the path).

To stop the splash screen and run the game with my 360 controller, I just changed "space" to "esc" in the autoit script as I have xpadder running in background with the "ESC" always binded to LT+Right Stick Button for MGalaxy (even when I play PC retail games, I never saw yet a game which required to use LT+Right Stick Button yet so that's never been a problem so far.

And for games which don't support the gamepad (games for which I wanted a splash screen), xpadder is configured to auto-load their own profiles when the .exe is loaded and the window active. If you use ALT+TAB to go back to the desktop, xpadder switch back to the default profile and if you use ALT+TAB to go back to the game window, xpadder switch back to the game profile, so that's pretty nice.