How to Open Internet Explorer and Other Browsers in KiXtart

I know I’ve been posting a lot of KiXtart stuff lately, and I don’t mean to have my blog become all about KiXtart but it seems to be a pretty popular topic. I’ve been watching my web stats and have seen a few users come by from searches looking for how to open a browser from KiXtart so I thought I’d post the answer.

Here’s a function to open the default web browser. An optional URL can be specified and it will be opened in the browser.

; Open the default browser
FUNCTION OpenDefaultBrowser (OPTIONAL $URL)
	; Get the command line to start the default browser
	$BrowserCommand = READVALUE ("HKEY_CLASSES_ROOT\HTTP\shell\open\command", "")
 
	; Check if there is a %1 in the command
	IF INSTR ($BrowserCommand, "%1")
		; Replace any occurences of %1 with the URL
		$BrowserCommand = JOIN (SPLIT ($BrowserCommand, "%1"), $URL)
	ELSE
		; Append the URL to the end of the command
		$BrowserCommand = "$BrowserCommand $URL"
	ENDIF
 
	; If no URL was specified, remove " -nohome" from the command line
	IF NOT $URL
		$BrowserCommand = JOIN (SPLIT ($BrowserCommand, " -nohome"), "")
	ENDIF
 
	; Open the default browser and return immediately
	RUN $BrowserCommand
ENDFUNCTION

With the above function, if Firefox or Opera or some other browser is installed and set as the default, it will be opened instead of Internet Explorer. If you need to be sure that Internet Explorer is opened, and not some other browser, here’s a function that will open Internet Explorer no matter what.

; Open Internet Explorer
FUNCTION OpenInternetExplorer (OPTIONAL $URL)
	; Get the path to Internet Explorer
	$BrowserCommand = READVALUE ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "")
 
	; Append the URL to the end of the command
	$BrowserCommand = "$BrowserCommand $URL"
 
	; Open Internet Explorer and return immediately
	RUN $BrowserCommand
ENDFUNCTION

Here are some examples for using these functions:

; Open the default browser and go to the home page
OpenDefaultBrowser
 
; Open the default browser and go to http://blog.glyff.net/
OpenDefaultBrowser ("http://blog.glyff.net/")
 
; Open Internet Explorer and go to the home page, even if it isn't the default browser
OpenInternetExplorer
 
; Open Internet Explorer and go to http://blog.glyff.net/, even if it isn't the default browser
OpenInternetExplorer ("http://blog.glyff.net/")

Chinese Character Translator Firefox Extension - ChinesePera-kun

ChinesePera-kun is another great Firefox extension I found recently. This extension is cool – you can hover your mouse over Chinese characters (both Traditional and Simplified) and it will show you the pinyin pronunciation and the English definition. I’ve been wanting to learn Chinese for a while and I’m starting Chinese language classes in a couple weeks. This extension should help a lot.

“Blog this page” Firefox Extension - ScribeFire

ScribeFire is an extension to Firefox that lets you easily blog about sites or blog posts as you are reading them. You just right click on a page or a link, choose “Blog this page” and start writing. It works with WordPress, TypePad, LiveJournal, Windows Live Spaces, Blogger, Jeeran and others and you can have multiple blogs configured at once.

Powered by ScribeFire.