autohotkey - Using AHK v1 to save a screenshot from adb (redirect binary output to a file) - Stack Overflow

In an AHK script, I'm trying to redirect the binary output from adb to a file. adb exec-out screen

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.

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.

Share Improve this question asked Mar 22 at 20:53 hoytdjhoytdj 1643 silver badges14 bronze badges 3
  • 1 Redirecting stdout via greater sign in a command is handled by the command interpreter like cmd.ese. Thus you may want to execute the ad command in cmd.exe instead of AHK itself, then redirection will also work. cmd.exe /c adb exec-out ... > Screenshot.png You may need to do some experiments to find the correct quoting for the redirect to screenshot.png part to be executed on PC side in cmd. – Robert Commented Mar 23 at 0:04
  • @Robert That's what I've been doing. runWait, %ComSpec% /c adb exec-out screencap -p > Screenshot.png. When I run the same command directly in the windows terminal, it works fine. When I run it via runWait, the file is corrupt. – hoytdj Commented Mar 23 at 2:05
  • Never mind, you're right. It was just a quoting issue. After playing around for way to long with Gdip functions, I ended up just needing an extra set of quotes around %command% – hoytdj Commented Mar 23 at 2:15
Add a comment  | 

1 Answer 1

Reset to default 0

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744303864a4567634.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信