Windows - need help integrating a more kiosk like internet browser

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
anthonymcdevitt Offline
Junior Member
Posts: 21
Joined: May 2012
Reputation: 0
Location: Michigan
Post: #1
Alright, so i'm trying to implement an "idiot-proof" browser for xbmc. The problem is the minimize and maximize button. Well, maximize isnt as big of a deal its mostly minimize. The windows shell is xbmc, so i have no taskbar. Minimizing leads to many problems since the only way to get back is through alt-tab or task manager (not very advanced, but not all users will be computer literate).

I am open to different suggestions, one idea i would like to pursue is if advanced launcher could be configured to not open a new window, but to just switch over to the minimized one.

Other info -

win7 ultimate x64
xbmc 11.0 (eden)
browser - firefox (although i am willing to change)

had a thought, maybe create a batch file that closes all other firefox instances before opening another one. Anybody have a clue what command i would use for that? Im in the process of searching for that info and realize this may not be the right kind of forum for that info. Not an ideal solution, but it would work
(This post was last modified: 2012-05-13 07:36 by anthonymcdevitt.)
find quote
anthonymcdevitt Offline
Junior Member
Posts: 21
Joined: May 2012
Reputation: 0
Location: Michigan
Post: #2
Well i tried the tskill command, however it appears to not work through xbmc for whatever reason. Using the taskkill command does work through xbmc, however it seems slow to close the program as once in a while it brings up a message saying only one instance of a program allowed at a time. Not a big deal, just click it again and it works. Bit of a hassle. perhaps there is a way to pause for a second or two before opening firefox

heres a copy of the batch file

taskkill firefox
cd "C:\program files (x86)\mozilla firefox"
firefox.exe %1

Still though, this is not an ideal solution. The whole point of this was to not have a bunch of instances of firefox opened and slowing down the machine. This will reduce it to (theoretically) just one window at a time, and for just internet browsing its not a huge issue. But if i were to be streaming something, or playing some in-browser game it could tend to bog things down.

So im still looking for ideas to close the program instantly once it is not in focus.
(This post was last modified: 2012-05-13 08:56 by anthonymcdevitt.)
find quote
Angelscry Offline
Skilled Python Coder
Posts: 3,381
Joined: Sep 2010
Reputation: 53
Location: MTL, Canada
Post: #3
You can try to use the pskill command (http://www.gwenael.org/forum/viewtopic.php?id=6) :

Code:
pskill -t firefox.exe
cd "C:\program files (x86)\mozilla firefox"
firefox.exe %1

Also here is an example how close an application using a specific key : http://www.gwenael.org/forum/viewtopic.php?id=43. You could then have a script similar to this, that will close Firefox once you will hit the ESC key.

Code:
HotKeySet("{ESC}", "Terminate")

If $CmdLine[0] == 1 Then
    Run ( '"C:\program files (x86)\mozilla firefox" "' & $CmdLine[1] & '"', "C:\program files (x86)\mozilla firefox" )
    While 1
        Sleep(100)
    WEnd
EndIf

Func Terminate()
    ProcessClose ( "firefox.exe" )
    Exit 0
EndFunc
(This post was last modified: 2012-05-13 19:37 by Angelscry.)
find quote
anthonymcdevitt Offline
Junior Member
Posts: 21
Joined: May 2012
Reputation: 0
Location: Michigan
Post: #4
First off, pskill is wonderful. Iv'e tried it probably a hundred times now, it not once has it gave me that message again. Thank you for that.

Now as far as the autoit script..
Im having some troubles getting it to work. I've never used autoit before so i started by just making a simple hello world script, compiled it, and opened. It popped up with the window "hello world" and worked just perfectly.

I am unsure if your last post to be exact code i would use, or just a rough example. Regardless, i tried compiling the code you posted but to no avail. It seems to do nothing at all. I've tried a couple of variations on it with the help of the link youve provided. For example, in line 4, i've tried a couple different things...

Code:
Run ( '"C:\program files (x86)\mozilla firefox" "' & $CmdLine[1] & '"', "C:\program files (x86)\mozilla firefox" )
Code:
Run ( '"C:\program files (x86)\mozilla firefox\firefox.exe" "' & $CmdLine[1] & '"', "C:\program files (x86)\mozilla firefox" )
Code:
Run ( '"C:\program files (x86)\mozilla firefox\firefox" "' & $CmdLine[1] & '"', "C:\program files (x86)\mozilla firefox" )

I am curious as to why there is a second file path in that line that seem to point to the directory of the program.

I assumed it would be as simple as compiling the script to a .exe and using that .exe to launch my browser. Perhaps i am incorrect. Maybe you could point me in the direction of a more in depth tutorial.
find quote
Angelscry Offline
Skilled Python Coder
Posts: 3,381
Joined: Sep 2010
Reputation: 53
Location: MTL, Canada
Post: #5
First, you will found the autoit Run() function description here : http://www.autoitscript.com/autoit3/docs...ns/Run.htm
Second... I have just discover that I have made a mistake into the code. Sorry... Good code line must be

Code:
Run ( '"C:\program files (x86)\mozilla firefox\firefox.exe" "' & $CmdLine[1] & '"', "C:\program files (x86)\mozilla firefox" )

The second path is to indicate the working directory of the started application (firefox). Bur I think I is not necessary to use it. So code could be :

Code:
Run ( '"C:\program files (x86)\mozilla firefox\firefox.exe" "' & $CmdLine[1] & '"')

To use the code, you must pass an url or an html file path as argument to make it works. If you only want to start firefox without starting a specific url or html file, the code will be :

Code:
HotKeySet("{ESC}", "Terminate")

If $CmdLine[0] == 1 Then
    Run ( '"C:\program files (x86)\mozilla firefox\firefox.exe"' )
    While 1
        Sleep(100)
    WEnd
EndIf

Func Terminate()
    ProcessClose ( "firefox.exe" )
    Exit 0
EndFunc
find quote
anthonymcdevitt Offline
Junior Member
Posts: 21
Joined: May 2012
Reputation: 0
Location: Michigan
Post: #6
Thanks a bunch angelscry! By putting an url address in the argument i was able to get everything working. Curious it doesnt work when empty.

One thing i had to change was the batch file. For some reason when running that script, it throws the dos window on top, so added "start" before firefox.exe.
Code:
pskill -t firefox
cd "C:\program files (x86)\mozilla firefox"
start firefox.exe %1
Probably better that way anyways, now the window closes once firefox opens instead of waiting for firefox to close.
find quote