AutoCAD font overrides

Here is how to properly override (replace) font’s globally in Autodesk AutoCAD.

Why replace?

Unicode fonts

Depending on your version of AutoCAD the nordic characters for ÅÄÖÆØ might not be working properly. This is usually caused by different versions of the same font’s. For some reason it seems, the characters ÅÄÖÆØ were removed from iso.shx

Fortunately they’re still available in isocp.shx and it’s perfectly fine to replace each font one by one in every drawing. This gets tedious though if you have hundreds of drawings to plot.

Better performance

Another reason might be to get rid of demanding true type fonts commonly used in drawings. If someone uses advanced font’s in drawings this will use up a lot more graphics memory slowing down performance.

demanding fonts

How to replace

Start by locating the file acad.fmp in your AutoCAD support folder. Depending on your version and the user account in Windows this will be stored in different paths.

acad_fmp_path

To quickly find your windows account profile folder you can copy and paste this into the explorer address bar and press enter:

%appdata%\Autodesk\

Check the year release version of Autocad you have installed. Is it 2010, 2014, 2016 or some other year? If you’ve got an AutoCAD subscription you might have several versions installed. If you have 2016 you can copy and paste this into the explorer address bar and press enter:

%appdata%\Autodesk\AutoCAD 2016\R20.1\enu\Support

If you’re hopelessly lost attempting to locate this folder you can use a shortcut built into AutoCAD by clicking File -> Plot Style Manager. This will open the adjacent path where your plot styles are stored.

plot style path

Editing acad.fmp

Before proceeding, once you’ve located acad.fmp make a backup copy of it, just in case. Call it Copy of acad.fmp or something similar.

Open it using Notepad or any other plain text editor. (Not Microsoft Word). Once open it should look something like this:

acad.fmpACAD2016 original: acad.fmp (mirror)

Each new line in this file means one font replacement operation. The syntax for instructing which font to replace is separated by a semicolon ;

The original source font;The font which to replace it with

For example if we want to replace iso with isocp we add the following line. (This is the workaround for nordic characters to work.)

iso;isocp.shx

acad.fmp_edit Edited: acad.fmp (mirror)

For this to have any effect you need to restart AutoCAD completely. All done!

Resource intensive fonts

Consider adding more resource intensive fonts.

And don’t forget the pesky Comic Sans MS! We don’t want that in our drawings do we? 😉

acad.fmp_edit2 Edited 2: acad.fmp (mirror)

End notes

Please keep in mind that replacing font’s will cause external references XREF fonts to change as well. This will cause formatting issues, especially if the new font is larger than the original.

This is important to note in case something goes wrong and you’ve been accidentally messing with someone else’s drawing. To avoid this then restore the original acad.fmp file and restart AutoCAD before plotting.

Advertisements

Add scaled timestamps to photos using ImageMagick

Here is one way to add timestamps quickly to lots of photos using open source tools and a script.

The image editing is done using ImageMagick  convert.exe and identify.exe

ImageMagick is a free to use open source collection of command line tools for image editing, identifying, manipulation and much more.

stamp

This script will go through all JPG, JPEG, GIF and PNG files inside the current folder, make copies of them in a separate folder and add date and time saved (burned) into the image. The operation is lossy hence it only modifies copies of the files. Date and time is retrieved from the metadata tag Exif.Image.DateTimeOriginal. If the images lack this tag they will be stamped “No timestamp”.

The timestamp font size and placement on the photo will scale in percentage according to the width and resolution of the photo.

If you want to change colors or such you will need to edit the script manually. Here are some examples of photos I’ve taken with added timestamps:

If these kind of timestamps are good enough for you, you’ve found the right post!

Instructions

timestamp

Option a) – quick

1. Download the script (mirror) together with portable ImageMagick convert.exe and identify.exe
MD5: a5363bef4aafbe979dcac875f7f2e263

2. Extract all files in the folder where you keep the images that you wish to add timestamps to

3. Double click on add timestamps.bat to start the process.

A black window should pop up showing the image conversion process in ImageMagick.

timestamp

4. When done you should see a folder named stamped with copies of the files with added timestamps!

Option b) – manual

1. Download ImageMagick from the windows portable edition here and place convert.exe and identify.exe in the same directory where you place the script. Alternately you can use the files supplied in the download above.

2. Copy and paste the code from below into your favorite plain text editor like notepad, notepad2 or notepad++

3. Save it with whichever name you prefer as long as you end the name with the file extension .bat for example add timestamps.bat

4. Double click on the bat file to start the process!

Batch script to copy and paste

@echo off & cls
rem enable variables referencing themselves inside loops
SetLocal EnableDelayedExpansion

rem optional settings
set fontcolor=#FFD800
set fontoutlinecolor=#000000
set fontstyle="Arial-Bold"

rem create a new folder where the stamped images will be placed
mkdir stamped

rem loop through all jpg png jpeg and gif files in the current folder
for /f "delims=" %%a in ('dir /b /A:-D /T:C "%cd%\*.jpg" "%cd%\*.png" "%cd%\*.jpeg" "%cd%\*.gif"') do (
	rem retrieve image date and time
	SetLocal EnableDelayedExpansion
	for /f "tokens=1-2" %%i in ('identify.exe -ping -format "%%w %%h" "%cd%\%%a"') do set W=%%i& set H=%%j

	rem retrieve image timestamp to perform size and distance calculations on
	SetLocal EnableDelayedExpansion
	for /f "tokens=1-2 delims=" %%k in ('identify -format "%%[EXIF:DateTimeOriginal]" "%cd%\%%a"') do set timestamp=%%k
	
	rem set timestamp to no timestamp if there is no timestamp
	if "!timestamp!" == "" (
		set timestamp=No timestamp
	)
	
	rem print some information about the process
	echo %%a is !W! x !H! stamp !timestamp! ...

	rem set timestamp size to a fourth of the screen width
	set /A timestampsize = !W! / 3

	rem set timestamp offset distance from side of the screen
	set /A timestampoffset = !W! / 20

	rem set timestamp outline relative size
	set /A outlinewidth = !W! / 600

	rem echo !timestampsize! !timestampoffset!
	
	rem create a custom image with the timestamp with transparent background and combine it with the image
	convert.exe ^
	-verbose ^
	-background none^
	-stroke !fontoutlinecolor! ^
	-strokewidth !outlinewidth! ^
	-font !fontstyle! ^
	-fill !fontcolor! ^
	-size !timestampsize!x ^
	-gravity center label:"!timestamp!" "%cd%\%%a" +swap ^
	-gravity southeast ^
	-geometry +!timestampoffset!+!timestampoffset! ^
	-stroke !fontoutlinecolor! ^
	-strokewidth !outlinewidth! ^
	-composite "%cd%\stamped\%%a"

	endlocal
	endlocal
	echo.
)
endlocal
echo Complete!
pause

More info

I also wrote a VBScript version of this operation as well but It would have a lot of black windows popping up being quite annoying.

Unfortunately hiding windows gets trickier when using VBScript when you also need to retrieve the return value from command line utilities.

If you want to check out the vbscript anyway you can still get it here (mirror) (git)


Bypassing European ‘Right to be forgotten’ censorship of Google

Update 2016: Using google.com/ncr to bypass the filter no longer works. Google now censors EU results if you’re in the EU ISP IP range. You have to use a US proxy.

This post is not related to any software but rather in opposition of censorship.

Problem

If you’re in the EU and searching using Google you may have encountered this notice at the bottom of some pages:

censorship

If you did not know there is a European Union law that allows people the “Right to be forgotten” which specifically applies to Google search.

While it may sound like a good idea in some regards, like perhaps false accusations; in practice it forces search providers to act as judges for what is appropriate.

This can have the exact opposite effect for actual perpetrators which makes this legislation really flawed.

Workaround

There are many ways to bypass such filters, one of them by using another search engine or any kind of vpn or proxy server. There is also a hidden option in Google:

http://www.google.com/ncr

The abbreviation NCR stands for – no country redirect.
This option will return US search results.

More information

I won’t go into this into this law in any more detail but feel free to read more about the “Right to be forgotten” and controversy related to it here:


HTML image gallery generator using VBScript and ImageMagick

Update 2015-06-11: Added msdos short paths to (hopefully) avoid unicode character errors

This VBScript will create a very basic HTML image gallery of all image files placed in the same directory as the script.

It generates thumbnails using ImageMagick and links to the original images.

ImageMagick is a free to use open source collection of command line tools for image editing, identifying, manipulation and much more.

Result

htmlgallery

Instructions

Option a) – quick

gallery script

1. Download the script (mirror) together with portable ImageMagick mogrify.exe in this zip file.
MD5: 704945e2e269aa222ea321a9eff0871f
(github)

2. Extract both files in the same folder where you keep the images that you wish to use in your gallery

3. Double click on CreateHTMLImageGallery.vbs to start the procedure.

A black window should pop up showing the image conversion process in ImageMagick. The window will close when the thumbnails have been created and a preview window will open in your browser.

cmdwindow

4. When done you should see a folder named thumbs with low resolution copies (thumbnails) of your images inside it.

Option b) – manual

1. Download ImageMagick from the windows portable edition here and place mogrify.exe in the same directory where you place the script. Alternately you can use the file supplied in the download above.

2. Copy and paste the code from below into your favorite plain text editor like notepad, notepad2 or notepad++

3. Save it with whichever name you prefer as long as you end the name with the file extension .vbs for example CreateHTMLImageGallery.vbs.

4. Double click on the script to start the process!

 VBScript to copy and paste

 

'Simple html gallery maker using ImageMagic mogrify.exe
'Written by Nicklas H https://nirklars.wordpress.com

'Updated 2015-06-11

'---DECLARATIONS SECTION---

Set args = Wscript.Arguments
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SHELL = CreateObject("WScript.Shell")

'Get proper current directory
SHELL.CurrentDirectory = FSO.GetParentFolderName(Wscript.ScriptFullName) 
'Declare folder to check files in
Set objFolder = FSO.GetFolder(SHELL.CurrentDirectory)
Set colFiles = objFolder.Files

'Declare global variables
Dim OutputFile 
Dim OutputFileContent
Dim FirstLineCheck

'You can change this to gallery.html or whatever you wish
OutputFile = SHELL.CurrentDirectory & "\index.htm"
'Change this if you want another thumbnail size or quality
ImageMagicArguments = "-thumbnail 200x -quality 65 -verbose"

'---PROGRAM SECTION---

'Check if a gallery already exists, if so then delete if
DelFile(OutputFile)

'Regular html gallery code stuff, this is just an example
W("<html>")
W("	<head>")
W("	<title>Image Gallery</title>")
W("		<style>  ")
W("		a:link")
W("		{")
W("			text-decoration: none;")
W("			color: black;")
W("		}")
W("		a:visited")
W("		{")
W("			color: black;")
W("		}")
W("		a:hover")
W("		{")
W("			color: red;")
W("		}")
W("		img ")
W("		{")
W("			border-style: solid;")
W("			border-width: 2px;")
W("			margin: 2px;")
W("			padding: 0px;")
W("			}")
W("		</style>")
W("	</head>")
W("	<body>")

' Breakdown of the <img> tag to be pieced together in the loop
ImagePart1 = "		<a href='"
ImagePart2 = "'><img src='thumbs/"
ImagePart3 = "'></a>"

' Go through every file in the folder and create the <img> tag and stuff
For Each objFile in colFiles
	complies = false
	
	'check file extensions
	if InStr(objFile.Name,".jpg") > 0 then 
		complies = true
	elseif InStr(objFile.Name,".png") > 0 then 
		complies = true
	elseif InStr(objFile.Name,".jpeg") > 0 then 
		complies = true
	elseif InStr(objFile.Name,".gif") > 0 then 
		complies = true
	else
		'skip
	end if
	
	if complies = true then
		W(ImagePart1 & objFile.Name & ImagePart2 & objFile.Name & ImagePart3)
	end if
	
Next

'Final part of the html code
W("	</body>")
W("</html>")

'Write the file at once to save disk access times
SaveFile()

'Check if imagemagick is there
if FSO.FileExists(SHELL.CurrentDirectory & "\mogrify.exe") then
	'Create folder and launch imagemagick
	MkDir(SHELL.CurrentDirectory & "\thumbs")
	command = Quote(SHELL.CurrentDirectory & "\mogrify.exe") & " -path " & Quote(ShortPath(SHELL.CurrentDirectory) & "\thumbs") & " " & ImageMagicArguments & " " & Quote("*")
	'start imagemagick
	SHELL.run command, 1, true
	'open the gallery in your browser
	SHELL.run Quote(OutputFile), 1, true
else
	msgbox "Unable to create thumbnail images. Please put ImageMagick mogrify.exe in the script folder and retry!"
end if

'---FUNCTIONS SECTION---

'Function to get short msdos path to work with unicode folder names
function ShortPath(myPath)
	ShortPath = FSO.GetFolder(myPath).ShortPath
end function

'Function to put quotation marks around paths
function Quote(this)
  Quote = Chr(34) & this & Chr(34)
end function

'Write a new line in the output file
Function W(strLine)
	'Skip line break on the first entry
	if FirstLineCheck = false then
		OutputFileContent = strLine
		FirstLineCheck = true
	else
		OutputFileContent = OutputFileContent & vbNewLine & strLine
	end if
End Function

'Save the output file
Function SaveFile()
    Set stream = FSO.OpenTextFile(OutputFile, 2, True)
    stream.write OutputFileContent
    stream.close
	OutputFileContent = "" 'Clear memory
End Function

'Create folder until success
function MkDir(myFolder)
	do
		'Fix env strings
		myFolder = translateEnvStr(myFolder)
		
		Err.Clear
		On Error Resume Next
		if FSO.FolderExists(myFolder) = true then 
			exit do
		else
			FSO.CreateFolder(myFolder)
			if ErrorMessage() = false then
				exit do
			end if
		end if
		WScript.Sleep 1000
	loop
end function

'Delete a file if it exists, wait if it doesnt work and retry
function DelFile(myFile)
	do
		'Fix env strings
		myFile = translateEnvStr(myFile)
		
		Err.Clear
		On Error Resume Next
		if FSO.FileExists(myFile) then
			FSO.DeleteFile(myFile)
			if ErrorMessage() = false then
				exit do
			end if
		else
			exit do
		end if
		WScript.Sleep 1000
	loop
end function

'Function that translates all EnvironmentStrings into real paths from inside a larger string. Lets call it strLargeEES.
function translateEnvStr(strLargeEES)
	'Count the number of % characters in the supplied string. This is done by removing all of the % from strLargeEES and subtract it from the original strLargeEES.
	intCharNum = Len(strLargeEES) - Len(Replace(strLargeEES, "%", ""))
	
	'Since there are two % signs for each EnvironmentString that means we divide the total number of EnvironmentStrings by...
	intExpandedStringsNum = intCharNum/2
	
	'Loop through all of the EnvironmentStrings. Because we need to translate each one separately.
	for i = 1 to intExpandedStringsNum
		'Cut out the part to the right of %
		strFirstCut = Right(strLargeEES,Len(strLargeEES)-InStr(strLargeEES,"%"))
		'Cut out the part to the left of %
		strSecondCut = Left(strFirstCut,InStr(strFirstCut,"%")-1)
		
		'The result from our cutting reveals the first EnvironmentString!
		result = "%" & strSecondCut & "%"
		'We translate this to the real folder by using a shell object
		translated = SHELL.ExpandEnvironmentStrings(result)
		
		'When we are done we replace the original EnvironmentString with the translated in strLargeEES
		strLargeEES = Replace(strLargeEES,result,translated)
	'Repeat
	next
	
	'When done return the whole translated string to the function call
	translateEnvStr = strLargeEES
end function

 


PDF to DWG using free open source Inkscape

inkscape-screenshotInkscape is a completely free open source program for drawing vector graphics and has a lot of nifty features, among them file format conversion.

This guide will go through the procedure to get those pesky PDF drawings into AutoCAD using Inkscape.

This tutorial is written in a easy to follow step by step instructional guide intended for everyone. (Hopefully) even computer novices.

There are some limitations to the act of converting PDF to DWG that should be noted beforehand:

  • PDF files are not as accurate as DWG and should not be considered to exact scale. Think of it almost as importing a paper drawing.
  • Not all features will be converted. Some color fills, raster graphics and custom objects may be lost in the conversion. (Or require more work)
  • You can only import 1 page at a time.
  • Conversions like this can be tricky and unfortunately some files don’t do very good.

In depth step by step guide

1. Figure out the paper size of your PDF file.

Start up Adobe Acrobat. Go to File -> Properties

1

In the Description tab you should see the page size. Depending on the program used to create the PDF file (in this case AutoCAD) it might not say the ISO standard page size. Take note of the page size. In this case 841 x 594 mm which is a A1 ISO standard page size.

2

2. Download and install Inkscape.

For most windows users that’s here https://inkscape.org/en/download/windows/

If you’re uncertain which version to get read here. Most probably you will want the 64 bit installer unless you’re on an old computer with less than 4GB of ram. Then get the 32 bit installer.

3. Start up Inkscape and set the correct paper size. When starting for the first time it should have opened an empty document with an A4 size paper.

Go to File -> Document properties. Find the size of your paper or manually enter the custom page size into the text boxes. Also select the orientation of the paper to be portrait or landscape.

4 5

This page can be a bit slow and unresponsive. If Inkscape freezes or stops responding it has not crashed, have patience and give it some time and it will come to.

5. Import the PDF document from File -> Import

A new dialog box should appear with settings. If you encounter problems repeat the previous steps and return to this step and retry it with different settings. After clicking OK Inkscape may appear to freeze depending on the size of the PDF file. Large A0 drawings can take 5 minutes… just saying 🙂 Again, patience is the key here.

3 6

6. Align the imported page by clicking and draging it to the center of the paper canvas. When you’re satisfied click outside the canvas to deselect the paper.

7

7. Go to File -> Save a copy. Locate the folder where you want to save the file and select Desktop Cutting Plotter (AutoCAD DXF R14) (*.dxf) from the drop down list below in the save dialog window.

8

8. Select the base units for the drawing. In the case of ISO standard A1 paper it should be millimeters (mm).

If you have problems with the importing process repeat all the previous steps and return to this dialog and try checking or unchecking the other options.

9

Click OK to start the process. Depending on the size of the drawing this could take a while.

9. Inspect the DXF file by opening it in AutoCAD.

You should now have a quite large DXF drawing file exported. DXF stores coordinates in plain text without any compression so a DXF file might take 30 times or more data space than a DWG. Keep this in mind and try to avoid storing DXF files (for the sake of hard drive space).

10. Carefully check the scale….. and any possible errors

Its very easy to accidentally mess up the scale while importing/exporting so make sure to properly measure and compare the scale in the output drawing. There will be some inaccuracies.

11. Correct the scale if necessary

One way to correct scale is to use scale by reference.

1. SCALE command
2. Specify base point
3. Type R to use scale by Reference
4. Specify reference length by start point and end point
5. Specify new length

scale by reference

11. Save the DXF file as a DWG file.

Congratulations! You should now be done!

If you have errors opening the file try repeating the procedure with slightly different options where specified. You might also try the RECOVER or AUDIT command in Autocad. Keep in mind that errors probably mean that something was also lost in the procedure. Make sure to compare and figure out what it was.

I hope this was helpful! 🙂


Fallout 2 not responding in combat bug

fallout2notresponding

Description

Fallout 2 stops responding during combat and resumes at the end of the round. You may or may not have any unofficial patches installed and/or are running the game in windowed mode.

Background

If you’re attempting to play the classic Fallout 2 on Windows 7 or Windows 8 you will probably encounter the the bug above. This is not specifically a bug in Fallout 2 but rather a compatibility issue in recent Windows operating systems.

Before proceeding I highly recommend that you install one of either of killaps unofficial patches:

– Unofficial Fallout 2 patch by killap
– Fallout 2 Restoration Project by killap

It goes without saying but don’t install both! Choose one.

Save files might not work after installing the patch so make a backup of the whole Fallout folder before installing.

The unofficial patch fixes general bugs while the restoration project restores a lot (if not all) cut content and adds in a some extra mod content. I highly recommend the restoration project patch. It adds a lot of things to the game which enriches the experience, even for first time players.

Download killaps patches over at www.killap.net or the No Mutants Allowed forums.

Windows AppHangTimeout registry entry

Here is one way to fix this issue.

Please note that the following changes will affect all programs running on your operating system. This may cause issues for you but shouldn’t make much (if any) difference to the general user who knows how to use windows task manager to force terminate applications.

As always when editing the registry make a backup or create a system restore point in case you make any mistakes. (Mistakes can mess up your computer so do this at your own risk)

Option 1: Download and double click on any of the following registry patches

Right click the link and select save as. Make sure that the name (file extension) ends with .reg. Otherwise rename it.

a) 120 second delay before the “program not responding” pops up.
(this should be enough for most fights in Fallout 2)

b) 300 second delay if you intend to go rampage and battle entire cities, this 5 minute delay might be more for you

c) remove (uninstall) the registry entry to use windows default timeout

Option 2: Manually edit the registry

1. Open regedit.exe

2. Browse to HKEY_CURRENT_USER \ Control Panel \ Desktop

3. Check if there is an entry for HungAppTimeout

4. If there is a value then double click and edit this to the delay value you wish to have in milliseconds.

5. If there is no value right click and select New -> String value and name it exactly “HungAppTimeout” without the quotation marks.

6. Double click this and enter the delay value that you wish in milliseconds.

hungapptimeout2

 Notes or alternate fixes

If you for some reason absolutely cannot change this registry entry there is an option in Fallout 2 High Resolution Patch (f2_res) you can try.

The high resolution patch is included in both of killaps patches so I really recommend you install one of them! It makes the install procedure much easier for you.

1. Open up f2_res.ini in your Fallout 2 install path

2. Scroll down a bit until you find EXTRA_WIN_MSG_CHECKS=0

3. Change the 0 (zero) to 1 (one) so that it looks like this:

f2_res.ini

Fake windowed fullscreen

I just wanted to add this section here as well. As this game runs really well with the fallout 2 high resolution patch you might consider running an AutoHotkey script to toggle fake fullscreen. Fake fullscreen is also built into my application XBoxMouse and works even if you don’t have any controller plugged in. You need to enable it by editing the line WindowedFullscreen=1 in the ini file however.

Optional pre compiled script

Download and run the compiled script here (mirror).
MD5 checksum: 99882c79d419503604a52c74cd785cc3

Please note!
You probably have set this program to run as an administrator in the compatibility tab!

Hold down CONTROL and ALT and press F12 to toggle fake fullscreen!

Run the script manually

1. Download and install AutoHotkey

2. Option: Download the script (mirror) and double click it (right click and select save as)

3. Copy and paste the following script into notepad your plain text editor of choice (notepad2 or notepad++)

4. Save the file as whatever you wish as long as it ends with the file extension .ahk

5. Double click the ahk file to have it run in the background. Hold down CONTROL and ALT and press F12 to toggle fake fullscreen on the window you currently have focused.

Script to copy and paste

;Toggle fake windowed fullscreen!
;https://nirklars.wordpress.com

#singleinstance force

!^F12::
	WinGet, WindowID, ID, A
	WinGet Style, Style, ahk_id %WindowID% ; retrieve window data

	if (Style &amp;amp; 0xC40000) ; check if object is available
	{
		WinSet Style, -0xC40000, ahk_id %WindowID% ; hide thickframe/sizebox
		WinSet Style, -0xC00000, ahk_id %WindowID% ; hide title bar
		WinSet Style, -0x800000, ahk_id %WindowID% ; hide thin-line border
		WinSet Style, -0x400000, ahk_id %WindowID% ; hide dialog frame
	}
	else
	{
		WinSet Style, +0xC40000, ahk_id %WindowID% ; show thickframe/sizebox
		WinSet Style, +0xC00000, ahk_id %WindowID% ; show title bar
		WinSet Style, +0x800000, ahk_id %WindowID% ; show thin-line border
		WinSet Style, +0x400000, ahk_id %WindowID% ; show dialog frame
	}

	WinMove, ahk_id %WindowID%, , 0, 0, A_ScreenWidth, A_ScreenHeight

return

Hope this helps 🙂
Happy retro gaming!
Best Regards


Baldur’s Gate II widescreen scaling bug

Here is a unique issue for you… with an odd workaround solution. To sum it up its a script that “works around” improper scaling resulting in black bars when you have dual graphics cards and nothing else appears to work.

Problem description – black bars in fullscreen

When running Baldur’s Gate II in fullscreen with the widescreen mod installed and set to 1280×720 you see black bars surrounding the game window.

Before trying the hacky script make sure that you have explored all your control panel graphics options. If you see black bars on your desktop check these Intel options first before proceeding.

bg2wrongscale

Background

My laptop has two graphics cards. One integrated Intel HD and an NVidia 840M. This is quite an ingenious solution to minimize power consumption. The Intel HD works as a low power accelerator for desktop and minor applications with the Nvidia card kicking in as a “turbo” when 3D applications like games are launched.

Unfortunately this rather unique solution can cause driver compatibility issues, as someone searching the internet will find out. One reason being that the drivers supplied by Nvidia are trimmed and lacking the much needed display options.

The fact that Intel doesn’t supply regular updates to their drivers doesn’t help much. They point toward the laptop manufacturer which only supply old drivers.

intel graphics darn

 The solution that should work, try this first

With regular graphics card configurations the NVidia control panel should have the following scaling options available. Unfortunately for me these options are not there. If you have them, then you’re lucky. Change the scaling to full-screen and the borders should be gone.

nvidiascaling

At first glance one might think that Intel lacks these scaling options completely, however this is not true. The scaling options are hidden inside Intel HD graphics control panel.

To show the options you cannot have your desktop resolution set to your monitor native (max) resolution. (which is usually 1920 x 1080 for most monitors) As soon as you change this to something lower, say something like 1024 x 768 temporarily. The option will magically appear at the screen below.

Again, unfortunately for me, this did not fix my issue with Baldur’s Gate.

intel graphics custom aspect scaling

That didn’t work, what now?

The workaround to this problem is a somewhat clumsy AutoHotkey script that switches the desktop resolution temporarily and forcefully stretches the game window to fit the size of your desktop resolution.

Considering the limitations of this workaround it will not work if you’re already seeing black bars when lowering your resolution in desktop. If that is your case, sorry. You’re situation is even more complicated than mine 🙂

This of course assumes that when you installed the Baldurs Gate II widescreen patch you set the resolution to 1280 x 720. While installing it should have looked like this:

widescreenmod_resolution

If you have any more graphics related mods installed the situation may be different.

Instructions for the workaround

Optional Pre compiled script

This will only work if you have configured the widescreen patch to run at resolution 1280×720!

1. Download the compiled script from here (mirror)
MD5 checksum: 998df07f0078cadc684dcf0484e17c6e

Please note!
You probably have set this program to run as an administrator in the compatibility tab!

2. Place it in the directory where you have installed Baldurs Gate

3. Run BGMainNoBorders.exe and it will attempt to launch the game without borders.

Run the script manually

If you’ve set the widescreen resolution patch to anything other than 1280×720 you need to edit the script and run it manually.

1. Download and install Autohotkey

2. Copy and paste the following script below into notepad or any other plain text editor like notepad2 or notepad++.

3. Save the file as BGmainNoBorders.ahk or any other name you prefer as long as you end with the file extension .ahk and save it into your BG2 install folder.

You can also download it directly from here (mirror) (right click and select save as)
(GitHub)

4. Edit the script where it says ChangeResolution(1280,720) to whichever is the resolution you’ve set the widescreen patch to run in.

For example if you have set the widescreen patch to run at 1600×900 you need to change this to ChangeResolution(1600,900)

5. Double click BGmainNoBorders.ahk to start the game!

Script to copy and paste

#singleinstance force ; prevent multiple instances

; increase this if you have a very slow computer to 1500 or 2000
sleepdelay := 1000

; Check and remember current resolution
x = %A_ScreenWidth%
y = %A_ScreenHeight%

run bgmain.exe ; start baldurs gate

sleep %sleepdelay% ; wait milliseconds

; old method of changing resolution
;run qres /x 1280 /y 720 

; change resolution temporarily
ChangeResolution(1280,720)

sleep %sleepdelay% ; wait milliseconds

WinActivate ahk_class ChitinClass ; focus on baldurs gate

sleep %sleepdelay% ; wait milliseconds

SetFakeFullscreen()

WinWaitClose ahk_class ChitinClass ; wait for baldurs gate to close

; old method of changing resolution
;run qres /x %x% /y %y%

; change back resolution
ChangeResolution(x,y)

sleep %sleepdelay%

ExitApp
return

;---Remapped keys 

; Swap arrow keys with WASD for panning
#IfWinActive ahk_class ChitinClass
a::left
left::a

; Swap arrow keys with WASD for panning
#IfWinActive ahk_class ChitinClass
d::right
right::d

; Swap arrow keys with WASD for panning
#IfWinActive ahk_class ChitinClass
w::up
up::w

; Swap arrow keys with WASD for panning
#IfWinActive ahk_class ChitinClass
s::down
down::s

; Select all party members using tilde
#IfWinActive ahk_class ChitinClass
SC029::SC00c
SC00c::SC029

;---Functions

SetFakeFullscreen()
{
	WinGet Style, Style, ahk_class ChitinClass ; retrieve window data
	WinSet Style, -0xC40000, ahk_class ChitinClass ; hide thickframe/sizebox
	WinSet Style, -0xC00000, ahk_class ChitinClass ; hide title bar
	WinSet Style, -0x800000, ahk_class ChitinClass ; hide thin-line border
	WinSet Style, -0x400000, ahk_class ChitinClass ; hide dialog frame
	WinMove, ahk_class ChitinClass, , 0, 0, A_ScreenWidth, A_ScreenHeight
}

ChangeResolution(w,h)
{
	VarSetCapacity(dM,156,0)
	NumPut(156,dM,36)
	NumPut(0x5c0000,dM,40)
	NumPut(w,dM,108)
	NumPut(h,dM,112)
	DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
}

Troubleshooting

If it doesn’t work try to change Baldur’s Gate to run in windowed mode in bgconfig. This should solve it but can cause issues when panning the overview map.

If it still doesn’t work try increasing sleepdelay from 1000 to 1500 or 2000. Also make sure not to click on anything when you’ve launched the script. Have patience and wait for the game to start.

If you’re using any resolutions other than 1280×720 in the widescreen mod you must edit the script manually at ChangeResolution(1280,720) to the resolution of choice.

Extra features

WASD are remapped and swapped with the arrow keys left, up, down and right and tilde for selecting the whole party. This is more of a convenience for me. If you dislike these keybindings delete all the lines from the text file from remapped keys down to functions.

If you’re only looking for the remapped WASD keybindings you can download it directly here (mirror) (right click and select save as) or the pre compiled script executable here (mirror)
MD5: f26caa20a3fbdaec26fe17abf0a6f514
(GitHub)

If you figure out any better solutions or have anything else to add that might help, please don’t hesitate to leave a comment!