Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
[PY] Web Browser?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Sway" data-source="post: 223958" data-attributes="member: 1889"><p>Thanks.</p><p> </p><p><strong>UPDATE:</strong></p><p>** Added the option to choose the browser of your choice. This browser must be in your PATH.</p><p> </p><p>You can use the following aslong as they are in your PATH.</p><p> </p><p><img src="http://i39.tinypic.com/35ba1yp.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p> </p><p>Using 'windows-default' will load up your favorite or default browser.</p><p> </p><p><strong>Source:</strong></p><p><a href="http://pastebin.com/849LBLJD" target="_blank">http://pastebin.com/849LBLJD</a></p><p> </p><p><strong>Snippet:</strong></p><p>[CODE]def main():</p><p> print()</p><p> print("Do not add 'http://'")</p><p> website = input("Website: ")</p><p> print()</p><p> browsers = input("View the list of browsers? [Y / N]: ")</p><p> if browsers.lower() == "y":</p><p> print()</p><p> print('''You can use: 'windows-default' to load the default (favorite) browser.</p><p>You can use any other name aslong as that browser is in your PATH.''')</p><p> print()</p><p> </p><p> browserChoice = input("Browser (use 'windows-default' for the default browser): ")</p><p> </p><p> choice = input("Do you wish to open it in a new tab [NT] or seperate window [W]? ")</p><p> </p><p> if choice.lower() == 'w':</p><p> print("Opening website in new window...")</p><p> time.sleep(2)</p><p> </p><p> browser = webbrowser.get(browserChoice)</p><p> webbrowser.open_new("http://%s" % website) </p><p> startOver()</p><p> </p><p> elif choice.lower() == 'nt':</p><p> print("Opening website in new tab...")</p><p> time.sleep(2)</p><p> </p><p> browser = webbrowser.get(browserChoice)</p><p> webbrowser.open_new_tab("http://%s" % website) </p><p> startOver()</p><p> else:</p><p> print("I didn't get that..")</p><p> startOver()[/CODE]</p><p></p><p>It took about an hour to create in <strong>Python</strong>. This is pretty much it for this script. The next update will feature exception handlers and then that will be the final release.</p></blockquote><p></p>
[QUOTE="Sway, post: 223958, member: 1889"] Thanks. [B]UPDATE:[/B] ** Added the option to choose the browser of your choice. This browser must be in your PATH. You can use the following aslong as they are in your PATH. [IMG]http://i39.tinypic.com/35ba1yp.png[/IMG] Using 'windows-default' will load up your favorite or default browser. [B]Source:[/B] [URL]http://pastebin.com/849LBLJD[/URL] [B]Snippet:[/B] [CODE]def main(): print() print("Do not add 'http://'") website = input("Website: ") print() browsers = input("View the list of browsers? [Y / N]: ") if browsers.lower() == "y": print() print('''You can use: 'windows-default' to load the default (favorite) browser. You can use any other name aslong as that browser is in your PATH.''') print() browserChoice = input("Browser (use 'windows-default' for the default browser): ") choice = input("Do you wish to open it in a new tab [NT] or seperate window [W]? ") if choice.lower() == 'w': print("Opening website in new window...") time.sleep(2) browser = webbrowser.get(browserChoice) webbrowser.open_new("http://%s" % website) startOver() elif choice.lower() == 'nt': print("Opening website in new tab...") time.sleep(2) browser = webbrowser.get(browserChoice) webbrowser.open_new_tab("http://%s" % website) startOver() else: print("I didn't get that..") startOver()[/CODE] [B][/B] It took about an hour to create in [B]Python[/B]. This is pretty much it for this script. The next update will feature exception handlers and then that will be the final release. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
[PY] Web Browser?
Top