True windowed fullscreen (autohotkey script included)

General discussions about the games by Egosoft including X-BTF, XT, X², X³: Reunion, X³: Terran Conflict and X³: Albion Prelude.

Moderator: Moderators for English X Forum

slomer
Posts: 13
Joined: Mon, 13. Aug 12, 02:05

True windowed fullscreen (autohotkey script included)

Post by slomer » Mon, 13. Aug 12, 02:12

Hello all. I have been reading these forums as I learn to play X3:TC and although the game is about as wonky as they come I am addicted. I prefer to play my games in windowed full screen and although windowed mode is an option it doesn't quite work right on my Win 7 x64 setup. It has a title bar that it moves off screen and since it doesn't extend to the bottom it doesn't cover the taskbar. Full screen alt tabs poorly. So to fix this.. here is an autohotkey script. If you aren't familiar with autohotkey I highly recommend the program. Running this script you simply hit f12 while in the X3 game running in it's wonky windowed mode and it should then work the way you would expect a fullscreen windowed game to work. If you hit f12 again it will return to wonky window mode. (note sure why you would want to but there ya go).

Code: Select all

F12::
WinGet, TempWindowID, ID, A
If (WindowID != TempWindowID)
{
  WindowID:=TempWindowID
  WindowState:=0
}
If (WindowState != 1)
{
  WinGetPos, WinPosX, WinPosY, WindowWidth, WindowHeight, ahk_id %WindowID%
  WinSet, Style, ^0xC00000, ahk_id %WindowID%
  WinMove, ahk_id %WindowID%, , 0, 0, ScreenWidth, ScreenHeight
}
Else
{
  WinSet, Style, ^0xC00000, ahk_id %WindowID%
  WinMove, ahk_id %WindowID%, , WinPosX, WinPosY, WindowWidth, WindowHeight
}
WindowState:=!WindowState
return
Update: While the above code will work regardless of your resolution it appears autohotkey may have a hard time setting the correct screenHeight so if you know what resolution you will be running it is more reliable to hardcode those numbers. This will avoid issues such as the subtitles being cut short or line doubling making text a bit ugly due to it setting the window slightly bigger than your actual resolution.

For example, I run 1920x1080 as my resolution so...
instead of:

Code: Select all

WinMove, ahk_id %WindowID%, , 0, 0, ScreenWidth, ScreenHeight
I now use:

Code: Select all

WinMove, ahk_id %WindowID%, , 0, 0, 1920, 1080
resulting in this:

Code: Select all

F12::
WinGet, TempWindowID, ID, A
If (WindowID != TempWindowID)
{
  WindowID:=TempWindowID
  WindowState:=0
}
If (WindowState != 1)
{
  WinGetPos, WinPosX, WinPosY, WindowWidth, WindowHeight, ahk_id %WindowID%
  WinSet, Style, ^0xC00000, ahk_id %WindowID%
  WinMove, ahk_id %WindowID%, , 0, 0,1920, 1080
}
Else
{
  WinSet, Style, ^0xC00000, ahk_id %WindowID%
  WinMove, ahk_id %WindowID%, , WinPosX, WinPosY, WindowWidth, WindowHeight
}
WindowState:=!WindowState
return
Last edited by slomer on Sun, 19. Aug 12, 19:46, edited 4 times in total.

Solomon Short
Posts: 706
Joined: Wed, 25. Mar 09, 08:00
xr

Post by Solomon Short » Mon, 13. Aug 12, 02:29

I was able to live with the extraneous desktop space below the window on XP, so what I'm wondering is if this fixes the missing lines issue on Win7?

If so I'll have to look into getting AHK.

Edit:
To answer my own question, it does fix my issue with the window height being compressed by the border & thus losing lines from the game display (making menus ugly & being a general irritant).

Thank you, your fix is much appreciated.
Last edited by Solomon Short on Mon, 13. Aug 12, 04:00, edited 1 time in total.

User avatar
StarSword
Posts: 2745
Joined: Fri, 31. Dec 10, 03:04
x3tc

Post by StarSword » Mon, 13. Aug 12, 02:36

I think this belongs in the scripts and mods forum.
TC unless otherwise specified. | Find me on Steam! | My X3TC Links | X and X Rebirth @ TVTropes

slomer
Posts: 13
Joined: Mon, 13. Aug 12, 02:05

Post by slomer » Mon, 13. Aug 12, 03:08

StarSword wrote:I think this belongs in the scripts and mods forum.
Well, it technically isn't a script or a mod for the game but if the moderators feel it is better placed there I am fine with that. I looked around to find an existing solution to this issue and all I found were some old posts with people asking for a solution and not finding one so I figured I'd share what I came up with instead.

Coreblimey
Posts: 1161
Joined: Wed, 25. Aug 10, 17:48
x3tc

Post by Coreblimey » Mon, 13. Aug 12, 03:40

Actually, if it belongs anywhere, it is the Tech & Support Forum where people who are having issues with windowed mode can read it.

But the final decision is a Moderator's, so I think it's best left at that. :)
If it doesn't work, give it a kick. If that doesn't fix it hit it with a hammer. If it still doesn't work, USE A BIGGER HAMMER!!!

Unknown Sector..... That's what you get for using Bing instead of Google!

slomer
Posts: 13
Joined: Mon, 13. Aug 12, 02:05

Post by slomer » Mon, 13. Aug 12, 06:11

@Solomon Short.. Happy to help

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 21991
Joined: Fri, 16. Apr 04, 19:21
x4

Post by Alan Phipps » Mon, 13. Aug 12, 13:21

I think this is probably generic code for use with any window-enabled X-game so far and so is probably best left here for now.

I also think that if this leaves the game vanilla (which it obviously does) and has no untoward effects (to be tested by users) then it would merit being offered as a linked entry in the appropriate Resources and Guides Sticky listing.
A dog has a master; a cat has domestic staff.

slomer
Posts: 13
Joined: Mon, 13. Aug 12, 02:05

Post by slomer » Mon, 13. Aug 12, 20:06

Alan Phipps wrote:I think this is probably generic code for use with any window-enabled X-game so far and so is probably best left here for now.

I also think that if this leaves the game vanilla (which it obviously does) and has no untoward effects (to be tested by users) then it would merit being offered as a linked entry in the appropriate Resources and Guides Sticky listing.
I left it generic specifically for that reason. It can be made to work automatically with specific games instead of needing the hotkey but then if a class id is changed or a new game launches it would need to be maintained. The way it is written it should work with any resolution, version of windows, and windowed X game without worrying about going out of date. The only downside to this version is that you can only adjust one game window at a time. Unless you are super hardcore and plan to run multiple copies of X games at the same time that shouldn't matter much.

User avatar
Axeface
Posts: 1903
Joined: Fri, 18. Nov 05, 01:41
x4

Post by Axeface » Mon, 13. Aug 12, 22:06

Brilliant! I've wanted one of these for x for ages, thanks!

slomer
Posts: 13
Joined: Mon, 13. Aug 12, 02:05

Post by slomer » Tue, 14. Aug 12, 02:20

Axeface wrote:Brilliant! I've wanted one of these for x for ages, thanks!
You are welcome. As much help as these forums have been, and as fun as it has been to read some of the stories (especially SLUG's DiDs) I am glad to help a few people in return.

slomer
Posts: 13
Joined: Mon, 13. Aug 12, 02:05

Update

Post by slomer » Sat, 18. Aug 12, 05:03

I realized after playing a while that this was cutting off about 5 pixels at the bottom of my screen and making subtitles harder to see. For some reason on my windows 7 x64 box autohotkey isn't setting screenHeight correctly to 1080. It looks like if you know what resolution you will be running it is more reliable to manually set the width and height.

For example:

Instead of:

Code: Select all

WinMove, ahk_id %WindowID%, , 0, 0, ScreenWidth, ScreenHeight 
I now use:

Code: Select all

WinMove, ahk_id %WindowID%, , 0, 0, 1920, 1080
I will update the original post as well.[/code]

User avatar
Da_Junka
Posts: 991
Joined: Sat, 15. Mar 03, 21:40
x3tc

Post by Da_Junka » Sat, 18. Aug 12, 07:19

I'm not accustomed to scripts, how do you make this work?
~Intel i5 2500K ~ Nvidia GTX 670 ~ Z77 chipset ~ 16 gig Vengence ~Win 7 64bit ~

Coreblimey
Posts: 1161
Joined: Wed, 25. Aug 10, 17:48
x3tc

Post by Coreblimey » Sat, 18. Aug 12, 07:45

Just copy the script to a text file and give it a name that you can remember. Change the '.txt' suffix of the file to '.ahk' (without the single quotes). This will associate the file to AutoHotKey. Double click on the file. This will start AHK which will run the script automatically. Start your game in windowed mode and then just press 'F12' and the window will be adjusted. :)
If it doesn't work, give it a kick. If that doesn't fix it hit it with a hammer. If it still doesn't work, USE A BIGGER HAMMER!!!

Unknown Sector..... That's what you get for using Bing instead of Google!

Solomon Short
Posts: 706
Joined: Wed, 25. Mar 09, 08:00
xr

Post by Solomon Short » Sat, 18. Aug 12, 07:57

Edit: Ninja'd, but I'll leave my version here anyway

It's a script for an external macroing utility known as Autohotkey.

After you install that, your right-click/context menu in Windows Explorer should have a new entry "AutoHotKey Script" under "New" when right-clicking on empty-space on the desktop or in a folder.

You want to right-click on the newly created script & select "Edit Script", then copy & paste the text from inside the last "Code" box in the OP into it.

Then if you run the script whenever you play an X3 (or any other game where maximising the window in this way needs to be done), hitting [F12] will toggle between maximised & non-maximised.

I would note that the 1st line "F12::" is the one specifying use of [F12], so if like me you use it in the game (I have save & load on it), you need to edit that line (I changed it "AppsKey & NumPadSub::" for my own use, the AutoHotKey help docs were actually useful).

User avatar
Da_Junka
Posts: 991
Joined: Sat, 15. Mar 03, 21:40
x3tc

Post by Da_Junka » Sat, 18. Aug 12, 08:58

Nice one. Thanks guys. :)
~Intel i5 2500K ~ Nvidia GTX 670 ~ Z77 chipset ~ 16 gig Vengence ~Win 7 64bit ~

Post Reply

Return to “X Trilogy Universe”