Jump to content
LaunchBox Community Forums

AHK doesn't work if an emu is running with admin rights.


Guest

Recommended Posts

Hello,

as the title says, I can't find a way to make AHK scripts working with an emu booted with admin rights.

Any tips?

 

I need this because with some TeknoParrot games I need admin rights for online ( ID0 and Mario Kart ).

 

Thanks 

Link to comment
Share on other sites

1 hour ago, nohero said:

Any tips?

Yes. This is because the script also needs Admin Rights to close a program with Admin Rights. Which, when executed from LaunchBox, it doesn't have. The solution is to create a script or batch file with Admin Rights that closes TeknoParrot.

For example:

$Esc::
{
Run, D:\Close_TeknoParrot.exe
}

But it also depends on the script you are using. A lot of TeknoParrot games close with just an Escape key press. In that case, if the script sends an "Esc", no problem. But if your script uses something like "WinClose" or "Process, Close", that will probably not work.

*Edit*

To give you an example. I also run Mario Kart from an elevated TeknoParrot. But the script I use works for me without being elevated itself.

$ESC::
{
WinClose, ahk_exe MKDX-Unlocked-Profile-v1.0.exe
Send {ESC}
Sleep 200
Send {ESC}
}

 

Edited by Koroth
Link to comment
Share on other sites

Thanks for replying but the problem I have is not closing the game or closing the Harm's tool.

I want to map F2 ( Banapassport key ) to my controller right thumb stick and if TP is booted with admin rights the ahk script it doesn't work.

I use this script

Joy10::
If GetKeyState("Joy10")
{
   SetKeyDelay, -1, 110
   Send {F2}
}
Return

It works good without admin rights.

 

By the way, I tried your script for the Harm's tool and it doesn't work here booting TP with admin rights, the game closes but the tools stay open. 

 

Edited by nohero
Link to comment
Share on other sites

2 hours ago, nohero said:

Thanks for replying but the problem I have is not closing the game or closing the Harm's tool.

Sorry, I misunderstood. I thought you where having problems closing TeknoParrot when running with Admin Rights.

2 hours ago, nohero said:

I use this script




Joy10::
If GetKeyState("Joy10")
{
   SetKeyDelay, -1, 110
   Send {F2}
}
Return

It works good without admin rights.

I never have much luck mapping buttons with AutoHotKey. I rather use a dedicated keymapper program for that. Like JoyToKey.

2 hours ago, nohero said:

By the way, I tried your script for the Harm's tool and it doesn't work here booting TP with admin rights, the game closes but the tools stay open. 

It is meant to close Mario Kart DX and the MKDX Unlocked Profile program. I don't know what Harm's tool is.

Link to comment
Share on other sites

Harm is the nick of the guy who made that unlocker tool.

Here that script doesn't close the unlocker tool if TP Is booted with admin rights.

Edited by nohero
Link to comment
Share on other sites

18 minutes ago, nohero said:

Here that script doesn't close the unlocker tool if TP Is booted with.admin rights.

You need the name of the executable of the program. Mine is named: MKDX-Unlocked-Profile-v1.0.exe.

If yours is named differently, just replace with the name of your executable.

TeknoParrot may run with Admin Rights, but I am guessing the unlocker tool does not. So it shouldn't be a problem to close.

Edited by Koroth
Link to comment
Share on other sites

Mine is named the same, MKDX-Unlocked-Profile-v1.0.exe.

However it's not a problem since I'm using a BAT file for closing the unlocker tool, I tried your script just for curiosity but here doesn't work.

 

I ended up doing another trick so the game doesn't ask for admin rights and I can boot TP without and playing vs LAN with no problem.

 

CHEERs

Link to comment
Share on other sites

This might be a little bit late now, but if you are putting the ahk in the Running AutoHotkey tab or the Exit Tab on the edit emulator page then by adding the following to the top and your require script underneath it will elevate the internal AHK to admin.

full_command_line := DllCall("GetCommandLine", "str")

if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
    try
    {
        if A_IsCompiled
            Run *RunAs "%A_ScriptFullPath%" /restart
        else
            Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
    }
    ExitApp
}

So for the above example it would be

full_command_line := DllCall("GetCommandLine", "str")

if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
    try
    {
        if A_IsCompiled
            Run *RunAs "%A_ScriptFullPath%" /restart
        else
            Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
    }
    ExitApp
}

$ESC::
{
WinClose, ahk_exe MKDX-Unlocked-Profile-v1.0.exe
Send {ESC}
Sleep 200
Send {ESC}
}

Cheers

  • Unusual Gem 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...