How do I run this script on a application in the background?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sackattack
Posts: 8
Joined: 28 Aug 2021, 20:02

How do I run this script on a application in the background?

15 Oct 2021, 08:29

So I made this script for a discord bot and want to run it in the background while I work on something else.

Here is my code:

Code: Select all

]::
Loop 9999999
{
Loop 13
{
Send {;}s
sleep 400
Send {Enter}
sleep 1000
Send {;}up p a
sleep 100
Send {Enter}
sleep 9000
Send {;}s
sleep 400
Send {Enter}
sleep 1000
Send {;}up b a
sleep 100
Send {Enter}
sleep 9000 
}
{
Send {;}h
sleep 150
Send {Enter}
sleep 400
Send {;}f
sleep 150
Send {Enter}
}
}
[Mod edit: [code][/code] tags added.]


Any advice on how I could do it? I heard that detect hidden programs or something along those lines helps.
Anyways thanks!
sackattack
Posts: 8
Joined: 28 Aug 2021, 20:02

Re: How do I run this script on a application in the background?

19 Oct 2021, 13:02

I came up with this:

Code: Select all

]::
Loop
{
Loop 14
{
ControlSend,, {;}s, discord.exe
sleep 400
ControlSend,, {Enter}, discord.exe
sleep 1000
ControlSend,, {;}up p a, discord.exe
sleep 100
ControlSend,, {Enter}, discord.exe
sleep 9000
ControlSend,, {;}s, discord.exe
sleep 400
ControlSend,, {Enter}, discord.exe
sleep 1000
ControlSend,, {;}up b a, discord.exe
sleep 100
ControlSend,, {Enter}, discord.exe
sleep 9000 
}
{
ControlSend,, {;}h, discord.exe
sleep 150
ControlSend,, {Enter}, discord.exe
sleep 700
ControlSend,, {;}f, discord.exe
sleep 150
ControlSend,, {Enter}, discord.exe
sleep 1200
ControlSend,, {;}rebirth, discord.exe
sleep 500
ControlSend,, {Enter}, discord.exe
sleep 1000
}
}
[Mod edit: [code][/code] tags added.]
Still doesn't work... Where should I start?
User avatar
mikeyww
Posts: 26888
Joined: 09 Sep 2014, 18:38

Re: How do I run this script on a application in the background?

19 Oct 2021, 13:12

You should start with a one-line script--a ControlSend command-- to see if it works. After you get one line working, you can add the other 31 lines.

Use a proper WinTitle-- see the documentation-- such as ahk_exe discord.exe.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, Frogrammer and 263 guests