Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Python script that transfer it self
#1
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
Quote
#2
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?
Quote
#3
You should also mention which OS you are using: Linux, Windows, Max, ...
Quote
#4
i use 3.6.3 on windows
Quote
#5
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)
Quote
#6
(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?
Quote
#7
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
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to kill a bash script running as root from a python script? jc_lafleur 4 277 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 253 May-28-2020, 05:27 PM
Last Post: micseydel
  Package python script which has different libraries as a single executable or script tej7gandhi 1 623 May-11-2019, 08:12 PM
Last Post: keames
  SFTP transfer using paramiko fails estebanup03 0 2,101 Sep-06-2018, 08:06 PM
Last Post: estebanup03
  Python script that transfer it self iboman5 2 1,387 Nov-10-2017, 06:56 PM
Last Post: iboman5
  Check Python version from inside script? Run Pythons script in v2 compatibility mode? pstein 2 6,720 Jul-07-2017, 08:59 AM
Last Post: snippsat
  Cant pass corect variables to python script in bash script neradp 3 3,069 Nov-05-2016, 01:26 AM
Last Post: Larz60+

Forum Jump:


Users browsing this thread: 1 Guest(s)