Jdavis Posted December 9, 2008 Share Posted December 9, 2008 Admittedly, I haven't done a lot of testing on this on my own before posting. There's a series of commands I'm sending to a command window, but it seems inefficient to do Run( @ComSpec ... ) for every command I want to send since I don't want to open a bunch of command windows. Likewise, it doesn't seem quite right using Send() to send all my commands to the active window. Are these my most valid options? I thought there may be a way to just open one command window via Run( @ComSpec) and then use successive Run() commands to run the executables/commands inside the previously opened command window. I hope that didn't sound needlessly complicated. Link to comment Share on other sites More sharing options...
KaFu Posted December 9, 2008 Share Posted December 9, 2008 #614066 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Andreik Posted December 9, 2008 Share Posted December 9, 2008 You can also create a BAT script and then run it. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Jdavis Posted December 9, 2008 Author Share Posted December 9, 2008 Yeah, I was going to go the batch file route if I couldn't find a more AutoIt exclusive solution. Link to comment Share on other sites More sharing options...
Andreik Posted December 9, 2008 Share Posted December 9, 2008 Yeah, I was going to go the batch file route if I couldn't find a more AutoIt exclusive solution. AutoItSetOption('WinTitleMatchMode',2) Run('cmd',@SystemDir,@SW_HIDE) WinWait("cmd.exe") WinActivate("cmd.exe") WinWaitActive('cmd.exe') Send('cd C:' & @CRLF) Send('ver' & @CRLF) Send ('doskey /HISTORY' & @CRLF) WinSetState("cmd.exe","",@SW_SHOW) Sleep(7500) ProcessClose("cmd.exe") When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Jdavis Posted December 9, 2008 Author Share Posted December 9, 2008 I appreciate that, but I think it's somewhat more complicated because what I need to run are executables that take a few seconds to run before they're through. Link to comment Share on other sites More sharing options...
KaFu Posted December 9, 2008 Share Posted December 9, 2008 (edited) RunWait() ? Or maybe what I often do to add a timeout... $run_dos_pid = Run() $flag_run_dos_timestamp = TimerInit() While 1 If TimerDiff($flag_run_dos_timestamp) > 5000 Then ProcessClose($run_dos_pid) ExitLoop EndIf Wend If the exes produce and output maybe add an FileExist check to the loop to exit it... or even better a check against file-usage with _FileInUse() (http://www.autoitscript.com/forum/index.php?showtopic=85339&view=findpost&p=613340)? Edited December 9, 2008 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) 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