Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

cmd.exe+autohotkey


  • Please log in to reply
8 replies to this topic
defila
  • Members
  • 13 posts
  • Last active: Apr 14 2013 08:52 PM
  • Joined: 01 Oct 2012
Hi guys,

I am quite new to AHK and I would like to ask for help :).
How can I set within AHK to wait until process within cmd.exe will proceed?

example:
I do have a script which will split *.xsl file to *.txt files. This will take variable amount of time (depending on size of the input from *.xls).
Cmd will proceed with splitting and after it will finish it will wait for additional action(s).

How can I set within script to check if the cmd already finished or not?

I hope I made myself clear :)
Thanks for help

  • Guests
  • Last active:
  • Joined: --

Runs an external program and waits until it finishes.
Source: http://www.autohotke...ommands/Run.htm

:?:

defila
  • Members
  • 13 posts
  • Last active: Apr 14 2013 08:52 PM
  • Joined: 01 Oct 2012

Runs an external program and waits until it finishes.
Source: http://www.autohotke...ommands/Run.htm

:?:



Thanks for reply :),

anyway, the executable files are simple *.bat files and the AHK does have a problem to run them, it will create an error log everytime, that the script is missing in *System32 folder (even if it is in place) and will stop with execution (this won't happen if the *bat file is run "manually").

However, I do not want to run it like this (I do not want to force every user to go to the folder and run each *.bat files) I just want to create a simple *.exe *. ahk script which will do every task instead of them ...
any suggestion? :)

  • Guests
  • Last active:
  • Joined: --
What is in these BAT files, chances are it is easy to translate it to a RunWait command using proper directory parameters.

CodeKiller
  • Members
  • 2067 posts
  • Last active: Feb 26 2016 09:30 AM
  • Joined: 10 Jul 2008
AHK file :
RunWait Test.bat
Msgbox OK

BAT file :
@echo TOTO
@pause

This will run the bat, wait for it to finish (e.i. press a key) then display the MsgBox as it should...
I suspect your bat files suck. :p

defila
  • Members
  • 13 posts
  • Last active: Apr 14 2013 08:52 PM
  • Joined: 01 Oct 2012

AHK file :

RunWait Test.bat
Msgbox OK

BAT file :
@echo TOTO
@pause

This will run the bat, wait for it to finish (e.i. press a key) then display the MsgBox as it should...
I suspect your bat files suck. :p


Yes, they do suck, because they are used to help end-user to do something automatically : )) (much better solution than to force anyone to do smthg through cmd)
Files will create a table for him and run selected program (which is working through Win GUI but not through AHK command)
the issue is not within the *bat or scripts because I know they are working and I am still looking for solution which should be done to check commands which ended within cmd :(

(I am quite not sure why it is impossible to run these *bat(s) via autohotkey and the error log is present ) ...

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
Try searching for "cmdret". That may be relevant.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


  • Guests
  • Last active:
  • Joined: --
I find it hard to believe you can't run a bat from AutoHotkey. Are you sure you sent the working dir in the Run command?
RunWait, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel, OutputVarPID]

defila
  • Members
  • 13 posts
  • Last active: Apr 14 2013 08:52 PM
  • Joined: 01 Oct 2012
hi guys,

I have solved it, I have re-written *.bat and add loop which checked if the window was active or not
anyway thanks for guiding me to the *.bat(s)
:)