Python Forum
Need help creating a simple script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help creating a simple script
#8
A. You need to write your code using the Python tag like i have done, otherwise people frequently don't understand what you've written.

B. Back to your code:

import webbrowser
from time import sleep # put all your imports at the top, its good practice when coding no matter the language. (Also note i did 'from time import sleep' not just 'import time'. You can just use 'import time', then in the code you need to do 'time.sleep(30)'

chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s' # If you want to open the url with your default browser for easiness you can just use the code that i used. 

webbrowser.get(chrome_path).open('https://www.halowaypoint.com/en-us/news') # Checkout webbrowser docs for more info

sleep(30)

os.system("taskkill /im chrome.exe /f") # When this is run it will terminate all processes named 'chrome.exe' 
C. Checkout webbrowser documentation here for some information: https://docs.python.org/3/library/webbrowser.html

D. If you want this to close and re-open in a new browser (Refresh The Page) then you can just wrap the entire code in a while loop. I wouldn't advise this, there are better solutions to your requirement here.

E. What do you mean message grabber?
Reply


Messages In This Thread
Need help creating a simple script - by Nonameface - Jul-13-2020, 04:22 AM
RE: Need help creating a simple script - by HarleyQuin - Jul-14-2020, 07:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple Python script, path not defined dubinaone 3 2,741 Nov-06-2021, 07:36 PM
Last Post: snippsat
  Help with Creating a Script for Automating Reports SunWers 1 1,955 Dec-29-2020, 10:21 PM
Last Post: jjc385
  Creating a simple rate limiter. DreamingInsanity 0 1,753 May-28-2020, 11:08 AM
Last Post: DreamingInsanity
  Creating an executable from a script wolf8963 6 5,849 May-11-2020, 05:23 PM
Last Post: wolf8963
  Need help creating complex loop around existing script CephloRhod 5 2,810 Apr-16-2020, 01:23 PM
Last Post: deanhystad
  Simple text to binary python script gmills13 2 2,847 Feb-04-2020, 08:44 PM
Last Post: snippsat
  Creating a List with many variables in a simple way donnertrud 1 2,068 Jan-11-2020, 03:00 PM
Last Post: Clunk_Head
  Made a simple script for android (really simple) but it is not running anddontyoucomebacknomore 2 2,402 Mar-06-2019, 12:19 AM
Last Post: anddontyoucomebacknomore
  Simple script that seems to misbehave? Nwb 1 2,376 Jun-10-2018, 05:30 AM
Last Post: Nwb
  First time with Python.. need help with simple script shakir_abdul_ahad 7 5,570 May-06-2018, 09:28 AM
Last Post: killerrex

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020