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. Thank you for your support. Tom Speirs

Patreon

Recommended Posts

Posted

headkaze,

You had recommended using GameEx Login as a way to limit the sets of games that are available to my kids, which I think is going to work well. I am about done with my MAME build and was wondering about some additional functionality in your tool.

It has been nice to see my 10 year old son get excited about the "old school games" (his words) as we conduct some tests of the system. It has been hard at times to pull him away and I am realizing that my wife isn't going to be too thrilled with this new addition if the kids spend hours a day playing games. (or complaining when she asks them to get off)

I would like to request the ability to also add time limits to each account so that the system only allows the user to play so many minutes each day. That way I can limit weekday play to 60 minutes and 180 minutes on Saturday or Sunday.

Let me know what you think. It would a great addition for parents.

Thanks!

--Ed

  • 3 years later...
Posted

I realize this thread is quite old, but thought it the best place to post this.

I made the following autohotkey script to accomplish two problems I had with the current login version:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.#NoTrayIconSleep, 3000 ; Helps prevent focus loss from loading system components.Run, C:\Gameex\login.exesleep, 1000MouseClick, left, 723, 694send {click down}sleep 100Send {click up}

It first waits 3 seconds after startup before launching login.exe. This allows other system components to load, instead of stealing focus away. It then moves the mouse cursor to the black space in the bottom right hand corner of the screen. It also left clicks for redundantly in case the focus was stolen again after the 3 second wait.

Unfortunately an autohotfix can't solve my last problem. I need to be able to add more than one key assignment to the navigation controls. I want to be able to control the UI with the joysticks and arrow keys. I also want to be able to select with both a button press and the enter key. Feature Request?

Posted

Wouldn't Adultery's GameEx Launch perform pretty much the same function of launch delay? Not sure of the need for the redundant left clicking.

It's just there incase the system loads something that steals focus away from the GUI. I have the launcher in the Startup folder and it loads almost as soon as the desktop shows. This is when all the system tray programs are also loading. One of them steals focus from the GUI sending it to the background while looking like it is running fine. But if you try to navigate, it won't respond until you click somewhere onscreen. The timeout just gives the system programs a chance to load and the left click makes doubly sure that the GUI is in front. This way I don't need the mouse (I'm running an Arcade Cabinet and want everything controlled by the joysticks and buttons).

I've had various programs interfere with GameEX during the startup process. GameEX would start to load then something else would load and steal focus and leave GameEX to hang in the startup process without finishing, until I was able to re-select GameEX and then it would finish. I've had to disable as many startup processes as I can get away with to avoid this problem. Luckily this login program, and my little autohotkey fix, delay the start of GameEX long enough prevent this problem. It's all about redundancy. It's just another way to ensure problems that can occur don't.

Tempest said,

"I think that you can use GetKeyState and a timer for the navigation remapping."

Yes, for a controller. The tanksticks I'm using is actually much easier. I only need to assign another key (8::Up for example). I did this but for some reason I can't get the AHK script to close after the login.exe closes now. Here's the AHK script if you're following along:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.

SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

#NoTrayIcon

Sleep, 3000 ; Helps prevent focus loss from loading system components.

Run, C:\Gameex\login.exe

sleep, 1000

MouseClick, left, 723, 694

send {click down}

sleep 100

Send {click up}

8::Up

4::Left

2::Down

6::Right

Lctrl::Enter

Process, WaitClose, login.exe

ExitApp

I can't figure out the last 2 strings. ExitApp should close the AHK scrip upon reaching that line, so it must not be getting there. The waitclose must be holding it up indefinatly (since I did not set a timeout). The problem is I can't seem to be able to specify the process waitclose is watching. I haven't tried identifying it by the PID because I can't figure out how to store the unique PID created when oprning it in the run command earlier, and then specifying it in wait close. Maybe there's an easier way. Yes I tried Exit, all that did was remap my escape key to the start key (that made no sense).

Posted

Launching my app in the startup folder makers it the last thing to load and then adds a customizable delay, so I'm not sure what you mean by your comment about focus loss (after the delay GameEx is launched cleanly). Maybe I'm missing something here?

No matter. Do your thing. :-)

Posted

I'm not using you app right now. I might, but I still need to assign multiple keys for navigation control. It's like needing a script to launch a launcher to load a profile for GameEX. Your app would add a step that might interfere with my script. So for now, I'm just trying to figure that part out. Maybe Headkaze will add the ability to add multiple keys to the same Navigation function in the future. Until then I'm forced to write code.

Posted

No worries, I just don't fully understand what's being done here. As the women say, it's not you it's me. :D

Posted

Try this:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.#NoTrayIconSleep, 3000 ; Helps prevent focus loss from loading system components.Run, C:\Gameex\login.exesleep, 1000MouseClick, left, 723, 694send {click down}sleep 100Send {click up}Process, WaitClose, login.exeExitApp8::Up4::Left2::Down6::RightLctrl::Enter

I'm a bit worse than Adultery, I forgot along time ago what you are trying to accomplish and are only helping you pursue the route you have taken.
The easy answer could be 'Press the space bar' for all I know. ;)

  • Like 1
Posted

You're correct that is the problem. The hot key section doesn't act like code, it holds up the process. So simply moving it after the launcher/focus grabber section made it work.

I don't see what's so confusing about what I'm doing here. The login GUI has navigation controls that you can assign (eg. left arrow key moves left, and so on). These assignments are only for the GUI itself while you are selecting a profile. I want to select a profile with the joysticks on my arcade cabinet and still be able to use the arrow keys/enter on the keyboard. This way when I need to enter a password I can use the keyboard and press enter instead of having to press the select button on the arcade panel, but when selecting an unprotected profile I just need the panel (easy to understand for the kids).

I suppose I could use Adultry's launcher to handle the launching part, but it's more intuitive/easier to use this instead. I mean all it does is:

  1. launch login.exe after waiting a few seconds
  2. Move the mouse out of the middle of view (which I wanted badly)
  3. Click on the screen to make sure the GUI has focus (I'm thinking of making the clicking a loop every couple of seconds to make sure it keeps focus. I had it loose focus on wakeup from sleep.)
  4. Give a few keys the same function.

A simple little script that took me, a code noob, a few hours to make. It's not a big deal really I just posted it here in case someone else has a simalair need.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.#NoTrayIconSleep, 3000 ; Helps prevent focus loss from loading system components.Run, C:\Gameex\login.exesleep, 1000MouseClick, left, 723, 694send {click down}sleep 100Send {click up}Process, WaitClose, login.exeExitApp8::Up4::Left2::Down6::RightLctrl::Enter
Posted

It's all good. Here is the result of the last five hours. I added a loop so the click is sent every 3 seconds.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.#NoTrayIconSleep, 3000 ; Helps prevent focus loss from loading system components.Run, C:\Gameex\login.exeloop{	Process, Exist, login.exe ; check to see if login.exe is running		{		If (errorLevel=0) ; If it's not running do the following			Break		else ; If it's running do the following			Sleep, 100			MouseClick, left, 723, 694			send {click down}			sleep 100			Send {click up}			sleep, 3000		}}ExitApp8::Up4::Left2::Down6::RightLctrl::Enter

Anecdote:

In case your wondering why use a loop? GameEX also does this during the startup process. I got stuck in the GameEX startup process by a process that sent GameEX into the background during windows startup. Every second the mouse would reposition to the middle of the screen and I had to use task manager and keyboard commands to re-enter GameEX so It could finish the startup process. That is why I made my loop 3 seconds, it gives me enough time to use the mouse between repositions, in case I need to end the process. This way I can actually select end task with the mouse before it repositions.

Posted

If you want ALL of the commands underneath the else statement to ONLY be executed if ErrorLevel <> 0, then those commands need to be enclosed in braces. As you have it , If ErrorLevel = 0 then break Else Sleep, 100. All of the commands after Sleep, 100 are executed regardless of the If / Else condition.

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.SendMode Input ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.#NoTrayIconSleep, 3000 ; Helps prevent focus loss from loading system components.Run, C:\Gameex\login.exeloop{    Process, Exist, login.exe ; check to see if login.exe is running    If (errorLevel=0) ; If it's not running do the following       Break    else ; If it's running do the following    {        Sleep, 100        MouseClick, left, 723, 694        send {click down}        sleep 100        Send {click up}        sleep, 3000     }}ExitApp8::Up4::Left2::Down6::RightLctrl::Enter
Posted

Thanks, good catch.

EDIT: 9/2/14

In case anyone wants a recap, this script should be placed in your startup folder. It will 1) run login.exe 3 seconds later and 2) send mouse clicks every 3 seconds to an area of screen out of view, making sure login is in the foreground. The screen resolution and location of login.exe may vary for you. So I have added descriptions behind semicolons (eg." ; help dialog that will not be run"). The script you may want to change is the "Run, [insert location of login.exe]" and "MouseClick, left, [insert custom coordinates]".

Download "AutoHotKey" and copy the following script into notpad. Change the script as desired (see above). Then save as "login.ahk". This will run fine on that system. You can also compile it to an executable that will run on a system without AutoHotKey.

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.SendMode Input ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.#NoTrayIconSleep, 3000 ; Helps prevent focus loss from loading system components.Run, C:\Gameex\login.exe ; Change this to the location of Login.exeloop{    Process, Exist, login.exe ; check to see if login.exe is running    If (errorLevel=0) ; If it's not running do the following       Break    else ; If it's running do the following    {        Sleep, 100        MouseClick, left, 723, 694 ; Change these coordinates to fit        send {click down}        sleep 100        Send {click up}        sleep, 3000     }}ExitApp8::Up4::Left2::Down6::RightLctrl::Enter

Join the conversation

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

Guest
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...