Jump to content

AHK And Multiboxing


Recommended Posts

Hmm. so i got it mostly working, however when it tries to move the alt window, the window it just disappears. I can see the alt window, the right size on top of my main window, then instead of popping over to the second monitor it just dies. Then it does the same with the second alt window. 

Link to comment
Share on other sites

2 hours ago, DwnldDude said:

Hmm. so i got it mostly working, however when it tries to move the alt window, the window it just disappears. I can see the alt window, the right size on top of my main window, then instead of popping over to the second monitor it just dies. Then it does the same with the second alt window. 

AH i figured it out.

 

my second monitor is only 1600x900, so when it loads the alt windows they must be too small to run. i switched my monitors around, and it works loading the alts on the 1080p monitor.

Link to comment
Share on other sites

  • 4 weeks later...
On 7/12/2017 at 9:34 PM, DwnldDude said:

AH i figured it out.

 

my second monitor is only 1600x900, so when it loads the alt windows they must be too small to run. i switched my monitors around, and it works loading the alts on the 1080p monitor.

I have the same problem where the alt windows just disappear on 'monitor 2'.

I can run the main window + 1 alt and that one opens as you would expect on the 2nd monitor without issue; however, when I try to go with 2 or more alts, the windows start loading on the 1st monitor, will flash/load for a split second on the 2nd monitor, then disappear altogether. Frustrating!

 

If it's a scaling issue with the Alt window size calculations, which entries would I need to 'play with' to possibly correct this?

Link to comment
Share on other sites

  • 1 month later...

I am looking for an assist macro...and instructions on how to set it up as a keyboard shortcut. Does anyone have one?  I just want to acquire a target with my main and have the other two shoot the same target. Any guidance appreciated. Thanx. 

Link to comment
Share on other sites

  • 2 months later...
On ‎9‎/‎11‎/‎2017 at 7:22 PM, wizardo said:

I am looking for an assist macro...and instructions on how to set it up as a keyboard shortcut. Does anyone have one?  I just want to acquire a target with my main and have the other two shoot the same target. Any guidance appreciated. Thanx. 

 This script only targets the nearest mob and then fires your guns on your main window and up to 5 alt windows, but it works good.

To have this work correctly, your windows must me named EnBMain, EnBAlt1, EnBAlt2, ext.  In the game, the key Control for "Target nearest enemy MOB" I set for 'e' and "Fire all weapons" to 'f'. To make the script run, you just hit <alt><q> on your keyboard.

----------------------------------------------------------------

!q::

   WinActivate Earth & Beyond - EnBMain
  sleep 50
  SendInput e
  sleep 50
  sendInput f
  sleep 50
   IfWinExist Earth & Beyond - EnBAlt1
 {
  WinActivate Earth & Beyond - EnBAlt1
  sleep 50
  SendInput e
  sleep 50
  sendInput f
  sleep 50
   
 }
 IfWinExist Earth & Beyond - EnBAlt2
 {
  WinActivate Earth & Beyond - EnBAlt2
  sleep 50
  SendInput e
  sleep 50
  sendInput f
  sleep 50
  
 }
 IfWinExist Earth & Beyond - EnBAlt3
 {
  WinActivate Earth & Beyond - EnBAlt3
  sleep 50
  SendInput e
  sleep 50
  sendInput f
  sleep 50  
 }
 IfWinExist Earth & Beyond - EnBAlt4
 {
  WinActivate Earth & Beyond - EnBAlt4
  sleep 50
  SendInput e
  sleep 50
  sendInput f
  sleep 50  
 }
 IfWinExist Earth & Beyond - EnBAlt5
 {
  WinActivate Earth & Beyond - EnBAlt5
  sleep 50
  SendInput e
  sleep 50
  sendInput f
  sleep 50  
 }
   WinActivate Earth & Beyond - EnBMain
Return

Link to comment
Share on other sites

On 8/7/2017 at 7:38 PM, Geboran said:

I have the same problem where the alt windows just disappear on 'monitor 2'.

I can run the main window + 1 alt and that one opens as you would expect on the 2nd monitor without issue; however, when I try to go with 2 or more alts, the windows start loading on the 1st monitor, will flash/load for a split second on the 2nd monitor, then disappear altogether. Frustrating!

 

If it's a scaling issue with the Alt window size calculations, which entries would I need to 'play with' to possibly correct this?

I still have an issue where I can't get anything but the main window and 1 alt (at full screen size) to run on my system

 

1st monitor (main) - 1920 x 1080 (Recommended)
2nd monitor (second) - 1680 x 1050 (Recommended)

 

Is there a way for me to 'tweak' the Alt loading script so that it will load the smaller alt windows correctly (and not disappear)? 

 

EDIT: I was wondering.... I think I'm running the 64-bit version of AHK.... is that what others are running too without this issue?

EDIT #2: Well, I uninstalled AHK 64-bit and installed AHK 32-bit; same issue, though it was looking a little better; I saw the window slide over to the 2nd monitor, but then it disappeared, and the client didn't keep running (though the terminal server connection was there.

 

Edited by Geboran
Link to comment
Share on other sites

  • 1 month later...
On 5/3/2017 at 10:16 PM, wolfie said:

Ok, now for the scripts.  You don't have to put them where I did, but, hey, I like to keep all game assets in one place.  So Net-7, the Starship creator, and these scripts are all inside my main EnB folder.

 

In the case of the scripts, I created an AHK folder.

 

First script: LaunchEnB.ahk


; ==============================================================================================
;
; This script runs an instance of Earth and Beyond
;
;  It runs Net-7, hits the Play, Dismisses the Terms Window and sets the title to "EnBLoad"
; ==============================================================================================

#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.
#singleinstance force  ;  Allow only one to run at a time

Progress, w200,, Please do not disturb the process. , Loading EnB Instance

Progress, 10
Gosub, LoadMultiUnlocker

Progress, 20
Run , *RunAs D:\Programs\Games\Earth & Beyond\Net-7\bin\LaunchNet7.exe, D:\Programs\Games\Earth & Beyond\Net-7\bin\


; Handle the Net-7 Launcher
WinWaitActive, LaunchNet7
Sleep 5000
WinSetTitle, Net7
Sleep 2000
SendInput {Return}
Progress, 40
BlockInput, On

; When the terms notice comes up alter the title and dismiss
WinWaitActive, Earth & Beyond
Progress, 50
Sleep 1000
WinSetTitle, Loader
Sleep 1000
SendInput {Enter}
Sleep 1000
Progress, 75

; Wait until the main window initializes and rename it
WinWaitActive, Earth & Beyond
Progress, 90
WinSetTitle, EnBLoad

BlockInput, Off
Progress, 100
Progress, Off
Exit

LoadMultiUnlocker:
	IfWinNotExist , Net7 multi client unlocker
	{
		Run , *RunAs D:\Wolfie\Downloads\_Downloads\Other Games\ENB\Net7MultiClientUnlocker\Net7MultiClientUnlocker.exe, D:\Wolfie\Downloads\_Downloads\Other Games\ENB\Net7MultiClientUnlocker
		Sleep 2000
		WinWaitActive, Net7 multi client unlocker
		WinMinimize
	}
	Return

 

The LaunchEnB script is what actually loads the programs such as MultiUnlocker and Net-7 proxy app.  You will need to edit the 2 paths within this file.

 

While this file isn't intended to run alone it can.  It will launch Enb and leave the window titled "EnBLoad".  This is normal as its whats expected by the next script.

 

Second Script: EnbLaunchClients.ahk


; ==============================================================================================
;
; This script launches the main EnB window and 1 to 6 alt windows as provided by a single number
; on the commandline.
;
;  Call with no parameters and it will default to the main window and a single alt
;  Call with 1 parameter and it will create that many alt windows and tile them.
;  Example:
;	EnbLaunchClients.ahk 4
;  	Launches main window and 4 alts (total of 5)
;
; This secript will detect the number and window size of monitors.  The main EnB instance will
; load on your primary monitor.  
;
; If only one alt is requested, it will consume the next monitor.
;
; If more than one alt was requested the second monitor will be divided into a 2 x 2 grid that
; will support up to 4 alts not being overlapped.
;
; If more than 4 alts are requested, it will permit up to 5 but #5 and #6 will be centered
; vertically on the second monitor and they will overlap the other alt windows.
;
; For some reason if I try 6 or more clients, I get the "Already Running" dialog.  So, this
; script caps at 5.
; ==============================================================================================

#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.

; ==============================================================================================
; Config Section
; ==============================================================================================
; Use PrintScn and drop a copy of an EnB window into paint.  Then pixel peep to get the settings.
; These are default for my Windows 10 setup
;
WindowsTitleBarHeight = 27	; Uppwer title bar area
WindowsBorder = 2		; The side and bottom borders

EBMainWindowExtraPaddingW = 5 	; Makes its width 5px smaller(in case you want to get to your desktop)
EBMainWindowExtraPaddingH = 5 	; Makes its height 5px smaller(in case you want to get to your desktop)

EBAltWindowExtraPaddingW = 5 	; Makes its width 5px smaller(in case you want to get to your desktop)
EBAltWindowExtraPaddingH = 5 	; Makes its height 5px smaller(in case you want to get to your desktop)
; ==============================================================================================

; ==============================================================================================
; Global Vars Section
; ==============================================================================================
EBMainMonitor = 1
EBMainMonitorTop = -1
EBMainMonitorLeft = -1
EBMainMonitorW = -1
EBMainMonitorH = -1
EBMainWindowW = -1
EBMainWindowH = -1

EBAltMonitor = 1
EBAltMonitorTop = -1
EBAltMonitorLeft = -1
EBAltMonitorW = -1
EBAltMonitorH = -1
EBAltWindowW = -1
EBAltWindowH = -1

EBAltCount = 1
; ==============================================================================================

;Grab the command line count
if 0 = 1 
	EBAltCount = %1%

;Limit to 5 alts
if EBAltCount > 5
	EBAltCount := 5


DetectMonitors()

;MsgBox, Main Monitor %EBMainMonitor% at %EBMainMonitorTop% x %EBMainMonitorLeft% is  %EBMainMonitorW%w x %EBMainMonitorH%h Game is %EBMainWindowW%w x %EBMainWindowH%h
;MsgBox, Alt Monitor %EBAltMonitor% at %EBAltMonitorTop% x %EBAltMonitorLeft% is  %EBAltMonitorW%w x %EBAltMonitorH%h Game is EBAlt %EBAltWindowW%w x %EBAltWindowH%h 


LoadMainEBWindow()



Loop %EBAltCount% {
	LoadAltEBWindow( a_index )
}

;BlockInput, Off

CoordMode, Mouse, Client 
Run, EnBPlay.ahk
ExitApp


LoadMainEBWindow()
{
	global
	SplashTextOn, 400, 200, Loading, Loading Main Window
	WinMove, Loading, , EBMainMonitorLeft,EBMainMonitorTop
	IfWinNotExist , EnBMain
	{
		SetWindowSize( EBMainWindowW, EBMainWindowH )
		Run LaunchEnB.ahk
		WinWaitActive, EnBLoad
		WinSetTitle, EnBMain
		;WinMove,,,%EBMainMonitorLeft%,%EBMainMonitorTop%
	}
	SplashTextOff
}

LoadAltEBWindow(TheAltNumber)
{
	global
	;BlockInput, On
	local TheAlt = "EnBAlt" + TheAltNumber
	local GridAlt := TheAltNumber -1
	local Grid0 := (GridAlt & 1) = 1
	local Grid2 := (GridAlt & 2) = 2
	local Grid4 := (GridAlt & 4) = 4

	local AltWindowT := EBAltMonitorTop
	local AltWindowL := EBAltMonitorLeft

	;msgbox %Grid0% %Grid2% %Grid4%

	AltWindowL := Round( AltWindowL + ( Grid0 * ( EBAltWindowW + ( WindowsBorder * 2 ) + EBAltWindowExtraPaddingW ) ) )
	AltWindowT := Round( AltWindowT + ( Grid2 * ( EBAltWindowH + WindowsTitleBarHeight + WindowsBorder + EBAltWindowExtraPaddingH ) ) )
	AltWindowT := Round( AltWindowT + ( Grid4 * ( EBAltWindowH / 2 ) ) )

	;msgbox %AltWindowL% %AltWindowT%

	SplashTextOn, 300, 100, Loading, `nLoading Alt %TheAltNumber% of %EBAltCount% `n`nPlacing window at %AltWindowL% x %AltWindowT%
	WinMove, Loading, , AltWindowL,AltWindowT

	IfWinNotExist , %TheAlt%
		{
			SetWindowSize( EBAltWindowW, EBAltWindowH )
			Run LaunchEnB.ahk
			WinWaitActive, EnBLoad
			WinSetTitle, %TheAlt%
			WinMove,,,AltWindowL,AltWindowT
		}
	Sleep 1000
	SplashTextOff

}



DetectMonitors()
{
	global

	local AltFrameH = 0
	local AltFrameW = 0

	SysGet, MonitorCount, MonitorCount
	SysGet, MonitorPrimary, MonitorPrimary
	

	If MonitorCount >= 2
	{
		EBMainMonitor = %MonitorPrimary%
		If EBMainMonitor = 1 
			EBAltMonitor := EBMainMonitor + 1
		If EBMainMonitor > 1
			EBAltMonitor := EBMainMonitor - 1
	}
	Loop, %MonitorCount%
	{
		SysGet, MonitorName, MonitorName, %A_Index%
		SysGet, Monitor, Monitor, %A_Index%
		SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
		If (A_Index = EBMainMonitor)
		{
			EBMainMonitorTop = %MonitorTop%
			EBMainMonitorLeft = %MonitorLeft%
			EBMainMonitorW := MonitorWorkAreaRight - MonitorWorkAreaLeft
			EBMainMonitorH := MonitorWorkAreaBottom - MonitorWorkAreaTop
		}
		If (A_Index = EBAltMonitor)
		{
			EBAltMonitor = %A_Index%
			EBAltMonitorTop = %MonitorTop%
			EBAltMonitorLeft = %MonitorLeft%
			EBAltMonitorW := MonitorWorkAreaRight - MonitorWorkAreaLeft
			EBAltMonitorH := MonitorWorkAreaBottom - MonitorWorkAreaTop
		}
	}



	; Set EB Window Sizes
	EBMainWindowW := Round( ( EBMainMonitorW - (10 + ( WindowsBorder * 2) ) ) - EBMainWindowExtraPaddingW )
	EBMainWindowH := Round( ( EBMainMonitorH - (10 + ( WindowsTitleBarHeight + WindowsBorder) ) )- EBMainWindowExtraPaddingH )

	AltFrameH := ( WindowsTitleBarHeight + WindowsBorder)
	AltFrameW := ( WindowsBorder * 2)

	; Assumed settings for only 1 alt
	EBAltWindowW := Round( EBAltMonitorW - ( AltFrameW + EBAltWindowExtraPaddingW ) )
	EBAltWindowH := Round( EBAltMonitorH - ( AltFrameH + EBAltWindowExtraPaddingH ) )

	;If the alt count is more than 1 assume a 2x2 grid
	if EBAltCount > 1
	{
		EBAltWindowW := Round( ( EBAltMonitorW - ( ( AltFrameW + EBAltWindowExtraPaddingW ) * 2) ) / 2 )
		EBAltWindowH := Round( ( EBAltMonitorH - ( ( AltFrameH + EBAltWindowExtraPaddingH ) * 2) ) / 2 )
	}
}

SetWindowSize( WindowWidth, WindowHeight )
{
	If WindowWidth > 100 && WindowWidth < 10000 && WindowHeight > 100 && WindowWidth > 100 && WindowWidth < 10000
	{
		;MsgBox, Applying Registry: %WindowWidth% x %WindowHeight%
		RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Westwood Studios\Earth and Beyond\Render, RenderDeviceWidth, %WindowWidth%
		RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Westwood Studios\Earth and Beyond\Render, RenderDeviceHeight, %WindowHeight%
		;MsgBox, Set: %WindowWidth% x %WindowHeight%
	}
}

 

This script takes care of loading the main window, the alts as well as calculating their proper window sizes.  There is a config section at the top of this file.  If your windows theme has odd sizes for the titlebars and borders, you may wish to screenshot a EnB window and throw it into paint to verify your border sizes and title bar height.

 

Also in the config section are 4 variables for controlling extra padding around the windows.  I like to have a bit of squeeze between the windows so I can click between them.  This helps a lot if you are running 5 alts (6 total) as the 5th one will overlap two on the second monitor.  And you can then click between the windows to access it if you need to.  Set the padding to 0 if you don't like it.  Easy.

 

This script grabs the monitor details from windows.  It selects the main display for the main EnB window.  It selects your other monitor for the alts.  If you have more than 2 monitors it will choose the monitor next to the main.  If your main is #1 it will choose monitor #2 for the alts.  If your main monitor is #2 it will choose monitor #1 for the alts.  If you have only one monitor, it obviously will load them all on the one.

 

If you do not like how the script picks monitors, check this section:


	If MonitorCount >= 2
	{
		EBMainMonitor = %MonitorPrimary%
		If EBMainMonitor = 1 
			EBAltMonitor := EBMainMonitor + 1
		If EBMainMonitor > 1
			EBAltMonitor := EBMainMonitor - 1
	}

Replace it with:


EBMainMonitor := 1
EBAltMonitor := 2

And edit the numbers after the "=" to be whatever monitor number you want to force the windows to.

 

The rest is automatic.  It grabs the display sizes and handles the math for window sizes minus the padding you specified and minus the standard boards and titlebar.  Then pokes that into the registry prior to launching the first script.

 

Once the LaunchEnB.ahk loads a copy of EnB, its left with a window titled "EnBLoad".  This script then takes that window and renames it to "EnBMain" or "EnBAlt1" or whatever the sequence is.  It moves that window to the calculated display position.  It then calls the launch script again and repeats the process until the required number of copies are run.

 

Last Script: EnBPlay.ahk


; ==============================================================================================
;
; This script is the play time script and handles feeding commands to the alts as well as the
; main window.
;
; ==============================================================================================

#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.
#singleinstance force
; ==============================================================================================
; Global Vars Section
; ==============================================================================================

MainMouseX:=0
MainMouseY:=0


; ==============================================================================================

; ==============================================================================================
; Main Startup Section
; ==============================================================================================
CoordMode, Mouse, Client

GetWindowSizeByTitle("EnBMain",w,h)
EBMain := new ObjectXY(w,h)
EBMainLocations:= New EnBWindowLocations(EBMain.x,EBMain.y)

GetWindowSizeByTitle("EnBAlt1",w,h)
EBAlt := new ObjectXY(w,h)
EBAltLocations:= New EnBWindowLocations(EBAlt.x,EBAlt.y)


MsgBox EnB Play Script Initialized.`nReady to play.

WinActivate, EnBMain
SaveMainMouse()
; ==============================================================================================

#IfWinActive EnBMain
;~~~~~~~~~~~~~~~~~~~~~ [ Main Window Only Macros ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;===========================================================
; Formations
;===========================================================
Numpad1::
	KeyWait Control
	Gosub, FormationPipe
	Return
Numpad2::
	KeyWait Control
	Gosub, FormationBlock
	Return
Numpad3::
	KeyWait Control
	Gosub, FormationSlot
	Return
Numpad4::
	KeyWait Control
	Gosub, FormationAlt
	Return
;===========================================================

;===========================================================
; Alt Targeting and Firing
;===========================================================
Numpad5::
	Gosub, AltSelectMainTarget
	Return

Numpad6::
	SendToAlts(" ")
	ActivateMain()
	Return
;===========================================================

;===========================================================
; Looting
;===========================================================
!Numpad5::
	AltSelectMainTarget("EnBAlt1")
	AltLoot("EnBAlt1")
	Return
!Numpad6::

	AltSelectMainTarget("EnBAlt2")
	AltLoot("EnBAlt2")
	Return
!Numpad7::
	AltSelectMainTarget("EnBAlt3")
	AltLoot("EnBAlt3")
	Return
!Numpad8::
	AltSelectMainTarget("EnBAlt4")
	AltLoot("EnBAlt4")
	Return
!Numpad9::
	KeyWait Alt
	IfWinExist , EnBMain
	{
		FromMainXY( "SelectedObjectAction",LootButtonX,LootButtonY)
		FromMainXY( "LootTopSlot",LootSlotX,LootSlotY)
		WinActivate, EnBMain
		SendInput {Click, %LootButtonX% ,  %LootButtonY% }
		Sleep 1000
		SendInput {Click, %LootSlotX%, %LootSlotY% }
		Sleep 000
		SendInput {Click, %LootButtonX% , %LootButtonY% }
	}
	Return
;===========================================================

;===========================================================
; Gateing and Registration
;===========================================================
!NumpadAdd::
	KeyWait Alt
	Gosub, ItemActionAllAlts ; Operates Main Action on selected thing (gate, dock, etc)
	Return
!NumpadSub::
	KeyWait Alt
	Gosub, ItemSecondActionAllAlts ; Operates Secondary Action on selected thing (register for example)
	Return
NumpadAdd::
	Gosub, ItemActionMain ; Operates Main Action on selected thing (gate, dock, etc)
	Return
NumpadSub::
	Gosub, ItemSecondActionMain ; Operates Secondary Action on selected thing (register for example)
	Return
^NumpadAdd::
	KeyWait Control
	Gosub, AltsAcceptWormhole ; Accepts Wormhole on all alts
	Return
^NumpadSub::
	KeyWait Control
	Gosub, AltsRejectWormhole ; Rejects Wormhole on all alts
	Return
;===========================================================

;===========================================================
; Inventory Sales
;===========================================================
^SC029::
	KeyWait Control
	MainSellWholePanel()
	Return

!SC029::
	KeyWait Alt
	loop 12 {
		Send, {Ctrl Down}{Click}{Ctrl up}
		Sleep 100
	}
	return

;===========================================================

;~~~~~~~~~~~~~~~~~~~~~ [ Main Window Only Macros ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#IfWinActive


#IfWinActive EnBAlt
;~~~~~~~~~~~~~~~~~~~~~ [ Alt Window Only Macros ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;===========================================================
; Inventory Sales
;===========================================================
^SC029::
	KeyWait Control
	AltSellWholePanel()
	Return

!SC029::
	KeyWait Alt
	loop 12 {
		Send, {Ctrl Down}{Click}{Ctrl up}
		Sleep 100
	}
	return

;===========================================================

;~~~~~~~~~~~~~~~~~~~~~ [ Alt Window Only Macros ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#IfWinActive

;===========================================================
; Utilities
;===========================================================

FormationPipe:

	FromMainXY( "Formation", FormX, FormY)
	FromMainXY( "FormationPipe", OptX, OptY)
	ActivateMain()
	Click, %FormX%,%FormY%
	Sleep 1500
	Click, %OptX%,%OptY%
	Sleep 1000
	Gosub, FormationAlt
	ActivateMain()
	Return 

FormationBlock:
	FromMainXY( "Formation", FormX, FormY)
	FromMainXY( "FormationBlock", OptX, OptY)

	ActivateMain()
	Click, %FormX%,%FormY%
	Sleep 1500
	Click, %OptX%,%OptY%
	Sleep 1000
	Gosub, FormationAlt
	ActivateMain()
	Return 

FormationSlot:
	FromMainXY( "Formation", FormX, FormY)
	FromMainXY( "FormationSlot", OptX, OptY)

	ActivateMain()
	Click, %FormX%,%FormY%
	Sleep 1500
	Click, %OptX%,%OptY%
	Sleep 1000
	Gosub, FormationAlt
	ActivateMain()
	Return 

FormationAlt:
	;SendToWindow("EnBAlt1", "`,")
	SendToAlts("`,")
	Return 

AltSelectMainTarget:
	SaveMainMouse()
	WinGet, winList, List, EnBAlt
	Loop % winList
	{
	_hWin := winList%A_Index%
	WinGetTitle, title, ahk_id %_hWin%
	AltSelectMainTarget(title)
	}
	RestoreMainMouse()
	Return 

ItemActionAllAlts:
	FromAltXY( "SelectedObjectAction", OptX, OptY)
	WinGet, winList, List, EnBAlt
	Loop % winList
	{
	_hWin := winList%A_Index%
	WinGetTitle, title, ahk_id %_hWin%
	ClickOnWindow(title,OptX,OptY)
	}
	RestoreMainMouse()
	Return

ItemSecondActionAllAlts:
	FromAltXY( "SelectedObjectSecondaryAction", OptX, OptY)
	WinGet, winList, List, EnBAlt
	Loop % winList
	{
	_hWin := winList%A_Index%
	WinGetTitle, title, ahk_id %_hWin%
	ClickOnWindow(title,OptX,OptY)
	}
	RestoreMainMouse()
	Return

ItemActionMain:
	FromMainXY( "SelectedObjectAction", OptX, OptY)
	ClickOnWindow("EnBMain",OptX,OptY)
	Return

ItemSecondActionMain:
	FromMainXY( "SelectedObjectSecondaryAction", OptX, OptY)
	ClickOnWindow("EnBMain",OptX,OptY)
	Return

AltsAcceptWormhole:
	FromAltXY( "WormHoleAccept", OptX, OptY)
	WinGet, winList, List, EnBAlt
	Loop % winList
	{
	_hWin := winList%A_Index%
	WinGetTitle, title, ahk_id %_hWin%
	ClickOnWindow(title,OptX,OptY)
	}
	RestoreMainMouse()
	Return

AltsRejectWormhole:
	FromAltXY( "WormHoleReject", OptX, OptY)
	WinGet, winList, List, EnBAlt
	Loop % winList
	{
	_hWin := winList%A_Index%
	WinGetTitle, title, ahk_id %_hWin%
	ClickOnWindow(title,OptX,OptY)
	}
	RestoreMainMouse()
	Return


AltLoot(TheAlt)
{
	local lX,lY
	IfWinExist , %TheAlt%
	{
		FromAltXY( "SelectedObjectAction",LootButtonX,LootButtonY)
		FromAltXY( "LootTopSlot",LootSlotX,LootSlotY)
		FromAltXY( "SelectedObject",ObjectX,ObjectY)
		;msgbox %LootButtonX% %LootButtonY%
		CoordMode, Mouse, Client 
		MouseGetPos, lX,lY
		WinActivate, %TheAlt%
		SendInput {Click, %LootButtonX%,%LootButtonY%}
		Sleep 1000
		SendInput {Click, %LootSlotX%,%LootSlotY%}
		Sleep 500
		SendInput {Click right %ObjectX%, %ObjectY%}
		Sleep 500
		WinActivate, EnBMain
		MouseMove, lX, lY
	}
}

AltSelectMainTarget(TheAlt)
{
	IfWinExist , %TheAlt%
	{
		FromAltXY( "GroupLeaderTarget",tgtX,tgtY)
		;msgbox %tgtX% %tgtY%
		WinActivate, %TheAlt%
		SendInput {Click, %tgtX%, %tgtY%}
		Sleep 500
	}
	

}

AltSellWholePanel()
{
	local ClickDelay := 200
	local MouseLow := 0
	local MouseHigh := 20
	local r := 0
	local c := 0
	local s := ""

	loop 4 { ; Row Loop
		r := a_index
		Loop 3 { ; Col Loop
			c := a_index
			s := "InventoryC" . c . "R" . r
			SetMouseDelay, Rand(MouseLow,MouseHigh)
			FromAltXY( s,tgtX,tgtY)
			MouseMove %tgtX%,%tgtY%
			Sleep 100+Rand(ClickDelay)
			SendEvent  +{Click}
		}
	} ; Row Loop

}
MainSellWholePanel()
{
	local ClickDelay := 200
	local MouseLow := 0
	local MouseHigh := 20
	local r := 0
	local c := 0
	local s := ""

	loop 4 { ; Row Loop
		r := a_index
		Loop 3 { ; Col Loop
			c := a_index
			s := "InventoryC" . c . "R" . r
			SetMouseDelay, Rand(MouseLow,MouseHigh)
			FromMainXY( s,tgtX,tgtY)
			MouseMove %tgtX%,%tgtY%
			Sleep 100+Rand(ClickDelay)
			SendEvent  +{Click}
		}
	} ; Row Loop

}

;===========================================================
; Core Utilities
;===========================================================

ActivateMain()
{
	WinActivate, EnBMain
	Sleep 250
}

SendToAlts(SendToAll)
{
	SendIt := SendToAll
	WinGet, winList, List, EnBAlt
	Loop % winList
	{
	_hWin := winList%A_Index%
	WinGetTitle, title, ahk_id %_hWin%
	SendToWindow(title,SendIt)
	}

}
ClickOnWindow(TheWindow,X,Y)
{
	IfWinExist , %TheWindow%
	{
		SetMouseDelay 100
		WinActivate, %TheWindow%
		SendInput {Click, %X%,%Y%}
		Sleep 100
	}
}

SendToWindow(TheWindow,TextToSend)
{
	IfWinExist , %TheWindow%
	{
		WinActivate  %TheWindow%
		Send %TextToSend%
		Sleep 150
	}
}

SaveMainMouse()
{
	global
	WinActivate, EnBMain
	local lX,lY
	MouseGetPos, lX,lY
	MainMouseX := lX
	MainMouseY := lY
}

RestoreMainMouse()
{
	global
;	SplashTextOn, 400, 300, Mouse, Mouse Stored: %MainMouseX% x %MainMouseY%
;	Sleep 5000
;	SplashTextOff
	WinActivate, EnBMain
	MouseMove, MainMouseX, MainMouseY
}

Rand( a=0.0, b=1 ) {
   IfEqual,a,,Random,,% r := b = 1 ? Rand(0,0xFFFFFFFF) : b
   Else Random,r,a,b
   Return r
}

GetWindowSizeByTitle(WindowTitle, ByRef WinWidth := "", ByRef WinHeight := "", WinMode := 1) {
	local TheWindowID
	WinGet, TheWindowID, ID, %WindowTitle%
	fnWinGetPos(TheWindowID, , , WinWidth, WinHeight, WinMode)
}

fnWinGetPos(hWnd, ByRef x := "", ByRef y := "", ByRef Width := "", ByRef Height := "", Mode := 0) {
	VarSetCapacity(WRECT, 8 * 2, 0), i := {}
	, h := DllCall("User32.dll\GetWindowRect", "Ptr", hWnd, "Ptr", &WRECT)
	if (Mode=1||Mode=3)
		VarSetCapacity(CRECT, 8 * 2, 0)
		, h := DllCall("User32.dll\GetClientRect", "Ptr", hWnd, "Ptr", &CRECT)
	if (Mode=2||Mode=3)
		DllCall("User32.dll\ClientToScreen", "Ptr", hWnd, "Ptr", &WRECT)
		, DllCall("User32.dll\ClientToScreen", "Ptr", hWnd, "Ptr", &CRECT)
	i.x := x := NumGet(WRECT, 0, "Int"), i.y := y := NumGet(WRECT, 4, "Int")
	, i.h := i.Height := Height := NumGet(Mode=1||Mode=3?CRECT:WRECT, 12, "Int") - (Mode=1||Mode=3?0:y)
	, i.w := i.Width := Width := NumGet(Mode=1||Mode=3?CRECT:WRECT,  8, "Int") - (Mode=1||Mode=3?0:x)
	return i, ErrorLevel := !h
}


Class EnBWindowLocations{
	; These were the dimesnions on which all the points were measured
	Static BaseClientWidth = 1901 ; Don't Change these!
	Static BaseClientHeight = 1038 ; Don't Change these!

	Static WindowWidth := This.BaseClientWidth
	Static WindowHeight := This.BaseClientHeight

	Static ScaleWidth := 1
	Static ScaleHeight := 1

	Static Coords := {}

	Static TempScale = New ObjectXY()

	__New( WinWidth, WinHeight ) {

		This.Coords["SelectedObject"] := New ObjectXY(1700,870)
		This.Coords["SelectedObjectAction"] := New ObjectXY(1835,697)
		This.Coords["SelectedObjectSecondaryAction"] := New ObjectXY(1762,697)

		This.Coords["GroupLeaderTarget"] := New ObjectXY(1818,626)

		This.Coords["Formation"] := New ObjectXY(1755,360)
		This.Coords["FormationPipe"] := New ObjectXY(1677,300)
		This.Coords["FormationBlock"] := New ObjectXY(1752,300)
		This.Coords["FormationSlot"] := New ObjectXY(1832,300)

		This.Coords["LootTopSlot"] := New ObjectXY(1696,316)

		This.Coords["WormHoleAccept"] := New ObjectXY(760,555)
		This.Coords["WormHoleReject"] := New ObjectXY(1150,555)

		This.Coords["InventoryC1R1"] := New ObjectXY(90,414)
		This.Coords["InventoryC1R2"] := New ObjectXY(90,495)
		This.Coords["InventoryC1R3"] := New ObjectXY(90,578)
		This.Coords["InventoryC1R4"] := New ObjectXY(90,658)

		This.Coords["InventoryC2R1"] := New ObjectXY(202,414)
		This.Coords["InventoryC2R2"] := New ObjectXY(202,495)
		This.Coords["InventoryC2R3"] := New ObjectXY(202,578)
		This.Coords["InventoryC2R4"] := New ObjectXY(202,658)

		This.Coords["InventoryC3R1"] := New ObjectXY(318,414)
		This.Coords["InventoryC3R2"] := New ObjectXY(318,495)
		This.Coords["InventoryC3R3"] := New ObjectXY(318,578)
		This.Coords["InventoryC3R4"] := New ObjectXY(318,658)

		; Set up the scaling
		This.WindowWidth := WinWidth
		This.WindowHeight := WinHeight
		This.ScaleWidth := This.WindowWidth / This.BaseClientWidth
		This.ScaleHeight := This.WindowHeight / This.BaseClientHeight

	}
	Set(name, X, Y)
	{
		return This.Coords[name] := New ObjectXY(X,Y)
	}
	Get(name)
	{
		local tmp = New ObjectXY()
		This.TempScale := This.Coords[name]
		tmp.x := This.TempScale.x
		tmp.y := This.TempScale.y
		return tmp
	}
	GetScaled(name)
	{
		local tmp = New ObjectXY()
		This.TempScale := This.Coords[name]
		tmp.x := This.TempScale.x
		tmp.y := This.TempScale.y
		tmp.x := Round( tmp.x * This.ScaleWidth )
		tmp.y := Round( tmp.y * This.ScaleHeight )
		return tmp
	}}

Class ObjectXY {
	x := 0
	y := 0
	__New(xIn,yIn){
		This.x := xIn
		This.y := yIn
	}
}

FromXY_old(obj, ByRef X, ByRef Y){
	x := obj.x
	y := obj.y
}
FromMainXY(Setting, ByRef X, ByRef Y){
	global
	local obj := EBMainLocations.GetScaled(Setting)
	local x1 := obj.x
	local y1 := obj.y
	X := obj.x
	Y := obj.y
}
FromAltXY(Setting, ByRef X, ByRef Y){
	global
	local obj := EBAltLocations.GetScaled(Setting)
	X := obj.x
	Y := obj.y
}

This script gets launched at the end of the EnbLaunchClients.ahk script.  Once this script initializes, you will see the "EnB Play Script Initialized." dialog box appear (see previous screenshots).  This indicates that the play script is ready for action.

 

This play script listens for the various keboard shortcuts that I programmed into it and then takes care of sending keystrokes to the main or alt windows or clicking the mouse on various areas of the windows.  The class at the end of the script "Class EnBWindowLocations" contains the mouse X/Y positions on MY default window size of 1901x1038.  It performs scaling FROM those settings TO whatever size YOUR windows are.  Don't edit those positions!  It calculates them so they are right for whatever your monitor size is and whatever size the windows loaded as.  So if you change the padding or have a bigger or smaller desktop than I do, the numbers will scale automatically by the program.

 

I tried to label the main groups of hotkeys so its easy to tweak them as you want or add your own.  As I said, these are NOT meant for a human to type.  You probably don't want to hit Alt-NumPad5 for an alt to loot.  Or Ctl-NumPadPlus to accept a wormhole.  These were made quirky to stay out of the way of EnB's standard FPS key settings.  And I use them in my G13 and G15:

EnBG13_1.thumb.jpg.4988f1490c92b215a102fb646db938d2.jpg

EnBG13_2.thumb.jpg.2661b8e16a1a10f5277f1ed9431c8489.jpg

 

Except for chatting, I never touch the normal QUERTY keys while playing.  One hand on the G13, one on the mouse.  I ran out of keys on blue (non-combat) so I programmed G13 and G16 (lower left corner of the G15 keyboard) to refuse and accept wormholes as these aren't used much and its quick to hit them using my left hand thats normally on the G13 pad.

 

The exception to that is the quick sales and quick buys.  Ctl-Tilde will attempt to sell a 12 slot inventory panel, whats visible.  Due to EnB's bot detection (at least I think thats what it is) it misses some.  I have randomized the click times, randomized the waits and I simply can't get it to sell 100% of the time.

 

The other key combo is Alt-Tilde.  It buys 12 of whatever you have selected from the vendor.  Very rapidly.  Extremely handy for fillin up your hold with trade goods quickly so you can get on the road.  I set it to 12 just so it didn't run me broke if I accidentally hit it.  If you wish to change the number of buys, search the play script for "!SC029::".  Right after that is a "loop 12".  Change the 12 to however many you want to buy when hitting this key combo.  The "!" means ALT.  The "SC029" is the scancode for the Tilde key (top left corner on standard keyboards next to "1".

 

 

Again, you can change the key combos to whatever you desire in the play script.  And then program your keyboard or arrange them to suit a normal keyboard play style.

 

 

 

 

 


Wolfie, I am having a problem. I followed your steps exactly, but when I click one of the EnbLaunchClients.ahk shortcuts, it gets to the Net 7 launch window where you click Play, and it stops there. What am I missing?

Link to comment
Share on other sites

Please help Wolfie.... cannot get this working at all. Feel free to email me directly if need be @ rjacobsen2009@gmail.com

 

 

I figured out what was wrong. I had to right click on each one of the shortcuts on the desktop and allow them to run as administrator. Sorry for the bother.

Edited by Wyzzard
Link to comment
Share on other sites

  • 3 weeks later...
On 6/29/2017 at 12:41 PM, akeean said:

 

 

Thanks, I'll try your the alternative, tho I really doubt that would be the issue. Because it seems you can click in the login screens of your alts fine, while I can't.

 

Something is intercepting my clicks. (I've also tried different variants of left mouse down followed by sending a left mouse up, none of the mouse down events are received by the client, while mouse up plays a sound effect on ui elements and causes them to flicker for a couple of milliseconds)
 

I've screen capped the character selection screen of EnBAlt* window with OBS. This is me first trying to click on "Edison" twice via the button using my mouse, then on the character itself, then back to the button tapping left on my mousepad. The EndMain window works without issue. I've not interfered at all with the startup, basically not touching my mouse&keyboard till the "script done" window popped up.
 

 

Tho I think that it might be some issue with AHK itself. Just to check.. what flavor of AHK are you using? Cause there seem to be three different flavors that might not be all that compatible to each other. Maybe I'm just trying to run your script with the wrong version...?

I've tried it with AHK 1.1.2600 (Unicode-64bit install option) on win10x64.

 

PS: AHK 1.0 & 2.0a both throw different errors when trying to run the scripts with it so I guess ahk 1.1 was correct.

 

Akeean,

 

How did you manage to fix your clicking issue? I too am running  win10x64 however when I try the script or even just trying to open 2 EnB's manually, I cannot click on the second screen at all. The screen works, it registers when I hover over buttons but my mouse clicking only works on my main screen. Very irritating and I cannot figure this out :(

Link to comment
Share on other sites

On 2/11/2018 at 12:52 AM, Mitsunari said:

 

Akeean,

 

How did you manage to fix your clicking issue? I too am running  win10x64 however when I try the script or even just trying to open 2 EnB's manually, I cannot click on the second screen at all. The screen works, it registers when I hover over buttons but my mouse clicking only works on my main screen. Very irritating and I cannot figure this out :(


I could not fix the clicks with two screens running. :-(

I only multiboxed when I had the 1080p tv attached (and left my optimus laptop internal screen deactivated when playing like this). 

I've since stopped playing EnB for now. Good luck!

Link to comment
Share on other sites

  • 8 months later...
11 hours ago, karekiu said:

Has anyone been able to get the windows to size correctly?

I have a laptop at 1920*1080 and a monitor at 1680*1050 and my problem is that the windows are all too big.

Solved it myself, I have my graphics settign set to 125% scale.

Link to comment
Share on other sites

On ‎5‎/‎4‎/‎2017 at 5:43 PM, Zarg said:

I'll have to check this out. Most of my macro code is in AC Tools, and it is really sensitive to screen/windows positions. So I either run it with E&B full screen or windowed in the default top-left starting position.  But using something like this to get repeatable accurate locations of windows could fix much of that.

 

 

This was sent to me Yesterday. I tested it as-is. Worked fine and 3 screens were placed on my monitor. I could change the window positions if I felt a need, but they seemed ok where they were. I use the unlocker so it was easy to set up, only thing I did wrong first attempt was putting the accounts in wrong order, I put main account first instead of last.

 

Hope it helps. Made the logging 3 accounts easy for me, and looking at the code it can be changed to 4 easily enough.

3ScreenLogin.mac

Link to comment
Share on other sites

  • 2 weeks later...

So I've gotten this to work mostly but I cannot find where to change the Fire All button. I'm also running into a problem where all my alt screens fire their weapons but my main screen does not. I'm not familiar with writing script and have managed to get though some of this on my own but I can't figure this one out. Any tips?

Link to comment
Share on other sites

  • 3 weeks later...
On 11/23/2018 at 6:58 AM, Palimow said:

So I've gotten this to work mostly but I cannot find where to change the Fire All button. I'm also running into a problem where all my alt screens fire their weapons but my main screen does not. I'm not familiar with writing script and have managed to get though some of this on my own but I can't figure this one out. Any tips?

The code is on line 75 (if you haven't added anything)

Numpad6::
	SendToAlts(" ")
	ActivateMain()
	Return

Change the space in between the quotes to whatever your key is in game. As for the main not shooting, I can't see anywhere in the script where that's in it so you still need to initiate the firing with your main window character. I'm looking to add that to the code above so when I tell my alts to fire, my main does as well but it's late in the night. I've never coded with AHK so tomorrow when I have time to research/test I'll do that and share the code for you if you like.

 

Palimow: If you want the script to activate firing for your character, add this SendToWindow(EnBMain," ") above the SendToAlts(" ") line. That'll activate firing for your main then do the alts

 

One issue I'm running into is location based clicks: accept WH, dock/land and station register. It iterates through the screens but doesn't click action. I haven't had a chance to debug yet, but if anyone has any solutions to try first, let me know.

Edited by AChillingSight
Edit 1: Solved my issue; Edit 2: added how to activate main firing
Link to comment
Share on other sites

Change the Numpad6 that he has set to the following

Numpad6::
    SendToWindow(EnBMain," ")
	SendToAlts(" ")
	ActivateMain()
	Return

I'm no expert on AHK but what Wolfie did makes sense to me more or less. He hasn't been on since May (at least the forums) so feel free to post any other ideas/suggestions and I can give a whirl at adding it

Link to comment
Share on other sites

  • 4 months later...
  • 2 years later...

Wish his default setup worked for me but it just launches all the clients in my main window in windowed mode at full size. Also doesn't skip sizzle video so this takes forever to get into game. Just sticking with my tried and true method.

Link to comment
Share on other sites

  • 2 weeks later...

Remember that Unattended Macro use IS NOT allowed, if I hear of some one running programs to mine or combat, and If I contact you and each avatar in the groups and no one answers,  (1st PM each toon, 2nd on local, 3rd on broadcast)   I start kicking avatars of the group offline,  and ban for at least one month .

 

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...

I wanted to share my technical achievement. I managed to automate (well, semi-automate, like a semi-auto vs full-auto gun) the process of FN->NV trade runs (and NV->FN) down to just pushing F3 (twice per sector). Here's what it CANNOT do:

  1. Walk around in stations
  2. Run in a loop where multiple clients are juggled (no way for it to know if you're warping or not, so i'd drop you out of warp)
  3. Fly around on NV planet.
  4. Be easily converted to something that is fully automated.

So, it doesn't run afoul of the 'no unattended macros' rule. And, it has some (major) technical blockers that would prevent it from ever being useful while unattended for more than, maybe, 65 seconds at a time (AP warp from gate-to-gate is around 65 seconds ;) )

 

I offer no support for this script. I share it because:

  • It is a technical achievement and I want to brag a bit.
  • Others can learn from my code and implement their own ideas
  • Learning how to fix something is the best way to understand a new concept.
  • I can't be bothered.
  • It only works at 1280x700 resolution

  • It is SUPER picky about graphics settings (maxed out, 100% on all sliders, don't touch Gamma), and any change in colors will break it.

I also included some other useful scripts, like:

  • how I launch my clients and run the unlocker on them automatically.
  • Buying/selling trade items without (manually) clicking 40+ times.
  • Inviting alts to a group.
  • Moving items into the trade window (2 methods)
  • Vault Collapse - Combine stacks in your vault!

 

It's hard to see because they are mostly white and transparent, but just below this text I attached all the images the script needs to run. If there's a 'dark mode' for the forum, that would probably help see them. If not...uh...

altair-name.png

aragoth-prime-name.png

endriago-name.png

fenris-name.png

gate-icon.png

lagarto-name.png

muspelheim-n7-beacon.png

muspelheim-name.png

nostrand-vor-name.png

odins-belt-name.png

planet-land.png

station-dock.png

valkyrie-twins-name.png

FOR_DISTRO_fn_nv_enb_trade_run.ahk

Edited by Doctor
Clarified operation, and pointed out image attachments.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...