Robert Burton Posted December 7, 2014 Posted December 7, 2014 I have some files to start and stop my projector. I see the .las file start up the command line because the dos window pops up. However, the projector doesn't cut on. When I directly click on the link...it does. It is almost that there needs to be a pause or something before the program sends the line. Can that be done? The dos window stays up longer when directly clicked on. Yes, it is the right path too. The off command does the same thing.
Robert Burton Posted December 10, 2014 Author Posted December 10, 2014 Bump, Bump, BumpMaybe I am not explaining this well enough. I can go into the folder where I have the .bat files stored, click on it and the projector cuts on and off fine. However when I point the Windows Command line in LOR to it...it doesn't work. I see the .bat executed and it brings the dos window to the front but the projector doesn't come on or off doing it this way.
dstevens Posted December 10, 2014 Posted December 10, 2014 Do you need a pause in the batch file? There is a command that can be used to pause a batch file for a period of time and then resume automatically. Is this what you're looking for?
dgrant Posted December 10, 2014 Posted December 10, 2014 When you set the command, you are given options to hide the popup window if you wish.
ItsMeBobO Posted December 10, 2014 Posted December 10, 2014 Can you show us the batch command? Are you running another batch within it?
Robert Burton Posted December 10, 2014 Author Posted December 10, 2014 Can you show us the batch command? Are you running another batch within it?I'm not sure if I need a pause or not. It just seems to be on the screen longer when the dos screen comes up when you directly click on it than when the LOR program requests it. I have the screen set on Normal Focus.Dell-2400mp.zip
dstevens Posted December 10, 2014 Posted December 10, 2014 If you want to try a pause within your batch file, add this line at the appropriate spot: choice /c:YN /n /t 5 /D y This will make the batch file wait for 5 seconds for a choice from the user. After 5 seconds, a default is assumed and the batch file will continue. If you want to change the amount of time, just change the number after the /t parameter. It's not very elegant, but it will pause the batch file and automatically resume. If you want to just pause the batch file until you press any key, add a pause command.
Robert Burton Posted December 10, 2014 Author Posted December 10, 2014 When I get home from work I will try these suggestions and see if it works. I just noticed the dos window moving slower when it was a direct click of the mouse on the file.
TonyD Posted December 10, 2014 Posted December 10, 2014 (edited) "sleep" will pause for the number of seconds you specify. "Sleep 5" will stop execution for 5 seconds and then resume with the next line in the script. "Pause" will wait forever until you press a key. One thing you might want to do in the .bat file is make sure you either change directories to where the .bin files are or include the full path of the .bin file in the copy statement. Otherwise, it may not actually be able to "find" the file when it is executed. When you just dbl-click the batch file the working directory is where the batch file is so it can find the .bin file. However, when LOR "calls" the .bat file its working directory could be something completely different (so it's not actually copying the .bin file). You probably don't actually need to pause, it is more likely just not able to find the .bin files so completes quicker when LOR calls it. @Echo offcd "c:\location_where_bin_file_is"mode com1 BAUD=19200 PARITY=N DATA=8 STOP=1copy On.bin com1: >nul OR this way: @Echo offmode com1 BAUD=19200 PARITY=N DATA=8 STOP=1copy "c:\location_where_bin_file_is\On.bin" com1: >nul Edited December 10, 2014 by TonyD
dstevens Posted December 10, 2014 Posted December 10, 2014 "sleep" will pause for the number of seconds you specify. "Sleep 5" will stop execution for 5 seconds and then resume with the next line in the script. "Pause" will wait forever until you press a key. One thing you might want to do in the .bat file is make sure you either change directories to where the .bin files are or include the full path of the .bin file in the copy statement. Otherwise, it may not actually be able to "find" the file when it is executed. When you just dbl-click the batch file the working directory is where the batch file is so it can find the .bin file. However, when LOR "calls" the .bat file its working directory could be something completely different (so it's not actually copying the .bin file). You probably don't actually need to pause, it is more likely just not able to find the .bin files so completes quicker when LOR calls it. @Echo offcd "c:\location_where_bin_file_is"mode com1 BAUD=19200 PARITY=N DATA=8 STOP=1copy On.bin com1: >nul OR this way: @Echo offmode com1 BAUD=19200 PARITY=N DATA=8 STOP=1copy "c:\location_where_bin_file_is\On.bin" com1: >nul I didn't know about the "sleep" command - I guess you really do learn something new every day. Good idea about the active directory. I hadn't considered that.
Robert Burton Posted December 10, 2014 Author Posted December 10, 2014 Well I am still unsuccessful. I have tried each one of these suggestions in addition to Bob's suggestion;cmd /c "mode com1 BAUD=19200 PARITY=N DATA=8 STOP=1" & "Copy On.bin com1: >nul" Your right. It is not finding the file. I watched the dos prompt carefully (as it wizzed by) and it said something about not finding the file. I moved the file to the c:\ itself in no folder. I did for some reason find a different file from the .bin file mentioned in the WORKING .bat file I can directly click on. It's a on.out file. Weird. But it works (the direct click to the .bat file that is). Showtime so I have to stop fooling with it. Bottom line I think it is not finding the file for some reason. Whether I use a command prompt in the command line or whether I run a external .bat file. Now if I only had some automation file that would work in win8.1. A program that you could set a time for a certain program to boot up (honestly just like what SE is doing). Probably wouldn't work either :-(
dstevens Posted December 10, 2014 Posted December 10, 2014 I'm not familiar with Win8.1, but couldn't you use a scheduled task in windows to run the program?
ItsMeBobO Posted December 11, 2014 Posted December 11, 2014 Its got to work one way or another. I suggest you put all the files in the LORAPP folder where SE is found. This includes the .bin files. The .bat tells windows to use the old command processor. They should be .cmd instead.
Robert Burton Posted December 13, 2014 Author Posted December 13, 2014 Bob I know what you mean. I actually did what you suggested above...and it worked when I ran the program stand alone. Had some errands to run and go to another display to look at. Came back home...and the projector was off. The show is running right now, so I can't play with it. Will have to look why it didn't play. I think before your suggestion...I may have been typing the file wrong ;-) Oooppps :-) I know now though...the file and Windows command line works. Just can't figure why it didn't work with the scheduler.
TonyD Posted December 13, 2014 Posted December 13, 2014 If you change the .bat files the way i suggested it should work either way (file and Windows command AND LOR Scheduler). The reason it doesn't work with the scheduler is the Active (or working) Directory for the Scheduler doesn't contain the bin files so it can't find them. If you change the bat file to include the entire path to the file then it will work whatever way the bat file is run because it has the entire path to the file.
Robert Burton Posted December 14, 2014 Author Posted December 14, 2014 Thanks for your help everyone.I am not sure WHAT all I did. After a while, you just hack! And that is what I did. Finally got it to work with my original .bat file path in the windows command line on SE. I'm not sure if I didn't have the syntax right or what. I forgot had literal dos was. I do remember some time in the process of putting some ___ between words. Anyway, it worked with the .las file just a second ago. Hopefully it will work tonight with the scheduler.Thanks everyone.
Robert Burton Posted December 14, 2014 Author Posted December 14, 2014 Ok. Finally got the file to run the .las file itself. But when I use the scheduler, it doesn't. I am pointing the scheduler to the .bat file. LAST YEAR this worked with another file. No reason why it shouldn't this year?
TonyD Posted December 17, 2014 Posted December 17, 2014 you've got to look inside the bat file. You are referencing a BIN file inside that bat file and when the scheduler runs the .bat file it does not know where it is. You need to put the full path to the bin file in the bat file. Please try this and let me know. i do a lot of command scripting and am sure this is your problem. This is the 3rd (and last) time i've suggested it 1
ItsMeBobO Posted December 17, 2014 Posted December 17, 2014 LOR Bobs help http://www.lightorama.com/bobpublic/WindowsShellCommands.swf
TonyD Posted December 17, 2014 Posted December 17, 2014 Bob, great video that explains things very well. One thing i think will still confuse people is if you reference another file in a batch file you also need to provide the full path (or change directory to where the file is) to that file for the very same reason you need to provide the full path to LOR to run the batch file. If you have a batch file that does this:Copy On.bin com1: >nul you need to tell LOR which directory On.bin is, for example c:\users\bob\On.bin Otherwise the On.bin file won't be found and the Copy command will fail.
Recommended Posts