Mikesch Posted February 28, 2010 Share Posted February 28, 2010 Hi, I got a program which displays its output on the screen by writing a .html file into the temp folder and then launching the default browser. As I need a Screenshot of the output, I grab the html file in an embedded IE window in my own GUI to prevent zooming issues. Works nicely. Only flaw is the browser window being left open with the above html content. Do you see any way to either close the freshly created browser tab immediately or, preferrably, (temporarily) suppress loading the html-file into the browser at all? The latter would be first choice, as it would work on any system regardless of the default browser. As an alternative, can you think of a way of getting the screenshot without affecting the default browser. Hope you can point me to a solution. Thanks in advance! Mike (Closing the browser completely would of course be simple, but in case the user has alredy opened a browser with several tabs, it might be quite annoying, so i don't want to go this way. Link to comment Share on other sites More sharing options...
alkmie Posted April 11, 2010 Share Posted April 11, 2010 (edited) I'm having trouble closing tab in a browser also. I did find a hot-key that closes the last tab its "CRTL W" and it works great when I manual type it but when I put it in my code it tries and show down the whole browser for some reason not sure why. heres the code RunWait(@ComSpec & ' /c start http://www.bitgamer.com/savetheworld.php', '', @SW_HIDE) Sleep("15000") Send("+{TAB}") Send("+{TAB}") Send("{ENTER}") sleep(3000) Send("{CTRLDOWN}") Send ("W") The website is private so do try and run the script but if you can give an example or closing a browser tab or even switch to a tab based on name or something. Crtl tab will switch pages but if I use that its going to be a really messy script and if a page is already open when the script starts it will mess up the tab numbers. Thanks *Edit Solved Using the code Send("{CTRLDOWN}w{CTRLUP") works for closing the last tab hope that helps Edited April 11, 2010 by alkmie Link to comment Share on other sites More sharing options...
l3ill Posted April 11, 2010 Share Posted April 11, 2010 Not sure if I completely understand but... I use Irfanview and it's amazing commandline ability to write functions that do similar to what you are describing without html and browser being necessary. Let me know if your interested. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now