Page 1 of 2

True windowed fullscreen (autohotkey script included)

Posted: Mon, 13. Aug 12, 02:12
by slomer
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

Posted: Mon, 13. Aug 12, 02:29
by Solomon Short
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.

Posted: Mon, 13. Aug 12, 02:36
by StarSword
I think this belongs in the scripts and mods forum.

Posted: Mon, 13. Aug 12, 03:08
by slomer
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.

Posted: Mon, 13. Aug 12, 03:40
by Coreblimey
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. :)

Posted: Mon, 13. Aug 12, 06:11
by slomer
@Solomon Short.. Happy to help

Posted: Mon, 13. Aug 12, 13:21
by Alan Phipps
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.

Posted: Mon, 13. Aug 12, 20:06
by slomer
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.

Posted: Mon, 13. Aug 12, 22:06
by Axeface
Brilliant! I've wanted one of these for x for ages, thanks!

Posted: Tue, 14. Aug 12, 02:20
by slomer
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.

Update

Posted: Sat, 18. Aug 12, 05:03
by slomer
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]

Posted: Sat, 18. Aug 12, 07:19
by Da_Junka
I'm not accustomed to scripts, how do you make this work?

Posted: Sat, 18. Aug 12, 07:45
by Coreblimey
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. :)

Posted: Sat, 18. Aug 12, 07:57
by Solomon Short
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).

Posted: Sat, 18. Aug 12, 08:58
by Da_Junka
Nice one. Thanks guys. :)

Posted: Sat, 18. Aug 12, 09:16
by Lazerius
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 guess I've played too many other games, especially MMO's, cause when I saw this, my eyes said :o

The thought of 3rd party programs being allowed to alter game functions (regardless of in game or not) is just.....well..... this says it all: :o

I would have expected this at minimum in tech support, if not s/m :)



But then, I'm a 5th of Bacardi in, so I'm not gonna question it. :lol:

Posted: Sat, 18. Aug 12, 13:28
by Alan Phipps
@ Lazerius: It is not altering a game function. It is altering the size/position of a display of a window by the OS and which happens to resolve a display issue seen by some when playing any X game in a window. Yes it could go in Tech Sp/S&M (where few vanilla players would see it) but it would have to be spread over Tech Sp or S&M forums for all X games and there would be no consistency in comments, tweaks or bug-reports as a result.

It is no more a game mod than say mrbadger's savegame manager written in Java and so needing Java to be installed.

Posted: Sat, 18. Aug 12, 13:47
by Coreblimey
Alan Phipps wrote:Yes it could go in Tech Sp/S&M (where few vanilla players would see it) but it would have to be spread over Tech Sp or S&M forums for all X games and there would be no consistency in comments, tweaks or bug-reports as a result.
I never thought of that. That's probably why you're a Moderator and I'm not. :)

Posted: Sat, 18. Aug 12, 19:22
by slomer
Da_Junka wrote:Nice one. Thanks guys. :)
I am glad it is helpful and that people were nice enough to answer your question. Autohotkey is a great tool, especially as a gamer as it can often be user to overcome shortcomings. I used it to add autorun and always on tab info for DAO:2 for example.

Posted: Sun, 19. Aug 12, 01:52
by Solomon Short
I'm thinking if/when I go back to TC I'll need to find out how to put multiple discrete hotkeys/scripts in one file so I can automate the various stages of equipping & assigning my various fleets of Mobile Miners (& a few other things, I'll need multiple functions in one file 'cos I really don't see a need for 20-30 extra & identical icons on the notification area).