Author Topic: AutoHotkey with AttractMode  (Read 4527 times)

torben656

  • Newbie
  • *
  • Posts: 3
    • View Profile
AutoHotkey with AttractMode
« on: March 08, 2018, 05:08:59 AM »
So um. One of my emulators need a AutoHotkey script which sends Alt+Enter for it to go fullscreen. But I don't know how to do this. Can somebody help?

dukpoki

  • Sr. Member
  • ****
  • Posts: 138
    • View Profile
Re: AutoHotkey with AttractMode
« Reply #1 on: March 08, 2018, 12:20:22 PM »
Code: [Select]
#SingleInstance force

Loop
{
    WinWait, ahk_exe Demul.exe
Sleep, 6000
Send {Alt down}{Enter down}
                Sleep 100
                Send {Alt up}{Enter up}
    WinWaitClose
}

Replace "Demul.exe" with your emulator of choice's exe.  Then replace "6000" with a value that is closer to the speed your emulator launches and has focus.

torben656

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: AutoHotkey with AttractMode
« Reply #2 on: March 08, 2018, 04:36:22 PM »
So uh, in my emulator config in AM I'm supposed to run the .ahk script, right?

dukpoki

  • Sr. Member
  • ****
  • Posts: 138
    • View Profile
Re: AutoHotkey with AttractMode
« Reply #3 on: March 08, 2018, 07:59:38 PM »
So uh, in my emulator config in AM I'm supposed to run the .ahk script, right?

No.  You simply load the ahk script separately before launching AM.  You can create a batch file to run the script and launch AM together if you wanted a one click solution.

torben656

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: AutoHotkey with AttractMode
« Reply #4 on: March 09, 2018, 02:48:34 AM »
Um. Is there a way to make things easier? Like a program or something that can set AutoHotkeys automatically.

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: AutoHotkey with AttractMode
« Reply #5 on: March 12, 2018, 01:21:13 AM »
you could use autoit instead.

-start demul.exe > config > plugins and paths > have a look at the value for Video Plugin (in my case : gpuDX11old )

-start a game and have a look at the values of SPG and GPU (in my case the first values, after starting a game, are spg: 2 gpu: 0 )


-create a sourcecode file like START.au3, change the Video Plugin, the value of spg, gpu (in my case gpuDX11old, 2, 0) and then compile it to START.exe:
Code: [Select]
#include <Misc.au3>

ShellExecute(@ScriptDir & "\demul.exe", ' -run=dc -image="' & $CmdLine[1] & '"')
WinWaitActive("gpuDX11oldsw | spg: 2 gpu: 0 |", "")
WinWait("gpuDX11oldsw | spg: 2 gpu: 0 |", "")
Send("!{ENTER}")

while 1
   if _IsPressed ("1B") Then
  ProcessClose("demul.exe")
   EndIf
WEnd

-copy the compiled START.exe to same folder, containing the demul.exe

-create a display/emulator system for demul, depending to your paths (in my case):
Code: [Select]
executable           C:\attract\EMU\demul\START.exe
args                 "[romfilename]"
rompath              C:\attract\EMU\demul\roms
romext               .iso;.cdi

the script starts demul.exe with your romfile (delivered from Attractmode).
it waits for demul.exe, that there is an active window with the settings/title "gpuDX11oldsw | spg: 2 gpu: 0 |".
is this special window active, then the script sends ALT+ENTER to this window.
then it waits, that you push Escape/ESC Button. If ESC is pressed, demul.exe exists and you are back to AM.
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM