topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 11:50 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Chrome "about:blank" hack for Windows  (Read 6300 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Chrome "about:blank" hack for Windows
« on: June 10, 2011, 08:24 PM »
If you use "about:blank" in settings to get a chrome based browser to start with a blank page you may notice it comes up with "about:blank" in the Address Bar and the caret at the beginning of the line.  It forces you to delete about:blank before you can type in a url or search string.

This little AutoIt3 hack sits in the tray and watches for a window title starting with "about:blank" and window text that's also "about:blank"(the text in the Address Bar.)

If it gets a match it sends keys to remove about:blank allowing you to type stuff in right away.  The hack is an AutoIt3 script meaning it runs on Windows XP or later. You can get the AutoIt tools to run and/or compile the script here:
http://www.autoitscr...te/autoit/downloads/

This is just a hack until the Chromium guys get around to fixing it.


;  Chrome Blanker for Windows XP or later
;
;  For those who start a Chrome based browser
;  using about:blank to get a blank page.
;
;  This watches for "about:blank" in both the
;  window title and text(the address bar).
;
;  Removes about:blank from address bar.
;  This allows you to type in a url or
;  search string right away.
;
;  Author:  MilesAhead
;
$title = "about:blank"
$text = "about:blank"

_EmptyWorkingSet()

While 1
If WinGetTitle($title, $text) Then
If WinActivate($title, $text) Then
Send("{F6}")
Send("{Del}")
_EmptyWorkingSet()
ContinueLoop
EndIf
EndIf
Sleep(250)
WEnd

Func _EmptyWorkingSet()
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
Return $ai_Return[0]
EndFunc   ;==>_EmptyWorkingSet

« Last Edit: June 10, 2011, 10:24 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Chrome "about:blank" hack for Windows
« Reply #1 on: June 11, 2011, 12:59 AM »
I added a few things. Protection against "already running" error dialog.  Memory trimmed periodically while running in the tray.  Plus your basic crappy About MsgBox!!



;  Chrome Blanker
;
;  For those who start a Chrome based browser
;  using about:blank to get a blank page.
;
;  This watches for "about:blank" in both the
;  window title and text(the address bar).
;
;  Removes about:blank from address bar.
;  This allows you to type in a url or
;  search string right away.
;
;  Author:  MilesAhead
;
#include <Constants.au3>
#include <Misc.au3>

Const $ERROR_ALREADY_EXISTS = 183
If _Singleton("{C8C284F1-5247-4187-8D48-FD476E473C61}", 1) = 0 Then
If @error = $ERROR_ALREADY_EXISTS Then Exit
EndIf
AutoItSetOption("TrayMenuMode", 3)
TraySetClick(8)
$aboutitem = TrayCreateItem("About Chrome Blanker")
TrayCreateItem("")
$exititem = TrayCreateItem("Quit")
TrayItemSetState($aboutitem, $TRAY_DEFAULT)
TraySetToolTip("Chrome Blanker")
TraySetState()

Const $LoopTrigger = 4096
Global $loopCount = 0
$title = "about:blank"
$text = "about:blank"

_EmptyWorkingSet()

While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
If WinGetTitle($title, $text) Then
If WinActivate($title, $text) Then
Send("{F6}")
Send("{Del}")
_TrimMemory()
ContinueLoop
EndIf
EndIf
$loopCount += 1
If $loopCount > $LoopTrigger Then _TrimMemory()

Case $msg = $aboutitem
_About()

Case $msg = $exititem
_Quit()

EndSelect
WEnd

Func _TrimMemory()
_EmptyWorkingSet()
$loopCount = 0
EndFunc   ;==>_TrimMemory

Func _EmptyWorkingSet()
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
Return $ai_Return[0]
EndFunc   ;==>_EmptyWorkingSet

Func _About()
Local $mMsg = @CRLF & "Chrome Blanker is a Hack for Chrome based Browsers on Windows." & @CRLF & @CRLF
$mMsg &= "It erases about:blank from the Adress Bar on Startup" & @CRLF & @CRLF
$mMsg &= "          Author:  MilesAhead"
MsgBox(0x1040, "Chrome Blanker", $mMsg)
EndFunc   ;==>_About

Func _Quit()
Exit
EndFunc   ;==>_Quit
« Last Edit: June 11, 2011, 02:41 AM by MilesAhead »