Friday, 9 September 2016

Circumventing timed nag screens using AutoIT

Nag Window Problem

I frequently use a small utility for my 3D scanning projects called Points2Polys. It's an older free utility from Paraform that's really useful for viewing and skinning point clouds. Unfortunately being free software Paraform decided to place two annoying nag windows in the program which appear ever time the utility is used. The first nag window displays a branded image for 3 seconds and a second nag window is displayed for a further 10 seconds. The second window can only be removed by clicking on the newly enabled close button (close button is disabled during the 10 seconds wait).

Since these nags slow down productivity I had wondered about removing or altering the timing values in the executable program code and removing the nag screens using hacking techniques. I did eventually try various cracking methods but ultimately I wasn't skilled enough to find the important code blocks and remove the problem.


After further thought I realised that I could alter the window elements using AutoIT. I previously used AutoIT to write CrossBro. AutoIt is a very powerful scripting language used to automate everything in the Windows environment. Using its built in functions I could close windows, send simulated key presses and manipulate associated Windows GUI elements automatically.

Further research and a few prototypes later proved that Points2Polys was using standard Windows GUI API elements that could easily be manipulated in the way I wanted. I still wasn't able to change the timer values but did noticed that once I had enabled the Close button the nag window could be closed immediately. 

Using AutoIT I manged to script a series of simple actions to complete the task.

1) The script runs Points2Polys.exe
2) It closes the front nag window by sending a simulated right mouse button click
3) It selects the second nag window using its window title name
4) The Close button is enabled with one simple command
5) A virtual keypress is sent to the Close button which closes the nag window fully

I also added a final command to resize the application window to fit my screen size.


This script finally enabled me to use Points2Polys the way I want. I still see the nag windows briefly after startup but they both disappear shortly afterwards leaving the interface clutter free and ready for use.

Download: Points2Polys

AutoIT Script

;AutoIt script

;Points2Polys loader without nag screens by Colin Ord, 7th Sept 2016

;Script purpose
;To automatically circumvent the two timer driven nag screens

;- script opens points2polys.exe
;- script closes the initial nag screen by sending a simulated mouse press to the application
;- script then 'enables' the disabled close button
;- script sends a Left mouse click to the newly enabled close button control closing the second nag screen
;- script also resizes the window dimensions to fit the screen

#include <MsgBoxConstants.au3>

;#include <GUIConstantsEx.au3>
;#include <StaticConstants.au3>


Func loader()
    ;run Points2Polys
    Run("D:\Program Files (x86)\Paraform\Points2Polys\Points2Polys.exe")

    ; Wait 10 seconds for the Points2Polys window to appear
    Local $hWnd = WinWait("Paraform Points2Polys", "")

   ;close the 1st nag window - automated mouse click
   Local $hWnd = WinWait("Paraform Points2Polys", "") ;

   ;enable the disabled (greyed) out close button
   ControlEnable($hWnd, "", "[CLASS:Button;INSTANCE:1]")
   ;close 2nd nag window - click the enabled close button
   ControlClick("Paraform Points2Polys", "", "[CLASS:Button;INSTANCE:1]")
   ;resize window to fit screen
   WinMove("Untitled - Points2Polys", "", 480,140,960,700)

EndFunc   ;==>Example