Jump to content

Why is this not working?


Recommended Posts

Hi,

I am writing a script, and in this script I need to run an executable from the command prompt.

I want to pause the execution of the script until the exe is done (it can take between 20sec - 3min)

I am using a loop to determine when the exe ends, but for some reason it passes thru the loop once and continues with the script.

run("cmd")

send("Find_Glitches")

send("{ENTER}")

do

sleep(500);

until (wingettitle("[active]") <> "C:\WINDOWS\system32\cmd.exe - Find_Glitches")

winclose("C:\WINDOWS\system32\cmd.exe")

I know for a fact that I have the correct window title, but for some reason the CMD window is closed before the end of the program.

Anyone?

p.s

I cannot use runwait("Find_Glitches") for some reason the exe does not run properly.

Link to comment
Share on other sites

Here an example with Notepad because Find_Glitches I don't know! Should work similar:

Run(@WindowsDir & "\Notepad.exe", "", @SW_MAXIMIZE)

While Sleep(100) * WinGetTitle("[CLASS:Notepad]", "")
WEnd

Exit

Maybe you can upload Find_Glitches...

BR,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Thanks all, but I am still having problems with this.

When I use the RunWait command the Find_Glitches program reports that it cannot find a file needed for running.

runwait("K:\Users\Dave\Find_Glitches","K:\Users\Dave\")

This is because the AutoIt is not running it from the directory where Find_Glitches.exe resides.

Any solution?

Link to comment
Share on other sites

As JohnOne pointed out, you need to specify where working directory which is done in the second param. Think of it as the folder you will cd to before you run the command.

Simply doing runwait("K:\Users\Dave\Find_Glitches") will execute the program in the default working directory.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

As JohnOne pointed out, you need to specify where working directory which is done in the second param. Think of it as the folder you will cd to before you run the command.

Simply doing runwait("K:\Users\Dave\Find_Glitches") will execute the program in the default working directory.

But as you can see in the example I gave, I did specify the "working dir" parameter of the Run command, and it is still not working properly.
Link to comment
Share on other sites

But as you can see in the example I gave, I did specify the "working dir" parameter of the Run command, and it is still not working properly.

Do this. Open a command window, cd to the directory and type 'start Find_Glitches'. When that is done, post the dir you executed the command from. If it does not work from cmd line it will not work within AutoIt.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...