Computer Hope

Microsoft => Microsoft DOS => Topic started by: Jaka on November 03, 2014, 01:25:42 PM

Title: number of times started
Post by: Jaka on November 03, 2014, 01:25:42 PM
Hi.
Can someone here helpe with batc which will start program file1.exe and file2.exe
After starts file1.exe it will write 1 to txt file.
after it will start file1.exe second time it will write 2 to txt file.
And when it will start third time file1.exe it will write 3 to txt file and so on until it will write 5 to txt file. Than it stop to starting file1.exe.
But this file also need to check before it start file1.exe if there is number 5 in txt file it will not start file1.exe but it will start file2.exe
and it will not start file1.exe until file2.exe is started 3 times. So it will work the same as file1.exe, it will write in some other txt file 1 when it start file2.exe first time and than it will write 2 into txt when starts second time and 3 when it is started third time. After that it must erase first txt file with number 5 to zero and second txt with number 3 to zero and start all over again with starting file1.exe. So batch will write 2 txt files for each program it will start.
Is that possible with batch flle?
Title: Re: number of times started
Post by: Lemonilla on November 03, 2014, 03:40:41 PM
So you want a log file something like this:

File1
1
2
3
4
5
File2
1
2
3

Please explain exactly what this is and what is is for.  This will ensure a more accurate answer.
Title: Re: number of times started
Post by: Squashman on November 03, 2014, 05:01:08 PM
I am not sure I understand the point of this. Batch is sequential processing. I am not sure writing to a log file is really relavant for what you are trying to accomplish.
Title: Re: number of times started
Post by: Jaka on November 04, 2014, 05:21:45 AM
point is that batch file will run exe file which check backup and if backup is missing it will restart program for backup
when program is stared 5 times than it should restart PC and when PC is restarted than goes to backup program and when that cycle with restarting comes to 3 times it will stop all.

But yes you have reminded me for some important thing. on 5 times file1.exe goes 1 time file2.exe
order should be
5 times file1.exe
than stop
than 1 time file2.exe
than stop
and go again to file1.exe
when file1.exe 5 times
than stop
than file2.exe
than stop
than again 5 times file1.exe
than stop
than file2.exe
than stop finally


if that is possible with batch file and two txt files for log cycles
batch file is runned by task scheduler every hour. Number of first and second cycles will change if it will be needed, so thats why also need txt file to check how many times some cycle is needed.
Title: Re: number of times started
Post by: Squashman on November 04, 2014, 06:29:05 AM
point is that batch file will run exe file which check backup and if backup is missing it will restart program for backup
when program is stared 5 times than it should restart PC and when PC is restarted than goes to backup program and when that cycle with restarting comes to 3 times it will stop all.

But yes you have reminded me for some important thing. on 5 times file1.exe goes 1 time file2.exe
order should be
5 times file1.exe
than stop
than 1 time file2.exe
than stop
and go again to file1.exe
when file1.exe 5 times
than stop
than file2.exe
than stop
than again 5 times file1.exe
than stop
than file2.exe
than stop finally


if that is possible with batch file and two txt files for log cycles
batch file is runned by task scheduler every hour. Number of first and second cycles will change if it will be needed, so thats why also need txt file to check how many times some cycle is needed.
Failure to leave out important details usually leads to a script that doesn't work for your needs.  Provide as much detail as possible about what you are currently doing and what you need the final result to be.
Title: Re: number of times started
Post by: Jaka on November 04, 2014, 06:51:02 AM
yes you are 100% right.
So I will make step by step what script should do. I hope this will be more clear what I need, if not please let me know.

1) Stating scritp
1. checking first txt file for number
2. if number is not 5 going to next line
3. starting file1.exe which check and makes backup
4. script write 1 to txt
5. script close

2) starting script again
1. checking first txt file for number
2. if number is not 5 going to next line
3. starting file1.exe which check and makes backup
4. script write 2 to txt
5. script close
....................................... ..... 5 times
5) starting script again
1. checking first txt file for number
2. if number is not 5 going to next line
3. starting file1.exe which check and makes backup
4. script write 5 to txt
5. script close

6) starting script again
1. checking first txt file for number
2. number is now 5 in txt file so it will not start file1.exe
3. but will go to second part of script and
4. check second txt file if there is not 3 in that file
5. it will start file2.exe
6. and write 1 in second txt file

after that it will go to 1) again

................................3 times

8 ) starting script again
1. checking first txt file for number
2. number is now 5 in txt file so it will not start file1.exe
3. but will go to second part of script and
4. check second txt file id there is 3 in that file
5. it will stop

script won't start again until I delete one or both txt files with number 5 or 3.

first part of script runs 5 times and than second part 1 time and than again first part 5 times and than second part 1 time and again frist part 5 times and second part 1 time and after that stops until one or both of txt files are deleted.
Title: Re: number of times started
Post by: Lemonilla on November 04, 2014, 09:23:03 AM
I think your looking for something like this:
Code: [Select]
For /l %%b in (1,1,3) do (
For /l %%a in (1,1,5) do (
Start file1.exe
Echo %%a >log1.log
)
Start file2.exe
Exho %%b >log2.log
)

Check the switches for start.
Title: Re: number of times started
Post by: Blisk on November 04, 2014, 09:59:14 AM
Lol, keyboard mess with me.
This script I have already see somewhere I will post it if I find it.
Title: Re: number of times started
Post by: Jaka on November 04, 2014, 11:52:00 AM
I think your looking for something like this:
Code: [Select]
For /l %%b in (1,1,3) do (
For /l %%a in (1,1,5) do (
Start file1.exe
Echo %%a >log1.log
)
Start file2.exe
Exho %%b >log2.log
)

Check the switches for start.

Sorry this doesn't work.
I tested it with notepad.exe and calc.exe
And when I started script it has opened 15 notepads and 3 calcs.
But it should open only one notepad when I start a script
and second time when I start a script also just one notepad
and third time also
and fourth time also
and fifth time it should not open notepad.exe but calc.exe
and sixth time it should opend notepad.exe
and seveth also notepad.exe
and so on until 10th time
than it should open calc.exe instead notepad.exe
and 11th time should open notepad.exe
and 12th time should also opened notepad.exe
and 13th time also notepad.exe
until 15th time than it should not opened notepad.exe but calc.exe
and than when I start script nothing happend until I delete one or both txt file
than it should start all over again.
Title: Re: number of times started
Post by: patio on November 04, 2014, 01:55:56 PM
Lol, keyboard mess with me.
This script I have already see somewhere I will post it if I find it.

HuH ? ?
Title: Re: number of times started
Post by: Lemonilla on November 04, 2014, 02:22:14 PM
I intentionally gave you a semi finctional program so you would learn how to do it yourself.  Reread my post.
Title: Re: number of times started
Post by: Squashman on November 04, 2014, 03:09:48 PM
I think I understand what you are doing now and why the log file is needed. Will see if I can get something written up tomorrow but I know it is already tomorrow some where down under.
Title: Re: number of times started
Post by: Jaka on November 05, 2014, 12:23:59 AM
I intentionally gave you a semi finctional program so you would learn how to do it yourself.  Reread my post.
thank you, but I think you expect too much from me. I am really lame for this.
Title: Re: number of times started
Post by: foxidrive on November 05, 2014, 02:23:22 AM
You want to run file1.exe five times, and then file2.exe just one time, and loop?

Code: [Select]
@echo off
:loop
for %%a in (1 2 3 4 5) do "file1.exe"
"file2.exe"
goto :loop


This expects your programs to close by themselves once they have finished. 
If they don't close by themselves, then how will me know when to close them?


Title: Re: number of times started
Post by: Jaka on November 05, 2014, 02:30:51 AM
Program will close itself when it finishes backup - file1.exe
and file2.exe also because it is for reboot. This script is not started that often, so program have no time to close, but it is started with task schedule every hour.
file1.exe loop 5 times and than goes to file2.exe and than again loop 5 times and than goes to file2.exe.
but that happend only when I start batch(task scheduler), not by itself, like this script which opens 15 file1.exe and 3 file2.exe.
it should open only one file1.exe
Title: Re: number of times started
Post by: foxidrive on November 05, 2014, 09:10:48 AM
Program will close itself when it finishes backup - file1.exe
and file2.exe also because it is for reboot.

The batch file is not going to keep running in a loop if a reboot happens.

Quote
This script is not started that often, so program have no time to close, but it is started with task schedule every hour.
file1.exe loop 5 times and than goes to file2.exe and than again loop 5 times and than goes to file2.exe.
but that happend only when I start batch(task scheduler), not by itself, like this script which opens 15 file1.exe and 3 file2.exe.
it should open only one file1.exe

You said earlier that you tested it with notepad.  There will be multiple copies of notepad open, and this is the expected behaviour, do you know why?
Title: Re: number of times started
Post by: Squashman on November 05, 2014, 09:12:44 AM
The batch file is not going to keep running in a loop if a reboot happens.
I think this is why he said we need to keep track of the number of times it has ran in a log file.
Title: Re: number of times started
Post by: Jaka on November 05, 2014, 09:34:03 AM
I think this is why he said we need to keep track of the number of times it has ran in a log file.
yes, that is it.
every time I start batch it will write log in txt file for example for notepad
and also everytime after that is stared calc.exe it will write log in second txt file
so script knows what to do nex time I start it.
Title: Re: number of times started
Post by: foxidrive on November 05, 2014, 09:45:42 AM
I think this is why he said we need to keep track of the number of times it has ran in a log file.

I read the first two explanations and then my eyes glazed over.



Title: Re: number of times started
Post by: Lemonilla on November 05, 2014, 11:00:25 AM
See if this is what you are looking for.  I must have missed when you said that you were rebooting between each execution.

Code: [Select]

@echo off
setlocal EnableDelayedExpansion
if exist log1.log set /p t1=<log1.log
if not defined t1 set t1=1
if %t1% LEQ 5 (
file1.exe
set /a t1+=1
echo !t1! >log1.log
) else (
if exist log1.log set /p t2=<log2.log
if not defined t2 set t2=1
if !t2! LEQ 3 (
file2.exe
set /a t2+=1
echo !t2! >log2.log
))


EDIT: Missed a close parenthesis at the end, was fixed.
Title: Re: number of times started
Post by: Jaka on November 05, 2014, 11:00:50 AM
I read the first two explanations and then my eyes glazed over.
I am sorry if this is to complicated and to hard to do.
Title: Re: number of times started
Post by: Squashman on November 05, 2014, 11:22:13 AM
Might want to fix that.
Code: [Select]
if exist log1.log set /p t2=<log2.log
Title: Re: number of times started
Post by: Squashman on November 05, 2014, 11:23:54 AM
I am sorry if this is to complicated and to hard to do.
The only hard part is getting the user to explain what exactly they want to do and the information we need to code it.
Title: Re: number of times started
Post by: Jaka on November 05, 2014, 12:30:18 PM
See if this is what you are looking for.  I must have missed when you said that you were rebooting between each execution.

Code: [Select]

@echo off
setlocal EnableDelayedExpansion
if exist log1.log set /p t1=<log1.log
if not defined t1 set t1=1
if %t1% LEQ 5 (
file1.exe
set /a t1+=1
echo !t1! >log1.log
) else (
if exist log1.log set /p t2=<log2.log
if not defined t2 set t2=1
if !t2! LEQ 3 (
file2.exe
set /a t2+=1
echo !t2! >log2.log
))


EDIT: Missed a close parenthesis at the end, was fixed.

YAY this almost work.
I tested again with notepad and calc.

And it opens 5 times notepad and than opens 3 times calc.
This is almost it

But it should open 5 times notepad and than 1 time calc and than goes again to notepad 5 times and than again 1 calc and than goes again 5 times to notepad and again 1 time calc and stop.
Title: Re: number of times started
Post by: Jaka on November 05, 2014, 12:31:29 PM
The only hard part is getting the user to explain what exactly they want to do and the information we need to code it.
yes I know, but I am trying to explain really hard how this should work. I know one single thing and script doesn't work right.
Title: Re: number of times started
Post by: patio on November 05, 2014, 02:04:55 PM
Try harder...either on your work...or the explanation of what
you want to do...
Title: Re: number of times started
Post by: Squashman on November 05, 2014, 02:15:41 PM
So let us get this straight.

Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 1 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 2 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 3 to log2.txt

Lather, rinse, repeat..........
Title: Re: number of times started
Post by: Jaka on November 05, 2014, 02:29:14 PM
So let us get this straight.

Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 1 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 2 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 3 to log2.txt

Lather, rinse, repeat..........

yes exactly that
and  when I delete log1.txt or log2.txt or both
than it will start all over again from start

Now I see how I should explain what script sould do. Sorry for my bad explanation.
This your is really great, now I will know for next time. Today I learned something more.
 ;D
Title: Re: number of times started
Post by: Squashman on November 05, 2014, 02:44:35 PM
Hmmm,
Not sure about your logic with deleting one file or both.  What happens when you delete log1.txt and log2.txt has a value of 3.  The way I would understand your logic is that file1.exe would run 5 times and file2.exe will never run.  Is that correct?
Title: Re: number of times started
Post by: patio on November 05, 2014, 02:53:54 PM
No logic...and i just thought about the overall goal of this project...i came up with HuH ? ?
Title: Re: number of times started
Post by: Jaka on November 06, 2014, 12:45:05 AM
Hmmm,
Not sure about your logic with deleting one file or both.  What happens when you delete log1.txt and log2.txt has a value of 3.  The way I would understand your logic is that file1.exe would run 5 times and file2.exe will never run.  Is that correct?

NO that is not planned to delete it before cycle is over but when cycle is stopped. That means when all finished like you write in your diagram of scrypt.
Do you think I should have another script to delete txt files and to prevent deletion before cycle is not finished?
So it can start all over, because this script is somekind of watchdog.
Title: Re: number of times started
Post by: Jaka on November 07, 2014, 03:22:18 AM
Can I hope for this script?  :-\
Title: Re: number of times started
Post by: foxidrive on November 07, 2014, 03:52:46 AM
Can I hope for this script?  :-\

Yes, you can hope.

It should be said that when you employ and pay a programmer, then you would need to tell them all the actual details about the task.
In this forum you ask for free help, and somehow you think people can do an effective job without actual information about the task.

Someone could write a script based upon your poor information, but it's happened so many times in the past that the
script doesn't work, and has to be re-written again, because the task wasn't described properly and the script fails.


Title: Re: number of times started
Post by: Jaka on November 07, 2014, 04:00:18 AM
you can see on all of my posts I tried really hard to explain what I need.
And you can't expect your way of  thinking as a programmer is the same as mine, when I don't know nothing about propgramming.
You programmers think differend than other people, that's why is hard to explain what people need.
Title: Re: number of times started
Post by: foxidrive on November 07, 2014, 04:39:57 AM
you can see on all of my posts I tried really hard to explain what I need.
And you can't expect your way of  thinking as a programmer is the same as mine, when I don't know nothing about propgramming.
You programmers think differend than other people, that's why is hard to explain what people need.

I'm not sure you understand what I wrote. 

Title: Re: number of times started
Post by: Jaka on November 07, 2014, 05:13:36 AM
yes, I should pay someone for the script. I understand that. If I have enough money and if that was for some company project  than I payed it.
But it is for my project, that's why I am here asking for help.
And if that is too much or you or anyone will not help me, than you should say so and I won't waste your time any more and my time banging my head how to explaine what I need.

Thank you anyway I will go somewhere else, where people will help me.
Title: Re: number of times started
Post by: foxidrive on November 07, 2014, 07:01:46 AM
yes, I should pay someone for the script. I understand that.

You don't understand though.  When you pay someone, for them to do a good job you have to tell them exactly what the task is.
That means the programs being used, and what the aim of the task is, and the directories being used and the operating system etc.
You let them figure out the best way to solve your task.

Here you want the same task solved, and the people reading can give you the best solution - if you only tell them the same things that you would have to tell a paid person.

Without all that information you are likely to get a script that doesn't work correctly all the time, or a script that is more complicated than it needs to be.

On top of that, the people who read your posts and help you (for free) get no enjoyment from the task, and will simply not even reply because they have wasted their time in the same situation many times before.

I've tried to explain to you that your description of the task is so limited that it's impossible to even know what you are doing, so your readers can't use their experience to help you.

Title: Re: number of times started
Post by: Jaka on November 07, 2014, 07:18:22 AM
OK thank you, I understand that I will try to be more specific next time at the start.
Title: Re: number of times started
Post by: foxidrive on November 07, 2014, 07:52:20 AM
OK thank you, I understand that I will try to be more specific next time at the start.

You can start again now and provide all the information about the task, to help your readers to help you.

Title: Re: number of times started
Post by: Jaka on November 12, 2014, 12:16:51 PM
I have been verry bussy and rethink all over again and here it is how script should work, step by step.

Your scheduled task will fire.
The batch file will check if stop.txt exist
If stop.txt exist, nothing happends
if stop.txt not exist it will proceed
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 1 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 2 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 3 to log2.txt
The batch file will create stop.txt
Title: Re: number of times started
Post by: Jaka on November 18, 2014, 01:14:57 PM
nobody writes nothing is that mean i still didn't write good what I need?  ???
Title: Re: number of times started
Post by: Lemonilla on November 18, 2014, 03:02:38 PM
Look at these commands and write it yourself.

set /p
set /a
if
start
Title: Re: number of times started
Post by: Jaka on November 19, 2014, 07:24:36 AM
Thank you, but I don't know how.
Title: Re: number of times started
Post by: Squashman on November 19, 2014, 07:54:26 AM
End of year for me.  My time is precious.  If it isn't a batch file I can write in a few lines of code off the top of my head in 2 minutes I can't afford the time to write it.
Sorry.
Title: Re: number of times started
Post by: Jaka on November 19, 2014, 09:50:04 AM
End of year for me.  My time is precious.  If it isn't a batch file I can write in a few lines of code off the top of my head in 2 minutes I can't afford the time to write it.
Sorry.
It is a batch file and yes I understand, thank you anyway. I will try to find help somewhere else.
Title: Re: number of times started
Post by: Lemonilla on November 19, 2014, 07:16:23 PM
try this:
Code: [Select]
@echo off
setlocal EnableDelayedExpansion
set file1=FILE1.exe
set file2=FILE2.exe


if not exist log1.txt (
REM we are on our first run
echo 1 >log1.txt
%file1%
) else (
REM iteration > 1
set /p num=<log1.txt
if "!num!"=="5" (
REM run file2
if not exist log2.txt (
REM First time running file2
echo 1 >log2.txt
%file2%
) else (
set /p num2=<log2.txt
if !num2! LEQ 3 exit /b
set /a num2+=1
echo !num2! >log2.txt
%file2%
)
) else (
set /a num+=1
echo !num! >log.txt
%file1%
)
)
Title: Re: number of times started
Post by: Jaka on November 20, 2014, 01:53:51 AM
thank you for batch.
But something not working.
When I start batch it makes log1.txt and write 1 into it
when i start second time it makes log.txt and write 2 into it
and thats it, no matter how many times I start script after that it opens file1.exe and nothing happend with log1.txt and log.txt
Title: Re: number of times started
Post by: Lemonilla on November 20, 2014, 05:00:12 PM
Walk your way through the code and follow the logic.  There is a minor fix that needs to be done that you can do yourself by examining the parts that work.
Title: Re: number of times started
Post by: Squashman on November 20, 2014, 07:28:56 PM
Hint. How many log files are you suppose to have and what should they be named.
Title: Re: number of times started
Post by: Jaka on November 22, 2014, 04:30:19 AM
OK I think I found a problem :D
It was the end of script I changed log.txt to log1.txt
but now it counts over 5, to 6 or 7 or 8, etc. And doesn't open file2.exe, still opens file1.exe.



Code: [Select]
)
) else (
set /a num+=1
echo !num! >log1.txt
%file1%
)
)
Title: Re: number of times started
Post by: Jaka on November 25, 2014, 04:33:07 AM
sorry this still not working  :-\
Title: Re: number of times started
Post by: Jaka on November 28, 2014, 09:27:05 AM
Can someone please help me to repair this script, please?  :(
Title: Re: number of times started
Post by: foxidrive on November 28, 2014, 09:31:07 AM
Just repeating myself here: for someone to give you a script that works reliably then you have to tell them exactly what the task is.
That means the programs being used, and what the aim of the task is, and the directories being used and the operating system etc.

Title: Re: number of times started
Post by: patio on November 28, 2014, 09:33:50 AM
That comes on Page 7...
Title: Re: number of times started
Post by: Jaka on November 28, 2014, 09:37:09 AM
Just repeating myself here: for someone to give you a script that works reliably then you have to tell them exactly what the task is.
That means the programs being used, and what the aim of the task is, and the directories being used and the operating system etc.

I did it on page 3.
Is this not enough? What I should do more? Can you help me explain how to do it than, please?

our scheduled task will fire.
The batch file will check if stop.txt exist
If stop.txt exist, nothing happends
if stop.txt not exist it will proceed
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 1 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 2 to log2.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 1 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 2 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 3 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 4 to log1.txt
Your scheduled task will fire.
The batch file will run file1.exe and write 5 to log1.txt
Your scheduled task will fire.
The batch file will run file2.exe and write 3 to log2.txt
The batch file will create stop.txt
Title: Re: number of times started
Post by: foxidrive on November 28, 2014, 09:40:48 AM
.
Title: Re: number of times started
Post by: foxidrive on November 28, 2014, 09:50:57 AM
Let me be clearer: nobody wants to help you because you purposely aren't describing the task.
Title: Re: number of times started
Post by: Jaka on November 28, 2014, 10:03:56 AM
Just repeating myself here: for someone to give you a script that works reliably then you have to tell them exactly what the task is.
That means the programs being used, and what the aim of the task is, and the directories being used and the operating system etc.

I can't tell you which program because it is some old program for backup, it works on WIN XP. I can only give it to you.
Directories used is D:\backup\script there will be this batch too
backup folder where backup files are
E:\backup_daily\monday.atk

that batch file will be started by task scheduler every day and it will start file1.exe which check backup if exsist and if backup is missing it will restart program for backup, that is done with file1.exe
when program is restared 5 times than it should restart PC, that is flie2.exe and when PC is restarted than goes to backup program and when that cycle with restarting comes to 3 times for restart pc and 15 times for restart backup program it will stop all..

file1.exe is script which check if file monday.atk exist, if not than check running process of backup software, stop it and start it again.
file2.exe is just restart script

Title: Re: number of times started
Post by: Jaka on November 28, 2014, 10:05:03 AM
Let me be clearer: nobody wants to help you because you purposely aren't describing the task.
I see that, now I hope I manage to describe correctly.
Title: Re: number of times started
Post by: patio on November 28, 2014, 10:20:48 AM
How can you not know what program it is ? ?

Title: Re: number of times started
Post by: Jaka on November 28, 2014, 02:03:22 PM
How can you not know what program it is ? ?
It was maded by software company which maded software for our accounting department it is a part of it.
Why Is that important? Batch should run file1.exe and file2.exe
Title: Re: number of times started
Post by: patio on November 28, 2014, 04:34:50 PM
This Topic is gonna be closed real soon...for lack of info.
Title: Re: number of times started
Post by: foxidrive on November 29, 2014, 12:00:04 AM
Why Is that important?

Some people who ask questions have trouble even editing a script to add details, without introducing errors.
They then say that the script doesn't work, and another 12 messages later we find out the reason.

Other people refuse to tell us the directory names and filenames, and when they get a script they say it doesn't work.
After another 12 messages we find out they are using non-latin character sets.

These are two scenarios and there are dozens more.

The result of not supplying the requested details is that the people who are providing their time and knowledge for free
end up wasting their own time, and they get backchat from the OP - who doesn't know how to write script in the first place
but is suddenly telling us that we don't need to know that.


It has reached the point where I don't believe your recent replies are truthful, and after 4 pages where you have been asked several times to provide information - I vote for closing the thread too.

Title: Re: number of times started
Post by: Salmon Trout on November 29, 2014, 04:29:32 AM
E:\backup_daily\monday.atk

I bet this is ATK EZ-Backup (website now defunct, I think)
Title: Re: number of times started
Post by: Jaka on November 29, 2014, 09:31:33 AM
Some people who ask questions have trouble even editing a script to add details, without introducing errors.
They then say that the script doesn't work, and another 12 messages later we find out the reason.

Other people refuse to tell us the directory names and filenames, and when they get a script they say it doesn't work.
After another 12 messages we find out they are using non-latin character sets.

These are two scenarios and there are dozens more.

The result of not supplying the requested details is that the people who are providing their time and knowledge for free
end up wasting their own time, and they get backchat from the OP - who doesn't know how to write script in the first place
but is suddenly telling us that we don't need to know that.


It has reached the point where I don't believe your recent replies are truthful, and after 4 pages where you have been asked several times to provide information - I vote for closing the thread too.

Ok you can lock down this topic, I done my best explaining about this script, I assume you have joke on me here, because I have no skills with programming. And it is obvious alot of laugh at me.
Thank you Lemonilla for helping script almost worked. Will ask somewhere else for help, where people won't make and idiot out of me.
Title: Re: number of times started
Post by: Squashman on November 29, 2014, 11:22:03 AM
Nobody is making jokes about this. We are all as frustrated as you are.
Title: Re: number of times started
Post by: Jaka on November 29, 2014, 11:45:43 AM
If script do what I writed line after line for every action, that will be enough, but some are here just to make fun out of us which knows nothing about scripts. 5 pages and still not explained well, sorry but it is obvious joke on me.
Title: Re: number of times started
Post by: Salmon Trout on November 29, 2014, 12:06:19 PM
some are here just to make fun out of us which knows nothing about scripts.

I thought you had finished here. Is this about a script, or your ego?
Title: Re: number of times started
Post by: Jaka on November 29, 2014, 01:38:02 PM
I thought you had finished here. Is this about a script, or your ego?
what has my ego to do with your bullying?
Lock the *censored* topic, it is worthless
Title: Re: number of times started
Post by: Lemonilla on November 29, 2014, 03:01:21 PM
What was wrong with the scripts that were proposed?  It is hard to fix a script when you don't know what isn't working about it.  I proposed multiple scripts that all would have worked to the degree that was testable by me. 

At this point though, you would need to be very cooperative to rebuild the bridges you have burned with the other members of the forum.  I would recommend posting your script EXACTLY as you have it in the file, as well as to post the output of 'dir' commands for every directory your script references\uses.  Put these in code tags and post them as well as the exact text of the error that you are getting.  It is easiest to get this by running your script from command line.  This is done by opening up cmd.exe, navigating to the folder with your script in it, and typing the file name.  If you can, post %file1% and %file2% as well as an attachment.  These might be where the error is located.

Most of the people here wish to help you.  After all that is why they are posting on this forum without pay.  It is however just as frustrating to us as it is to you when we cannot get accurate information about the problem. 
Title: Re: number of times started
Post by: patio on November 29, 2014, 05:52:48 PM
On that sad note...
Topic Closed.