adbautohotkey

Using AHK v1 to save a screenshot from adb (redirect binary output to a file)


In an AHK script, I'm trying to redirect the binary output from adb to a file. adb exec-out screencap -p > Screenshot.png However, it looks like AHK's RunWait doesn't really handle binary output.

How can I make this work?

I've toyed around with StdoutToVar and CMDRet, but don't really know what I'm doing.


Solution

  • As Robert suggest it was just a matter of properly quoting. Here's what ended up working.

    command := """" . adbPath . """ -s " . deviceAddress . " exec-out screencap -p > """ .  outputFile . """"
    RunWait, %ComSpec% /c "%command%", , Hide