Page 1 of 1

Script Background

Posted: 09 May 2024, 21:01
by herzog
Hello everyone, I'm new and I'm learning AHK, I need help running my script in the background of a game.

The game in question is a private server, called "Grand Fantasia Violet".

The command is simple, you just need to press the number 1 on the keyboard.

Code: Select all

F1::

Loop {
        Send {F6 Down}
		Sleep 10
		Send {F6 Up}
		Sleep 300
}

F2::ExitApp
This is the code that I managed to make work in the window with focus, it was necessary to open the script as administrator for it to work.

Code: Select all

F1::

Loop {
        ControlSend,, {1 Down}, ahk_class DJO_CLASS
		Sleep 10
		ControlSend,, {1 Up}, ahk_class DJO_CLASS
		Sleep 300
}

F2::ExitApp
I tried using this code in the background and it didn't work, ControlSend didn't work.
image.png
image.png (23.84 KiB) Viewed 292 times
Here is the window information in Window Spy.

Re: Script Background  Topic is solved

Posted: 09 May 2024, 21:31
by boiler
ControlSend simply doesn’t work on all windows. It very well could be nothing more than that.

I can’t help but notice in the first script you’re sending the F6 key and you are sending the 1 key in the second. I assume you really did run them using the same keys in both the send and ControlSend versions.

Re: Script Background

Posted: 09 May 2024, 21:37
by herzog
It was just an example that I put together, so the keys were changed, but both worked in focus mode