Hello,
I have a program on Windows Server 2008 R2 that i am trying to have auto login. This is a citrix server and the server is set to restart every morning. The program is in startup to load every time the server restarts. I need to have this program auto login and the only thing I need is for the program to be targeted and the F9 key to be pressed when the program loads after startup but I am new to AHk and unsure how to make this.
The process is called acsuploadw and the file is located C:\ACSshare\ACS\acsuploadw.exe
Thank you guys in advance for any help with this.
How to target a program and simulate f9 key
Re: How to target a program and simulate f9 key
You need to:
This script can be placed in startup like any other program. If the window is already visible, it will be activated almost immediately and F9 will be sent.
It might also be possible (and potentially more reliable) to send F9 directly, without requiring activation.This depends on how (or on which control) the program accepts the F9 key.
If F9 is to activate a menu item and the window uses a standard type of menu, you can use MenuSelect instead.
(This code is all for AutoHotkey v2-alpha, as you have posted in the v2 subforum.)
- Wait for the window to appear (or wait for it to become active if it activates itself).
- Activate it (if it doesn't activate itself).
- Send F9.
Code: Select all
WinWait "ahk_exe acsuploadw.exe" ; If it opens multiple windows, narrow it down by including the window title before ahk_exe.
WinActivate
Send "{F9}"
It might also be possible (and potentially more reliable) to send F9 directly, without requiring activation.
Code: Select all
WinWait "ahk_exe acsuploadw.exe"
ControlSend "{F9}"
If F9 is to activate a menu item and the window uses a standard type of menu, you can use MenuSelect instead.
(This code is all for AutoHotkey v2-alpha, as you have posted in the v2 subforum.)