I want the script to run in a certain app while tabbed out help

Ask gaming related questions (AHK v1.1 and older)
Sahunn
Posts: 4
Joined: 10 May 2021, 12:54

I want the script to run in a certain app while tabbed out help

10 May 2021, 13:02

I want the script to run in a certain app while tabbed out help (i want the script to be running in the game while i can do other things on my desktop) here is my script:


Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Gui, Font, S8 CRed, Verdana
Gui,1:+AlwaysOnTop
Gui, Add, Text, x142 y60 w100 h25 , Start Script By Pressing Windows+P
Gui, Add, Text, x142 y90 w100 h25 , Stop Script By Pressing F1
Gui, Add, Text, x142 y120 w100 h25 , More Info In The PowerPoint <3
Gui, Add, Text, x12 y10 w610 h20 , Sahun's Growtopia Auto Farmer
Gui, Add, Text, x12 y30 w610 h20 , Made by Sahun#5093 <3
Gui, Add, Text, x12 y170 w170 h25 , Press Win+P To Start Scripting
Gui, Add, Text, x220 y170 w170 h25 , V1.3
; Gui Made By Sahun
Gui, Show, w260 h200, Sahun's GtScript
#CommentFlag changethefilelocationbelovethisline(line16)
F2::Run, D:\Growtopia\Growtopia.exe
return
#p::
loop
{
#CommentFlag firstitemslot
mouseMove, 917, 1026
click
#CommentFlag place1
mouseMove, 953, 397
click
sleep, 350
#CommentFlag place2
mouseMove, 956, 530
click
sleep, 350
#CommentFlag place3
mouseMove, 955, 655
click
#CommentFlag hand
mouseMove, 838, 1028
click
sleep, 350
#CommentFlag clickplace1x6
mouseMove, 953, 397
click
sleep, 200	
mouseMove, 953, 397
click
sleep, 200
mouseMove, 953, 397
click
sleep, 200
mouseMove, 953, 397
click
sleep, 200
mouseMove, 953, 397
click
sleep, 200
mouseMove, 953, 397
click
sleep, 350
#CommentFlag clickplace2x6
mouseMove, 956, 530
click
sleep, 200
mouseMove, 956, 530
click
sleep, 200
mouseMove, 956, 530
click
sleep, 200
mouseMove, 956, 530
click
sleep, 200
mouseMove, 956, 530
click
sleep, 200
mouseMove, 956, 530
click
sleep, 350
#CommentFlag clickplace3x6
mouseMove, 955, 655
click
sleep, 200
mouseMove, 955, 655
click
sleep, 200
mouseMove, 955, 655
click
sleep, 200
mouseMove, 955, 655
click
sleep, 200
mouseMove, 955, 655
click
sleep, 200
mouseMove, 955, 655
click
sleep, 350
}
return
F1::
reload
return
[Mod edit: [code][/code] tags added.]
User avatar
mikeyww
Posts: 27096
Joined: 09 Sep 2014, 18:38

Re: I want the script to run in a certain app while tabbed out help

10 May 2021, 13:55

ControlClick can send to an inactive window. See the documentation for a description & example.
gregster
Posts: 9066
Joined: 30 Sep 2013, 06:48

Re: I want the script to run in a certain app while tabbed out help

10 May 2021, 14:27

btw, the directive #CommentFlag is actually not meant for adding comments to a script, it's not the proper way. In AHK, Inline comments start by default with a semicolon (although this could be changed with #CommentFlag):

Code: Select all

; clickplace2x6   <--- this is a comment
mouseMove, 956, 530		; some inline comment
click
sleep, 200
It kinda works in your case, but the way you use it could cause unwanted side-effects. Consider and run this example:

Code: Select all

#CommentFlag msgbox
msgbox Hello world
Now, AHK thinks that the string msgbox starts a new inline comment, and it doesn't get recognized anymore as the actual msgbox command.

#CommentFlag is also deprecated and not recommended for future use, compare https://www.autohotkey.com/docs/commands/_CommentFlag.htm
For details about comments (and also how to comment out whole sections), please see https://www.autohotkey.com/docs/Language.htm#comments

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 61 guests