Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Recommended Posts

Posted

Ok ive done that now, but where do i put the option to run explorer.exe in the ahk file?

alternativley, the script that tempest suggested, where does that go

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

Posted

You can put the script anywhere you want. I personally keep all of my scripts in C:\Emu\scripts, but it doesn't really matter. Once you are happy with the way the script works, just launch Instant Sheller and tell it to use that exe. Restart, and it should be good to go. If something doesn't work, just use ctrl-alt-del and start explorer manually to fix things. Oh, if you are launching other things also, you will probably want to put those in the script as well rather than leaving them in the start menu\startup folder. The easiest way to do that would be to add them to the script you have with a run statement. Get the command line and start path from the shortcut.

From AHK help files:

Run, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel, OutputVarPID]

So, for example:

Run, XPadder.exe, C:\Program Files\XPadder

Hope that helps.

Posted

I knew i could put them anywhere, what i was reffering to was where in the script would i place the commands to hide the desktop etc? then i can just instantshell to the exe file in know.

Posted

Cool, I figured it out.

heres the code now


#SingleInstance Force
Counter = 10
WinHide, ahk_class Shell_TrayWnd
WinHide, Start
WinHide, ahk_class Progman
Gui, Add, Text, x20 y20, GameEx will start in seconds.
Gui, Add, Text, x113 y20 vSeconds, %Counter%
Gui, Add, Text, x20 y40, Press "Left Flipper" to abort
Gui, Show, autosize
MouseMove 9999,9999,0

StartTime := A_TickCount
Loop
{
GetKeyState, State, C
If State = D
Goto, Abort
ElapsedTime := (A_TickCount - StartTime)
If ElapsedTime < 1000
Continue
Counter--
If Counter = 0
Break
GuiControl,, Seconds, %Counter%

StartTime := A_TickCount
}
Run, D:\GameEx\GameEx.exe
WinShow, ahk_class Shell_TrayWnd
WinShow, ahk_class Progman
Abort:
WinShow, ahk_class Shell_TrayWnd
WinShow, ahk_class Progman
ExitApp

Process works as follows

Windows loads without taskbar. Window appears with countdown timer,

If Left flipper isnt pressed, Taskbar will re-appear (in case i exit gameex) and gameex will continue to load

If left flipper IS pressed, then the process is aborted and the taskbar will be re-shown ready to use windows as normal.

Exactly what i wanted.

I also changed the timer as it didnt like to start so quick for some reason on startup. Also got rid of the beeps (a bit annoying)

I put in a bit of code to move the mouse pointer out of the way too, as i keep my mouse in the keyboard drawer it should be handy keeping it off screen.

THANKS FOR ALL YOUR HELP

Posted

Great job on modifying the script to suit your needs. It is fine, just the way you've written it, I just wanted to point out a couple of things about "If" and flow-control:

#SingleInstance Force
Counter = 10
WinHide, ahk_class Shell_TrayWnd
WinHide, Start
WinHide, ahk_class Progman
Gui, Add, Text, x20 y20, GameEx will start in seconds.
Gui, Add, Text, x113 y20 vSeconds, %Counter%
Gui, Add, Text, x20 y40, Press "Left Flipper" to abort
Gui, Show, autosize
MouseMove 9999,9999,0

StartTime := A_TickCount
Loop
{
GetKeyState, State, C
If State = D ; More than one command use {}
{
WinShow, ahk_class Shell_TrayWnd
WinShow, ahk_class Progman
ExitApp
}
Else: ; Only do this if "C" is not down, not needed in this case because of the ExitApp above
{
ElapsedTime := (A_TickCount - StartTime)
If ElapsedTime < 1000
Continue
Counter--
If Counter = 0 ;Only one command, {} not needed
Break
GuiControl,, Seconds, %Counter%
StartTime := A_TickCount
}
;put other code here to execute in the loop whether "C" is down, or not.
}

Run, D:\GameEx\GameEx.exe
WinShow, ahk_class Shell_TrayWnd
WinShow, ahk_class Progman
ExitApp

Also, if you leave the code as you have it, you could do this:

;Beginning of code
Run, D:\GameEx\GameEx.exe
Abort:
WinShow, ahk_class Shell_TrayWnd
WinShow, ahk_class Progman
ExitApp

I also noticed that you used: WinHide, Start

But not: WinShow, Start

Does Winhide, Start not hide the start button for you? Or did you just not need it back?

My first rule of AHK: Whatever Works! Seriously, I'm impressed that you adapted it so well! :)

Posted

Hi again,

Nah i omitted the show start because it was causing the start menu to actually appear as if i had clicked on it. I tried it without that line and it works fine. so i just went with it.

I probably should have removed the 1st hide line too, but oh well i forgot.

Ive done a few other changes since yesterday. I now have the program in the registry at startup. and i have removed the hide/show commands and gone with a shelling solution.

I discovered that shelling into it didnt work correctly when i aborted the process as it would only bring up a single explorer window, rather than shelling properly and bringing up the taskbar etc.

Solution to that was to have the program start using the Userinit in the registry rather than the shell. Shell is still set as explorer.exe (has to be for this to work i discovered) Then i put back launchonexit=explorer.exe into gameex for the finishing touch. Now if i press the left flipper it continues to shell into windows as normal, and if i continue into gameex and exit that, it continues to shell again. A much more efficient use i think.

heres the code as i have it running now, if you have any improvements please feel free.




#SingleInstance Force
Counter = 5
Gui, Add, Text, x20 y20, GameEx will start in seconds.
Gui, Add, Text, x113 y20 vSeconds, %Counter%
Gui, Add, Text, x20 y40, Press "Left Flipper" to abort
Gui, Show, autosize
MouseMove 9999,9999,0

StartTime := A_TickCount
Loop
{
GetKeyState, State, C
If State = D
Goto, Abort
ElapsedTime := (A_TickCount - StartTime)
If ElapsedTime < 1000
Continue
Counter--
If Counter = 0
Break
GuiControl,, Seconds, %Counter%

StartTime := A_TickCount
}
Run, D:\GameEx\GameEx.exe
Abort:
ExitApp


I dont have the specify to run explorer.exe in the abort phase as windows continues to shell as normal from that point on if the application quits. should probably put in exitapp instead of a goto string but oh well. it works.

also have the mousemove in there as i dont like having the black dot cursor but this effectively moves it out of view.

Posted

Sweet!

Everyonce in awhile, someone asks about something like this... now there's a solution to point them to. :)

BTW: On Vista I had to have the hide start to get rid of the start button, otherwise it was the only thing left on the screen.

Posted
I would be happy to help if you need it. It would be simple to either select by a key, or have a menu to choose from...

I can even throw in a beep or two if you want! :P

Thanks! I don't need anything at all advanced. What I need is something that by default shells into C:\Program Files\GameEx, but if joystick button 9 is held down when it's doing that, it instead boots into C:\Program Files\GameEx_Vertical, and if joystick buttons 3, 2, and 6 are held down, it doesn't shell into anything and windows boots normally. Thanks for the help, I really appreciate it!

Posted
Thanks! I don't need anything at all advanced. What I need is something that by default shells into C:\Program Files\GameEx, but if joystick button 9 is held down when it's doing that, it instead boots into C:\Program Files\GameEx_Vertical, and if joystick buttons 3, 2, and 6 are held down, it doesn't shell into anything and windows boots normally. Thanks for the help, I really appreciate it!

One question... Do you want to use a specific joystick? (Do you only have one joystick?) If so, then I need to know the number of the joystick. If not, I can scan for joysticks, and use the button combination from any attached joystick.

Also, I don't know if you are aware of it or not, but I can specify an Ini file that GameEx uses at startup, so you wouldn't have to have two versions of GameEx set up on your computer. From the FAQ:

Q: Are there any command line options for GameEx.exe

A: Yes, you can specify a different configuration file to use by using config=

eg. gameex.exe config="c:\program files\gameex\config\myconfig.ini"

-quick has the same affect as setting gameex to not play the startup video, intro animation and intro sound. e.g. C:\program files\gameex\gameex.exe -quick

-listupdate makes GameEx update the MAME game list then exit. e.g. gameex.exe -listupdate.

-dvd launches GameEx as a stand alone DVD player, and starts playing an inserted disc.

If you want to go this way, I will need to know if you put them in one folder with different names, or if you want to keep them in separate folders.

In other words, I will need to know the path\name of each Ini file.

Posted

I will be using a specific joystick. I can always change the name in the final code because I can't recall it right now, but let's say it's something like PSJOY_1.

Posted

If I remember correctly, the reason for different versions of GameEx is to have different game lists for MAME. Since there's only one database for MAME (even with different gameex.ini files) you really need a second installation to make this configuration work.

Posted
I will be using a specific joystick. I can always change the name in the final code because I can't recall it right now, but let's say it's something like PSJOY_1.

The name of the joystick is JC-PS102U.

Also, I just figured out that when I launch into this vertical version of GameEx, since I'm using GameLauncher mode (which is known to have some quirks), it rolls across my screen when I try 320x240 res even though I know that resolution works fine on this monitor, so it works fine if I tell it to just use the desktop resolution and first change the desktop res to 321x240. So can you add that when booting into GameEx_Vertical it should first change the desktop resolution to 321x240, otherwise it should be 640x480. Thanks so much!

Posted
I will be using a specific joystick. I can always change the name in the final code because I can't recall it right now, but let's say it's something like PSJOY_1.

This works for me. All you might need to do is put the name of your joystick in the variable Joyname, in place of "Joy".

I gave instructions somewhere in the thread about how to compile a script. Let me know how it works out.

 

#SingleInstance Force
Counter = 9
JoyName:= "Joy"
GameEx:= "C:\Program Files\GameEx"
WinHide, ahk_class Shell_TrayWnd
WinHide, ahk_class Progman
MouseMove 9999,9999,0
Gui, Add, Text, x20 y15, GameEx will start in seconds.
Gui, Add, Text, x113 yp vSeconds, %Counter%
Gui, Add, Text, x20 y+10, Press Button 9 to run GameEx in vertical mode
Gui, Add, Text, y+10, Press Buttons 2,3 and 6 to start Windows
Gui, Show, autosize

StartTime := A_TickCount
Loop
{
GetKeyState, State, %JoyName%9
If State = D
{
GameEx := "C:\Program Files\GameEx_Vertical"
Break
}
GetKeyState, State, %JoyName%2
If State = D
{
GetKeyState, State, %JoyName%3
If State = D
{
GetKeyState, State, %JoyName%6
If State = D
ExitApp
}
}
ElapsedTime := (A_TickCount - StartTime)
If ElapsedTime < 1000
Continue
Counter--
If Counter = 0
Break
GuiControl,, Seconds, %Counter%
StartTime := A_TickCount
}

WinShow, ahk_class Shell_TrayWnd
WinShow, ahk_class Progman
Run, %GameEx%
ExitApp

Posted

In this section:

GetKeyState, State, %JoyName%9
If State = D
{
GameEx := "C:\Program Files\GameEx_Vertical"
Break
}

What would I insert to change the resolution to 321x240 before launching GameEx_Vertical? Thank you!

Posted

I found this:

http://www.autohotkey.com/forum/topic8355....ion&start=0

But it doesn't make much sense to me and seems much more advanced than it needs to be. I would be supplying it with the rez, refresh rate, and color depth to switch to.

and found this too

ChangeDisplaySettings( (ClrDep:=32) , (Wid:=1280) , (Hei:=1024) , (Hz:=60) )

ChangeDisplaySettings( cD, sW, sH, rR ) {
VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
DllCall( "EnumDisplaySettings", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
Return DllCall( "ChangeDisplaySettings", UInt,&dM, UInt,0 )
}

Much smaller, but still doesn't make sense to me being unfamiliar with AHK.

Posted

That looks about right. I read that there was no direct call to it with an AHK builtin function. The threads I saw said it would have to be an API or DLL call. Btw, this isn't that complicated... ^_^

Posted

So here's what I want to do based on your code:

#SingleInstance Force
JoyName:= "JC-PS102U"
GameEx:= "C:\Program Files\GameEx"
GameExVertical:= "C:\Program Files\GameEx_Vertical"
ChangeDisplaySettings( cD, sW, sH, rR ) {
VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
DllCall( "EnumDisplaySettings", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
Return DllCall( "ChangeDisplaySettings", UInt,&dM, UInt,0 )
}

GetKeyState, State, %JoyName%9
If State = D
{
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=321) , (Hei:=240) , (Hz:=60) )
Run, %GameExVertical%
ExitApp
}

GetKeyState, State, %JoyName%2
If State = D
{
GetKeyState, State, %JoyName%3
If State = D
{
GetKeyState, State, %JoyName%6
If State = D
{
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=640) , (Hei:=480) , (Hz:=60) )
ExitApp
}
}
}
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=640) , (Hei:=480) , (Hz:=60) )
Run, %GameEx%
ExitApp

So I've altered your code to do what I want. Basically I don't want any notification, just one single check to see which buttons are being pressed as soon as it executes, and then it launches the proper program based on that. And if going into Windows or standard GameEx install, it should go 640x480 in case the resolution was set to 321x240 (if the computer was last booted up in Vertical mode).

Does this all look right? Thank for all the help!

Posted

I'm sorry, I was doing three things at once... The resolution part of the script is a function, and should not be in the autoexecute section. Also, you will need to loop, or you will only have about 30 milliseconds to make a decision... I put in 5000, for 5 seconds, you can change the number to whatever you want. This is untested.

 

#SingleInstance Force
JoyName:= "JC-PS102U"
GameEx:= "C:\Program Files\GameEx"
GameExVertical:= "C:\Program Files\GameEx_Vertical"
StartTime := A_Tickcount
Loop
{
GetKeyState, State, %JoyName%9
If State = D
{
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=321) , (Hei:=240) , (Hz:=60) )
Run, %GameExVertical%
ExitApp
}

GetKeyState, State, %JoyName%2
If State = D
{
GetKeyState, State, %JoyName%3
If State = D
{
GetKeyState, State, %JoyName%6
If State = D
{
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=640) , (Hei:=480) , (Hz:=60) )
ExitApp
}
}
}
If (A_Tickcount - StartTime) > 5000;5 seconds
Break
}
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=640) , (Hei:=480) , (Hz:=60) )
Run, %GameEx%
ExitApp

ChangeDisplaySettings( cD, sW, sH, rR ) {
VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
DllCall( "EnumDisplaySettings", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
Return DllCall( "ChangeDisplaySettings", UInt,&dM, UInt,0 )
}

Edit: It looks like the forum removed some spaces. If you get an error, Delete "; 5 seconds"

Posted

That ";5 seconds" is causing an error, but it sort of works when I take that out. The problem is that it's not registering the button press. I've checked in the control panel and that is definitely the name of the joystick, and I'm hitting button 9 during the pause, but it still just brings ups the regular GameEx (it's actually bringing up the GameEx folder because we forgot to put \GameEx.exe in the run line).

Nevermind, I got it figured out. AHK reads it as "1Joy" I just had to look at a joystick to mouse script I had downloaded.

Posted

Here's the final code:

#SingleInstance Force
JoyNumber:= "1"
GameEx:= "C:\Program Files\GameEx\GameEx.exe"
GameExVertical:= "C:\Program Files\GameEx_Vertical\GameEx.exe"
StartTime := A_Tickcount
Loop
{
GetKeyState, State, %JoyNumber%Joy9
If State = D
{
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=321) , (Hei:=240) , (Hz:=60) )
Run, %GameExVertical%
ExitApp
}

GetKeyState, State, %JoyNumber%Joy2
If State = D
{
GetKeyState, State, %JoyNumber%Joy3
If State = D
{
GetKeyState, State, %JoyNumber%Joy6
If State = D
{
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=640) , (Hei:=480) , (Hz:=60) )
ExitApp
}
}
}
If (A_Tickcount - StartTime) > 100
Break
}
ChangeDisplaySettings( (ClrDep:=32) , (Wid:=640) , (Hei:=480) , (Hz:=60) )
Run, %GameEx%
ExitApp

ChangeDisplaySettings( cD, sW, sH, rR ) {
VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
DllCall( "EnumDisplaySettings", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
Return DllCall( "ChangeDisplaySettings", UInt,&dM, UInt,0 )
}

But it's not doing the trick, because that changes the resolution, but it doesn't change the Windows resolution. What I mean is that, for example, it changes to 321x240, boots into GameEx at that res. If I then go into a game and exit the game to go back to GameEx, the res is back to 640x480. Gah, I hate this GameLauncher mode.

Posted

There is a setting that tells GameEx to mess with the resolution. First off, make sure it's turned off. Second, if it's still doing it then Tom might need to fix something in GameEx. It's definitely possible to have a script watch the resolution and change it to something if it gets changed. I don't think you should have to do that, but it's a backup if nothing else works.

Posted

I am experiencing a bug in which, if I tell GameEx_Vertical to boot in the 321x240 resolution, it does some weird rolling and bending across the sreen. If I set the desktop to 321x240 and boot into GameEx_Vertical without specifying to change resolution, it works fine. The problem is that when coming back from playing a rom, GameEx_Vertical goes back to 640x480 (my standard desktop resolution before using AHK to change it to 321x240 in the script).

I probably should mention this GameLauncher mode bug to Tom, but it seems like that mode is just really buggy in general and I wouldn't count on it being fixed anytime soon, so I'd like to come up with a workaround. Unfortunately, AHK can't simply patrol to make sure the res doesn't change, because it will and should be changing when playing roms. It just needs to come back to 321x240 when it comes back to GameEx_Vertical.

Posted

GameLauncher mode doesn't get updated much since there aren't that many people that use it or at least not very many that come to the forum to ask questions. If you are having problems with a feature of GameEx, I know that Tom will want it fixed!

It's definitely possible to watch the resolution of the screen to see if it's changed.

SysGet, Width, 0
SysGet, Height, 1

Guest
This topic is now closed to further replies.

×
×
  • Create New...