[SOLVED] Making a script run in the background ?

Ask gaming related questions
NaNoMister
Posts: 3
Joined: 22 Oct 2019, 23:59

[SOLVED] Making a script run in the background ?

23 Oct 2019, 03:25

Hello everyone, I am new here :)

I am trying to develop a macro for a small web game. It's a really repetitive, long and fastidious task that may gives you carpal tunnel if you don't use a macro, so I tried to create one from scratch ! :D
Everything works well, and since I only have one PC, I'm using Virtualbox (with a windows 7 VM and Firefox) to make the macro work separately from the computer.
It worked pretty well, until they decided to change the web game's code from Flash to Webgl, making the VM incredibly slow :/ It's so slow that it makes the macro ineffective...

So, I'm looking for a program or something that could do the same thing, which is "focusing" the macro on the web game, so I can use the keyboard for other things at the same time.

Sorry for my bad english, i'm French :)
Last edited by NaNoMister on 31 Oct 2019, 01:17, edited 1 time in total.
SaschaMan
Posts: 4
Joined: 21 Oct 2019, 05:42

Re: Making a script run independently from my PC ?

23 Oct 2019, 04:29

With AHK i don't have an idea, but you can try it with

iMacros for Firefox extension
https addons.mozilla.org /de/firefox/addon/imacros-for-firefox/ Broken Link for safety

But you will need to write a new script.

Or maybe with this extension (simple clicker...)
https addons.mozilla.org /de/firefox/addon/imakeclick/?src=search Broken Link for safety

or some other firefox extension.
NaNoMister
Posts: 3
Joined: 22 Oct 2019, 23:59

Re: Making a script run independently from my PC ?

23 Oct 2019, 10:12

SaschaMan wrote:
23 Oct 2019, 04:29
With AHK i don't have an idea, but you can try it with

iMacros for Firefox extension
https addons.mozilla.org /de/firefox/addon/imacros-for-firefox/ Broken Link for safety

But you will need to write a new script.

Or maybe with this extension (simple clicker...)
https addons.mozilla.org /de/firefox/addon/imakeclick/?src=search Broken Link for safety

or some other firefox extension.
Thanks for your answer ! :)
So, I tried both add-ons, and unfortunally I don't like them.
Simple Clicker is very simple, but way too munch simple, because I need to press more than 1 button ... :?
iMacros doesn't look as good as AHK, I just don't feel it... :eh:

I'll try to rephrase my question. Is there any sort of tool, software besides VMWare and Virtualbox that can make an AHK script "focus" on a program, just like a background task, so I can do other things at the same time ? :eh:
NaNoMister
Posts: 3
Joined: 22 Oct 2019, 23:59

Re: Making a script run independently from my PC ?

27 Oct 2019, 06:20

Hello again :)
So, after further searching, I finally found a thread that has exactly what I was looking for : https://autohotkey.com/board/topic/71838-solved-run-a-script-for-a-program-in-the-background/
They are mentioning the commands « WinGet » and « ControlSend ».

The problem is that it works perfectly with Notepad, but when I try with Firefox, the keys are not sent. It works if I open the Firefox window, but as soon as I click on something else, it immediately stops working.


UDPATE : Ok guys, It finally works ! Here is a piece of my code that should explain what I've done :

Code: Select all

DetectHiddenWindows, On
SetTitleMatchMode, 2

WinGetClass, WinClass, Mozilla Firefox

loop {
SetTimer, GetFocus, 200								; Makes the browser gain focus every 200 ms
}
return

GetFocus:
ControlFocus,, Mozilla Firefox
Return


F3::
	loop 5
	{
		Controlsend,, {Down down}, ahk_class %WinClass%
		Sleep 200
		Controlsend,, {Down up}, ahk_class %WinClass%
	}
Like this, it should work even if you're doing something else at the same time.

Return to “Gaming”

Who is online

Users browsing this forum: Google [Bot] and 33 guests