So hello there your are reading my thread thats very nice of you to try to help me. But since its my thread please dont make fun of me if i sound stupid thank you
My name is Jack and i am new to python but can i make a script so when you open a video file or somthing it also opens a python script and the python scripts open every time you open your pc
so i want that you open a video file and a python scipts open too and that python scipt opens every time the pc turn on
The quick answer is yes, but more information is needed because there may be a better way to accomplish what you are trying to do,
which is detail is?
You should also mention which OS you are using: Linux, Windows, Max, ...
first you need to know what media player you want to use, then the video full name and location.
windows has a "start" command embedded in command line, python can use this with the os.system command
import os
os.system("start " + program + var)
if you wanted to open a video using vlc the command would be
import os
os.system("start 'C:\Program Files (x86)\VideoLAN\VLC'\vlc.exe' " + video)
(Nov-11-2017, 05:27 PM)iboman5 Wrote: [ -> ]So hello there your are reading my thread thats very nice of you to try to help me. But since its my thread please dont make fun of me if i sound stupid thank you
My name is Jack and i am new to python but can i make a script so when you open a video file or somthing it also opens a python script and the python scripts open every time you open your pc
so i want that you open a video file and a python scipts open too and that python scipt opens every time the pc turn on
Did you want a Python script to open everytime you open a video? I'm not sure that it's clear what you are trying to do. What media player will be used? What exactly did you want the script to do?
to run a python script you will need a secon python scrip to check when the program is launched.
taken from stack exchange:
def running():
n=0# number of instances of the program running
prog=[line.split() for line in subprocess.check_output("tasklist").splitlines()]
[prog.pop(e) for e in [0,1,2]] #useless
for task in prog:
if task[0]=="vlc.exe":
n=n+1
if n>0:
return True
else:
return False