1.

Solve : Newbie Batch file question?

Answer»

Newbie here.
Can I do this?
I want to use XP's Scheduled events to run a batch file to do the following:
Start my video compression/conversion software, Sothink Video Converter:
START c:\progra~1\sothin~1\svc.exe
Open a video that has been just been created (I'll have the scheduled event start 5 minutes after the file is to be completed):
C:\Documents and Settings\All Users\Documents\My Videos\*.ts
and run the conversion with the default profile "MyProfile", creating a *.avi file somewhere else (part of the profile)
Then delete the original *.ts file:
DEL C:\Documents and Settings\All Users\Documents\My Videos\*.ts /Q
And end the batch:
:END
I think this should work, but don't know how to append the START COMMAND to open a file and start the process using MyProfile.
svc.exe would have to support work from commandline inorder to run the converstion, but to open a video you would just need to use
Code: [Select]START c:\progra~1\sothin~1\svc.exe C:\Documents and Settings\All Users\Documents\My Videos\NAME.ts
Paths with spaces need quote marks.
Using the above info, I tried this:
START c:\progra~1\sothin~1\svc.exe "C:\Documents and Settings\All Users\Documents\My Videos\"*".ts"
but it didn't open the .ts file in that directory. I'm likely using the wildcard incorrectly, huh?
Once I have my .ts file opened in the program, I should be able to send KEYSTROKES to simulate Alt-F-C {enter} to start the conversion process, right? I've searched googlitiously and it seems that you can use wildcards and keystrokes, but I can't find the basic, basic premise, only very COMPLICATED scenarios.
BTW, when I change the above line from "*".ts" to test.ts", the .ts file opens in the program.Try this:

Code: [Select]START "" c:\progra~1\sothin~1\svc.exe "C:\Documents and Settings\All Users\Documents\My Videos\*.ts"

You can use the long pathnames of "c:\program files\sothin whatever\svc.exe" if you double quote it, too.

And if your svc.exe program doesn't accept wildcards then you can try this instead:

Code: [Select]@echo off
for %%a in ("C:\Documents and Settings\All Users\Documents\My Videos\*.ts") do (
START /w "" "c:\progra~1\sothin~1\svc.exe" "%%a"
)

If that doesn't work then you will have to investigate the command line options of svc.exeThat second option worked, it opened the program and loaded my .ts file. *applause!*

I found out how to send keystrokes (I think) :
http://www.ehow.com/how_7788761_press-buttons-batch-file.html

Now my batch looks like this:
@echo off
for %%a in ("C:\Documents and Settings\All Users\Documents\My Videos\*.ts") do (
START /w "" "c:\progra~1\sothin~1\svc.exe" "%%a"
)
sleep 60
WshShell.Sendkeys "%f"
sleep 5
WshShell.Sendkeys "c"

This is SUPPOSED to load the *.ts file, wait 60 secs, press ALT F (file), wait 5 secs, and press C (convert)
Doesn't seem to work though, it just opens the file and sits.
Ideas?You might like to look into AutoIt to press buttons in an app.



Discussion

No Comment Found