Jump to content
Sign in to follow this  
ch00sen1

$CommandLine/Prompt

Recommended Posts

ch00sen1

Group,

Is there a way to pause command line entry for a exe file.

For example:

.../myfile.exe "pram1" "pram2" pram3"

is a schedule task on my machine that runs every five minutes. But, some times it takes 6 mins to complete and other times

3 mins to complete.

If myfile.exe takes longer than 5 mins to finish. I don't wont to start myfile.exe until it's finish. And, I think all of this can be done from the command prompt.

Share this post


Link to post
Share on other sites
pierrotm777

Group,

Is there a way to pause command line entry for a exe file.

For example:

.../myfile.exe "pram1" "pram2" pram3"

is a schedule task on my machine that runs every five minutes. But, some times it takes 6 mins to complete and other times

3 mins to complete.

If myfile.exe takes longer than 5 mins to finish. I don't wont to start myfile.exe until it's finish. And, I think all of this can be done from the command prompt.

I should like to know how to also !

Share this post


Link to post
Share on other sites
martin

Group,

Is there a way to pause command line entry for a exe file.

For example:

.../myfile.exe "pram1" "pram2" pram3"

is a schedule task on my machine that runs every five minutes. But, some times it takes 6 mins to complete and other times

3 mins to complete.

If myfile.exe takes longer than 5 mins to finish. I don't wont to start myfile.exe until it's finish. And, I think all of this can be done from the command prompt.

It doesn't sound like it should be difficult to fix but how are you running myfile.exe? With a Run Command, ShellExecute? Is myfile.exe something you wrote?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
ch00sen1

It doesn't sound like it should be difficult to fix but how are you running myfile.exe? With a Run Command, ShellExecute? Is myfile.exe something you wrote?

myfile.exe is a something I wrote. It basicly runs a query on the given "pram1" "pram2" "pram3". And sometimes the query takes 3mins and sometimes it takes 6min to complete. But, for how long it takes I need the updated results. The problem is that this needs to be ran every five minutes.

But, If myfile.exe is not complete I don't wont to start a new myfile.exe until the first process is finish.

In some cases I use _ProcessComplete() to start and stop myfile.exe. So I won'e have two of them running at the sametime. This is helpful, but if something crazy happens the file still can be run from the command line.

For Example:

..../ping -t www.autoITscript.com

- only stops when I press Ctrl+C. This means that the process has finished and the command prompt is ready for a new input.

-This is kind of the same concept that I would like to have for myfiel.exe

Share this post


Link to post
Share on other sites
martin

myfile.exe is a something I wrote. It basicly runs a query on the given "pram1" "pram2" "pram3". And sometimes the query takes 3mins and sometimes it takes 6min to complete. But, for how long it takes I need the updated results. The problem is that this needs to be ran every five minutes.

But, If myfile.exe is not complete I don't wont to start a new myfile.exe until the first process is finish.

In some cases I use _ProcessComplete() to start and stop myfile.exe. So I won'e have two of them running at the sametime. This is helpful, but if something crazy happens the file still can be run from the command line.

For Example:

..../ping -t www.autoITscript.com

- only stops when I press Ctrl+C. This means that the process has finished and the command prompt is ready for a new input.

-This is kind of the same concept that I would like to have for myfiel.exe

You can use _Singleton to make sure that your exe only has one instance running. But I think I would still use something like I suggested before, maybe more like this.

(Basic idea only, without params)

Global $MyExePID = 0
AdlibRegister("runMyExe",3*60000)
HotKeySet("^!K","StopMyExe");Ctrl Alt K


while 1
 sleep(90)
wend

Func RunMyExe()
 If processExists($MyExePID) then return;still running so let it continue till it has finished

 $MyExePID = Run("MyExe.exe")
 
EndFunc
 

Func StopMyExe()

 while processExists("MyExe.exe")
 ProcessClose("MyExe.exe")
    sleep(90)
 wend
 ;or put the hotkey in your exe?

Endfunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.