Running a script on a browser in the 'background'

Ask gaming related questions (AHK v1.1 and older)
scottmenace
Posts: 5
Joined: 13 May 2016, 05:55

Running a script on a browser in the 'background'

13 May 2016, 06:01

I need help

I need a script that sends "..." every 40 seconds forever of a web client in the background
Image

F3::
send ...{enter}
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: Running a script on a browser in the 'background'

13 May 2016, 08:58

Try this.

Code: Select all

SetTitleMatchMode, 2

SetTimer, F3, 40000

F3::ControlSend, , {. 3}{Enter}, HoloRP
Please excuse my spelling I am dyslexic.
scottmenace
Posts: 5
Joined: 13 May 2016, 05:55

Re: Running a script on a browser in the 'background'

13 May 2016, 11:44

Capn Odin wrote:Try this.

Code: Select all

SetTitleMatchMode, 2

SetTimer, F3, 40000

F3::ControlSend, , {. 3}{Enter}, HoloRP
It didn't work :( .. it only works when im active at that tab...
ameyrick
Posts: 122
Joined: 20 Apr 2014, 18:12

Re: Running a script on a browser in the 'background'

13 May 2016, 13:06

Code: Select all

SetTitleMatchMode, 2
WinGet, pid, PID, HoloRP
SetTimer, F3, 40000
return

F3:
IfWinNotExist, %pid%
		return
postmsg("...", pid)
return

postmsg(text, pid)
{
    Loop, Parse, text
    {
		char:= A_LoopField
 		char_number := asc(char)
		char_hex := char_number		
				
		; Convert a decimal integer to hexadecimal:
		SetFormat, IntegerFast, hex
		char_hex += 0  ; Sets char_number to its hex value.
		char_hex .= ""  ; Necessary due to the "fast" mode.
		SetFormat, IntegerFast, d

		wParam := char_hex
		
		PostMessage, 0x0102, %wParam%,,, ahk_pid %pid% ; "0x0102 `;WM_CHAR"
	}
	
ControlSend, , {enter}, ahk_pid %pid%
return
}
scottmenace
Posts: 5
Joined: 13 May 2016, 05:55

Re: Running a script on a browser in the 'background'

13 May 2016, 13:22

ameyrick wrote:

Code: Select all

SetTitleMatchMode, 2
WinGet, pid, PID, HoloRP
SetTimer, F3, 40000
return

F3:
IfWinNotExist, %pid%
		return
postmsg("...", pid)
return

postmsg(text, pid)
{
    Loop, Parse, text
    {
		char:= A_LoopField
 		char_number := asc(char)
		char_hex := char_number		
				
		; Convert a decimal integer to hexadecimal:
		SetFormat, IntegerFast, hex
		char_hex += 0  ; Sets char_number to its hex value.
		char_hex .= ""  ; Necessary due to the "fast" mode.
		SetFormat, IntegerFast, d

		wParam := char_hex
		
		PostMessage, 0x0102, %wParam%,,, ahk_pid %pid% ; "0x0102 `;WM_CHAR"
	}
	
ControlSend, , {enter}, ahk_pid %pid%
return
}
It wont open. i dont see it in system tray :crazy:
User avatar
kwstas13
Posts: 43
Joined: 19 Mar 2016, 06:26

Re: Running a script on a browser in the 'background'

13 May 2016, 13:40

scottmenace wrote:
ameyrick wrote:

Code: Select all

SetTitleMatchMode, 2
WinGet, pid, PID, HoloRP
SetTimer, F3, 40000
return

F3:
IfWinNotExist, %pid%
		return
postmsg("...", pid)
return

postmsg(text, pid)
{
    Loop, Parse, text
    {
		char:= A_LoopField
 		char_number := asc(char)
		char_hex := char_number		
				
		; Convert a decimal integer to hexadecimal:
		SetFormat, IntegerFast, hex
		char_hex += 0  ; Sets char_number to its hex value.
		char_hex .= ""  ; Necessary due to the "fast" mode.
		SetFormat, IntegerFast, d

		wParam := char_hex
		
		PostMessage, 0x0102, %wParam%,,, ahk_pid %pid% ; "0x0102 `;WM_CHAR"
	}
	
ControlSend, , {enter}, ahk_pid %pid%
return
}
It wont open. i dont see it in system tray :crazy:

Code: Select all

#Persistent
use this at the top of that script
User avatar
Hajin
Posts: 51
Joined: 13 May 2016, 09:16

Re: Running a script on a browser in the 'background'

14 May 2016, 19:07

Here a simple script with "enter":

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTimer, Button_Pressed, 1
return

Button_Pressed:
	GetKeyState, state, enter
	if state = D
	{
	loop
	{
		Send {enter}
		Sleep, 10
		Send {.}
		Sleep, 10
		Send {.}
		Sleep, 10
		Send {.}
		Sleep, 10
		Send {enter}
		Sleep, 10
		Sleep, 40000
	}
	}
	else
	{
		
	}
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: NexusP and 72 guests