0

I would like to write an AHK script to be able to switch between portrait and landscape mode by a single key. Here is my first attempt not exactly what I am looking for. I am not an expert in the AHK scraping language. The script works but it shows the CMD windows for a few seconds while running the display.exe command. How to prevent opening CMD window.

F14::
    T := !T
    If T
     Run display /rotate 0 /device 3 /display none,,Hide
    else
     Run display /rotate 90 /device 3 /display none,,Hide
    return

http://noeld.com/programs.asp?cat=misc#display

Handsome Nerd
  • 4,682
  • 17
  • 55
  • 80

1 Answers1

0

I don't know which display program you are using, but here is some advice.

You could put the commands in .bat files and hide them using one of the answers in the post
Run a batch file in a completely hidden way.

As another solution, use the iRotate utility that does not create a CMD box.

The following AHK script, adapted from a github gist, uses Ctrl+F1-4 for rotating:

MyPath = C:\Program Files (x86)\iRotate\iRotate.exe

^F1::Run %MyPath% /2:rotate=0
^F2::Run %MyPath% /2:rotate=180
^F3::Run %MyPath% /2:rotate=270
^F4::Run %MyPath% /2:rotate=90
harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Thanks, I use http://noeld.com/programs.asp?cat=misc#display It seems iRotate does not support the command line and its default shortcut keys are not configurable. my AHK works great I just prefer not to see the CMD box. – Handsome Nerd Oct 16 '21 at 21:06
  • The shortcut keys in the AHK script can be anything at all. Also, the above script uses the iRotate command-line. So I don't understand your comment. – harrymc Oct 17 '21 at 08:49