K!dIcarus Posted January 28, 2006 Share Posted January 28, 2006 (edited) I was unable to find a specific example that relates to the problem I'm having. Here is the important section of the autoIt script Currently I have this run("cmd") WinWaitActive("C:\WINNT\system32\cmd.exe") send($blatCommand) send("{ENTER}") sleep(3000) send("exit{ENTER}") the blat string is the command needed to send an e-mail using Blat, a windows command line smtp e-mailer. The execution of the script take a number of seconds before it returns to the next prompt. I need to exit out of the prompt as soon as it has completed. Does anyone know a good way to tell the execution of the script has completed that doesn't just try to guess when it would be done? The sleep command doesn't really work because sometimes the computer runs slow and hasn't completed before I try to exit it. Any suggestions are welcome. Thanks. Edited January 28, 2006 by K!dIcarus Link to comment Share on other sites More sharing options...
greenmachine Posted January 28, 2006 Share Posted January 28, 2006 You can use the built-in switch /c to make command prompt close itself after the single command. You can also specify @SW_HIDE as a run option so the user won't see the window. Your complete run command would look something like this: Run (@ComSpec & " /c " & $blatCommand, @WorkingDir, @SW_HIDE) If your $blatCommand has any spaces in it, you will probably need to edit it to make it look like this: Run (@ComSpec & " /c " & '"' & $blatCommand & '"', @WorkingDir, @SW_HIDE) The quotes are in the format ' " ' Link to comment Share on other sites More sharing options...
billmez Posted January 28, 2006 Share Posted January 28, 2006 (edited) I was unable to find a specific example that relates to the problem I'm having. Here is the important section of the autoIt script Currently I have this run("cmd") WinWaitActive("C:\WINNT\system32\cmd.exe") send($blatCommand) send("{ENTER}") sleep(3000) send("exit{ENTER}") the blat string is the command needed to send an e-mail using Blat, a windows command line smtp e-mailer. The execution of the script take a number of seconds before it returns to the next prompt. I need to exit out of the prompt as soon as it has completed. Does anyone know a good way to tell the execution of the script has completed that doesn't just try to guess when it would be done? The sleep command doesn't really work because sometimes the computer runs slow and hasn't completed before I try to exit it. Any suggestions are welcome. Thanks. From the help file for the run command Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] ) ; this will also work for RunWait Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE) When you are runniing a DOS command or batch file (which is basically what BLAT is), run it in a command processor (@ComSpec). The /c parameter tells the command proc to exit after completion. If you wanted the cmd window to remain open, use the /k parameter instead. In order to ind this answer you would have had to look in the help file for run, see the example for @Comspec, and then search the DOS help for CMD to get the parameters. Some of the answers for AutoIt are often in windows documentation. If you have the ability to install programs on the server you are using BLAT on, you may wish to look into the free version of JMail. It is a great mail dll that you should be able to access using dllcall, from ASP, vbscript or perlscript. [edit] After posting this I saw the reply from greenmachine, and he is right with the BLAT command. As I recall there are at least 4 parameters to it with spaces, and if you have any spaces in the subject parameter, it needs to be quoted, so you will have to be careful to properly quote your BLAT command. [/edit] HTH, billmez Edited January 28, 2006 by billmez Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now