Jump to content

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

RUN AHK COMMAND IN CMD.EXE PROMPT


  • Please log in to reply
5 replies to this topic
GS SAHU
  • Members
  • 20 posts
  • Last active: Oct 28 2015 07:14 PM
  • Joined: 09 Jun 2013

This is simple Trick. you can ahk command with msdos command in following way.

 

echo "ahk command" > %temp%\tmp.ahk | start %temp%\tmp.ahk

 

as i want to message hello world.

 

echo msgbox hello world > %temp%\tmp.ahk | start %temp%\tmp.ahk

 

in above dos command underline is ahk command.



garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

thank you GS SAHU

here an useless script uses your idea  :)

aa:="echo msgbox hello world>%temp%\tmp.ahk|start %temp%\tmp.ahk"
Run,%comspec% /k, , , pid2
WinWait, ahk_pid %pid2%
ControlSend, ,cd\`n%aa%`n, ahk_pid %pid2%
return



Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
There's no need for a temporary file with AutoHotkey v1.1.17+.
echo msgbox hello world | AutoHotkey /ErrorStdOut *
However, you might need to use the full path or add the AutoHotkey directory to the PATH env var.

Or you can use a batch file:
echo %* | "C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut *
For convenience, you can save it somewhere that's listed in the PATH env var.

If you're doing it from AutoHotkey in the first place, there's no need for cmd.exe and the console window. See ExecScript().

GS SAHU
  • Members
  • 20 posts
  • Last active: Oct 28 2015 07:14 PM
  • Joined: 09 Jun 2013

thanks for your attention in this topic.

your guide line motivate to create a batch file for ahk prompt

cls
echo off
:top
set /p ahk= "ahk:>"
if /i  "%ahk%" equ "quit" goto eof
echo %ahk% | "c:\program files\autohotkey\autohotkey.exe" /errorstdout *
goto top
:eof

save above code in ahk.bat and run it.

its provide a prompt

 

ahk:>

give a command

ahk:>msgbox hello world

ahk:>WinActivate, Untitled - Notepad

 

Limitation: we can't  carry result to next command.



tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: Apr 19 2019 05:49 PM
  • Joined: 21 Dec 2007

a rediculous step further ?

https://technet.micr...y/cc753867.aspx

just setup doskey for your favorite bits of code


Never lose.
WIN or LEARN.

GS SAHU
  • Members
  • 20 posts
  • Last active: Oct 28 2015 07:14 PM
  • Joined: 09 Jun 2013

Doskey also working in ahk prompt. we can use up down arrow keys.