Script fullscreen

Poser vos questions de programmation en AutoHotkey
Trymado
Posts: 24
Joined: 04 Oct 2019, 02:30

Script fullscreen

04 Oct 2019, 02:41

Salut à tous,

j'ai actuellement 2 scripts que je voudrais joindre en 1.

Séparement ils fonctionnent, mais dès que je veux intégré le script 2 dans le 1 ca marche plus.

Explication du Script 1: Lors de l'appuie sur F8, la fenêtre se met en plein écran.
Explication du Script 2: Lorsque la fenetre M-Drive(NNDXG20-WIN) est détécté, Un appuie sur F8 est fait.

Comme vous l'aurait compris mon but et de faire en sorte que l'appuie sur F8 soit automatique quand je lance mon jeu pour qu'il se mette en fullscreen.

Merci


Script  1 Fullscreen lorsque l'on appui sur "F8":

Code: Select all

#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, Appuie sur F8 quand la fenetre M-Drive(NNDXG20-WIN) est detecté

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.


#SingleInstance force
Loop
while WinExist("M-Drive(NNDXG20-WIN)")
{
Send, {F8}
ExitApp
}
User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Script fullscreen

04 Oct 2019, 09:28

Essaye ça ? :think:

Code: Select all

; Changelog
; -------------------------------------------------------------
; 2019-10-04 - Script edited by joedf to help Trymado

#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

;/////////////////////////////////////////////////////////////////////////
;////////////////////////////// Main Thread //////////////////////////////
;/////////////////////////////////////////////////////////////////////////

SetTimer, CheckforWindowPressF8, 50 ;ms

F8::ToggleFakeFullscreen()
Escape::ExitApp

;/////////////////////////////////////////////////////////////////////////
;///////////////////////////////// Labels ////////////////////////////////
;/////////////////////////////////////////////////////////////////////////

CheckforWindowPressF8:
	if (WinExist("M-Drive(NNDXG20-WIN)")) {
		Send, {F8}
		SetTimer, %A_ThisLabel%, off
	}
return

;/////////////////////////////////////////////////////////////////////////
;/////////////////////////////// Functions ///////////////////////////////
;/////////////////////////////////////////////////////////////////////////

;;; 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)
}
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Trymado
Posts: 24
Joined: 04 Oct 2019, 02:30

Re: Script fullscreen

04 Oct 2019, 14:20

Merci pour l'aide l'ami, j'ai une fenetre de plantage au lancement du jeu et le jeu reste en fenetré.
Si tu veux test toi même, utilise n'importe quel jeu en mode fenetré et modifie le nom de sa fenetre.
User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Script fullscreen

04 Oct 2019, 15:37

donc si je comprends bien, tu veux rendre le jeu en plein écran?
y'a pas une option dans le jeu? :crazy: :?:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Trymado
Posts: 24
Joined: 04 Oct 2019, 02:30

Re: Script fullscreen

04 Oct 2019, 17:51

Ce sont des dump/copie de jeux d'arcade pur que tu trouverai en salle.
L'adapté à l'architecture PC Windows se fait mais avec certains problemes difficilements réglables dont celui ci, un jeu qui d'origine est fait pour tourner en 1024x600 sur une architecture spécifique à la borne et pas sur nos écran 1080p sous Win10 ;)

Le soucis ne se pose pas sur des jeux developpé d'origine pour pc.
User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Script fullscreen

05 Oct 2019, 14:00

Ah okok :D
Est ce que t'a un exemple de jeu pour un meilleur contexte?
Est-ce qu'il s'agit d'un emulateur d'arcade? MAME?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Trymado
Posts: 24
Joined: 04 Oct 2019, 02:30

Re: Script fullscreen

09 Oct 2019, 00:56

Sur un loader comme Teknoparrot par exemple qui est specialisé dans le lancement de dump avec la plupart du temps des soucis dont celui ci ^^

Exemple dans la video
https youtu.be /wNChL4CLULs Broken Link for safety

Return to “J'ai besoin d'aide”

Who is online

Users browsing this forum: No registered users and 74 guests