Jump to content
LaunchBox Community Forums

[RESOLVED] KO DRive Fullscreen Script


Trymado

Recommended Posts

Hello everyone, I try to add  Script 2 in Script 1 (merged 2 scripts) but it does not work. Start separately, the two scripts work.
It is necessary when the window of KO Drive is launched, F8 is automatically pressed which launches the fullscreen
Thx a lot


Script  1 Fullscreen with Input "F8":

#SingleInstance force

;;; Known issues:
;;;
;;; - Weird results for windows with custom decorations such as
;;; Chrome, or programs with a Ribbon interface.
;;; - Emacs will be maximized behind instead of in front of
;;; the taskbar. Workaround: WinHide ahk_class Shell_TrayWnd
ToggleFakeFullscreen()
{
CoordMode Screen, Window
static WINDOW_STYLE_UNDECORATED := -0xC40000
static savedInfo := Object() ;; Associative array!
WinGet, id, ID, A
if (savedInfo[id])
{
inf := savedInfo[id]
WinSet, Style, % inf["style"], ahk_id %id%
WinMove, ahk_id %id%,, % inf["x"], % inf["y"], % inf["width"], % inf["height"]
savedInfo[id] := ""
}
else
{
savedInfo[id] := inf := Object()
WinGet, ltmp, Style, A
inf["style"] := ltmp
WinGetPos, ltmpX, ltmpY, ltmpWidth, ltmpHeight, ahk_id %id%
inf["x"] := ltmpX
inf["y"] := ltmpY
inf["width"] := ltmpWidth
inf["height"] := ltmpHeight
WinSet, Style, %WINDOW_STYLE_UNDECORATED%, ahk_id %id%
mon := GetMonitorActiveWindow()
SysGet, mon, Monitor, %mon%
WinMove, A,, %monLeft%, %monTop%, % monRight-monLeft, % monBottom-monTop
}
}

GetMonitorAtPos(x,y)
{
;; Monitor number at position x,y or -1 if x,y outside monitors.
SysGet monitorCount, MonitorCount
i := 0
while(i < monitorCount)
{
SysGet area, Monitor, %i%
if ( areaLeft <= x && x <= areaRight && areaTop <= y && y <= areaBottom )
{
return i
}
i := i+1
}
return -1
}

GetMonitorActiveWindow(){
;; Get Monitor number at the center position of the Active window.
WinGetPos x,y,width,height, A
return GetMonitorAtPos(x+width/2, y+height/2)
}

F8::ToggleFakeFullscreen()
Escape::ExitApp

 

Script 2, Start F8 when windows KO Drive is active

#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
Loop
while WinExist("M-Drive(NNDXG20-WIN)")
{
Send, {F8}
ExitApp
}

 

Edited by Trymado
Link to comment
Share on other sites

Resolved

#SingleInstance force ;;; Known issues: ;;; ;;; - Weird results for windows with custom decorations such as ;;; Chrome, or programs with a Ribbon interface. ;;; - Emacs will be maximized behind instead of in front of ;;; the taskbar. Workaround: WinHide ahk_class Shell_TrayWnd SetTimer, M_Drive_Exist, 500 Return M_Drive_Exist: IF WinExist("M-Drive(NNDXG20-WIN)") { ToggleFakeFullscreen() SetTimer, M_Drive_Exist, Off } Return ToggleFakeFullscreen() { CoordMode Screen, Window static WINDOW_STYLE_UNDECORATED := -0xC40000 static savedInfo := Object() ;; Associative array! WinGet, id, ID, A if (savedInfo[id]) { inf := savedInfo[id] WinSet, Style, % inf["style"], ahk_id %id% WinMove, ahk_id %id%,, % inf["x"], % inf["y"], % inf["width"], % inf["height"] savedInfo[id] := "" } else { savedInfo[id] := inf := Object() WinGet, ltmp, Style, A inf["style"] := ltmp WinGetPos, ltmpX, ltmpY, ltmpWidth, ltmpHeight, ahk_id %id% inf["x"] := ltmpX inf["y"] := ltmpY inf["width"] := ltmpWidth inf["height"] := ltmpHeight WinSet, Style, %WINDOW_STYLE_UNDECORATED%, ahk_id %id% mon := GetMonitorActiveWindow() SysGet, mon, Monitor, %mon% WinMove, A,, %monLeft%, %monTop%, % monRight-monLeft, % monBottom-monTop } } GetMonitorAtPos(x,y) { ;; Monitor number at position x,y or -1 if x,y outside monitors. SysGet monitorCount, MonitorCount i := 0 while(i < monitorCount) { SysGet area, Monitor, %i% if ( areaLeft <= x && x <= areaRight && areaTop <= y && y <= areaBottom ) return i i := i+1 } return -1 } GetMonitorActiveWindow() { ;; Get Monitor number at the center position of the Active window. WinGetPos x,y,width,height, A return GetMonitorAtPos(x+width/2, y+height/2) } F8::ToggleFakeFullscreen() Escape::ExitApp

#SingleInstance force
;;; Known issues:
;;;
;;; - Weird results for windows with custom decorations such as
;;; Chrome, or programs with a Ribbon interface.
;;; - Emacs will be maximized behind instead of in front of
;;; the taskbar. Workaround: WinHide ahk_class Shell_TrayWnd
SetTimer, M_Drive_Exist, 500
Return
M_Drive_Exist:
IF WinExist("M-Drive(NNDXG20-WIN)")
{
	ToggleFakeFullscreen()
	SetTimer, M_Drive_Exist, Off
}
Return
ToggleFakeFullscreen()
{
	CoordMode Screen, Window
	static WINDOW_STYLE_UNDECORATED := -0xC40000
	static savedInfo := Object() ;; Associative array!
	WinGet, id, ID, A
	if (savedInfo[id])
	{
		inf := savedInfo[id]
		WinSet, Style, % inf["style"], ahk_id %id%
		WinMove, ahk_id %id%,, % inf["x"], % inf["y"], % inf["width"], % inf["height"]
		savedInfo[id] := ""
	}
	else
	{
		savedInfo[id] := inf := Object()
		WinGet, ltmp, Style, A
		inf["style"] := ltmp
		WinGetPos, ltmpX, ltmpY, ltmpWidth, ltmpHeight, ahk_id %id%
		inf["x"] := ltmpX
		inf["y"] := ltmpY
		inf["width"] := ltmpWidth
		inf["height"] := ltmpHeight
		WinSet, Style, %WINDOW_STYLE_UNDECORATED%, ahk_id %id%
		mon := GetMonitorActiveWindow()
		SysGet, mon, Monitor, %mon%
		WinMove, A,, %monLeft%, %monTop%, % monRight-monLeft, % monBottom-monTop
	}
}
GetMonitorAtPos(x,y)
{
	;; Monitor number at position x,y or -1 if x,y outside monitors.
	SysGet monitorCount, MonitorCount
	i := 0
	while(i < monitorCount)
	{
		SysGet area, Monitor, %i%
		if ( areaLeft <= x && x <= areaRight && areaTop <= y && y <= areaBottom )
			return i
		i := i+1
	}
	return -1
}
GetMonitorActiveWindow()
{
	;; Get Monitor number at the center position of the Active window.
	WinGetPos x,y,width,height, A
	return GetMonitorAtPos(x+width/2, y+height/2)
}
F8::ToggleFakeFullscreen()
Escape::ExitApp

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...