Python Forum
Open files in an existing window instead of new
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open files in an existing window instead of new
#1
OS: Linux Mint 21.3
Python version: 3

I’m transcribing .mp3 audio files. To make the job easier, I’ve bound the following script in AutoKey to a hotkey.

It allows for opening whatever text is highlighted as a file in the VLC media player:

import subprocess

audiofile = clipboard.get_selection()
subprocess.run(
    [
        "vlc",
        "/mnt/SSD/Audio/{}.mp3".format(audiofile),
    ],
)
The script runs fine. However, every command to run VLC opens a new window, cluttering the system.

How can I open a file in an existing VLC instance whenever the script runs? subprocess.run doesn’t seem to be right for this.
Reply


Messages In This Thread
Open files in an existing window instead of new - by Kostov - Apr-12-2024, 09:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Right way to open files with different encodings? Winfried 2 403 Apr-23-2024, 05:50 PM
Last Post: snippsat
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 2,071 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  how to open a popup window in tkinter with entry,label and button lunacy90 1 1,012 Sep-01-2023, 12:07 AM
Last Post: lunacy90
  open python files in other drive akbarza 1 788 Aug-24-2023, 01:23 PM
Last Post: deanhystad
  Open a new window does not work Nietzsche 4 1,261 Jun-14-2023, 08:52 AM
Last Post: Nietzsche
  Add\insert header row existing csv files mg24 0 768 Oct-05-2022, 06:11 AM
Last Post: mg24
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 1,249 Jun-13-2022, 08:59 AM
Last Post: Shena76
Sad Selenium: can't open a new window after clicking a button and I don't know why noahverner1995 0 2,045 Jan-22-2022, 09:55 AM
Last Post: noahverner1995
  How to open/load image .tiff files > 2 GB ? hobbyist 1 2,547 Aug-19-2021, 12:50 AM
Last Post: Larz60+
  Open and read multiple text files and match words kozaizsvemira 3 6,868 Jul-07-2021, 11:27 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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