Page 1 of 1
Just send Keystroke with No Hotkey or Gui
Posted: 03 Oct 2022, 10:37
by mboyd
Hi,
Can I just send keystrokes to current application when I press on a Desktop Icon.
Don't want keyboard shortcut assigned or AHK GUI.
Thank you
Re: Just send Keystroke with No Hotkey or Gui
Posted: 03 Oct 2022, 13:31
by mikeyww
Welcome to this AutoHotkey forum!
Yes. Your script does not need to provide any hotkey or GUI.
Send
If you click on a Windows desktop icon, then the desktop is the current application. You can
WinActivate any other window before your
Send command.
Code: Select all
SplitPath, A_ScriptName,,,, fnBare
If !FileExist(lnk := A_Desktop "\" fnBare ".lnk") {
FileCreateShortcut, % target := A_ScriptFullPath, %lnk%
MsgBox, 64, Shortcut, Shortcut was created.`n`nLink file: %lnk%`n`nTarget: %target%
ExitApp
}
WinGet, win, List
Loop, %win% {
WinExist("ahk_id" win%A_Index%)
WinGet, winStyle, Style
WinGetTitle, ttitle
If (winStyle & 0x10000000 && ttitle)
If ttitle not in MainWindow,Program Manager,Start,Windows Task Manager
{ WinActivate
Send abc
SoundBeep, 1500
Return
}
}