-2

I have legal .strm files of different TV Shows in a folder named TV Shows. Each strm file of each episode is stored in different subfolders.

I would like to run a certain VBScript before these strm files are played.

Then I have a different folder named MOVIES. Again, I would like to run a VBScript before these strm files are played. But this VBScript is a different one.

How would I do that?

Platform is Windows.

Thanks!

NoIdeaJoe
  • 19
  • 5

1 Answers1

0

If you're looking to open or do something to each file based on extension, An easy way to do this is to use an for loop with /R to search all sub-directories for an *.strm file.

@ECHO OFF
SET "LOC=C:\Folder"

CD %LOC%
FOR /R %%A IN (*.strm) DO (

    Rem | Do something with each file.
    Start cmd.exe /C "notepad.exe "%%A""

)

Echo No More Items Found!
pause
goto :EOF
  • %%A will return the file path.
  • Start cmd.exe /C "" will start a CMD command. (Replace with your code)
  • notepad.exe "" will open the file (Used as an example)

EDIT:

So you're looking to check if the file exists then if true run the script? Bellow should solve that.

@ECHO OFF

If exist (C:/Path/file.strm) (

    Rem | File exists, run script
    Echo Do something

)
GOTO :EOF
John Kens
  • 1,615
  • 2
  • 10
  • 28
  • awesome! Thank you @John Kens for your reply! This comes close to what I am looking for. But it needs to be a bit different. Not a loop, but I am looking for a command for this: "IF the stream file is in folder x, THEN run my script". So it needs a bit of a modification. Hope it can be done easily! Thanks! – NoIdeaJoe Jan 16 '19 at 00:55
  • thank you. It should be ANY .strm file WITHIN that folder. But always just one *.strm file. So if I press play in Kodi and the strm file is in that particular folder x, then it should run the script! Looking forward for your solution! – NoIdeaJoe Jan 16 '19 at 01:38
  • @NoIdeaJoe Combine both my responses and wa-la you're set. Type `For /?` in a cmd window. – John Kens Jan 16 '19 at 20:19
  • thank you very much. I think it works. I have now to figure out how to implement this, so it works when I press play in Kodi. That's not working yet. – NoIdeaJoe Jan 20 '19 at 22:00
  • @NoIdeaJoe Try making a C# browser application. You can search for an html eliminates or remotely play the video off the page. – John Kens Jan 21 '19 at 16:28
  • thanks, but I want to press play in Kodi to run my script and then play then movie. How is that going to help? – NoIdeaJoe Jan 21 '19 at 16:55
  • @NoIdeaJoe By exactly what I said. Once said element or button is pressed, it will run your script. – John Kens Jan 21 '19 at 17:31
  • @NoIdeaJoe It can also be done in vb.net too if that's more famalier or easier for you. – John Kens Jan 21 '19 at 18:38