8

I know that you can run and live-reload ahk scripts. And I've seen the scintilla-based editor that provides debugging. But, is there any kind of command-line-based REPL?

I was testing the statement to get the active window's process name and thought it would really helpful!

ahk> WinGet, active, ProcessName, A
powershell.exe
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
  • I really like using a REPL with various languages, but AutoHotKey presents certain challenges. Your example raises a big question: how should the REPL itself be handled? Presumably it would be active when you hit enter, so you'd get the process name of the REPL, not powershell.exe. – Dane Feb 26 '14 at 18:47
  • We could probably create a really simple REPL with AHK by presenting a text-entry GUI, creating a temp.ahk file for execution, and wrapping the code in the temp.ahk file with something so that we can pass back a return value. We could kill or hide the text-entry GUI during execution to keep it out of the way. – Dane Feb 26 '14 at 19:35
  • 1
    Looks like this might be the best there is: http://www.autohotkey.com/board/topic/3152-execute-ahk-code-dynamically/?p=273246 – Dane Feb 26 '14 at 19:36
  • @Dane, would you summarize that post in an answer and maybe copy/paste the code from the forum into a [gist](http://gist.github.com)? I'd be inclined to upvote and award you the answer :) – Anthony Mastrean Aug 05 '14 at 15:26

2 Answers2

3

This may also be something like what you're looking for

enter image description here

Forum Topic link

GitHub link

Hope it helps

blackholyman
  • 1,440
  • 1
  • 10
  • 14
2

I open my AHK script NotePad (or Vim, or whatever). Then I add my test code as the first line. I have a hotkey defined to reload the script.

  MsgBox, Hello World

  ^+r::
  Reload
  Return

So I edit, then Ctrl-s, then Ctrl-Shift-R, test code runs. Works pretty well.

Myles Prather
  • 171
  • 1
  • 12