topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 6:21 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: desktop shortcut to execute a keyboard shortcut  (Read 4578 times)

Steven Avery

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,038
    • View Profile
    • Donate to Member
desktop shortcut to execute a keyboard shortcut
« on: December 04, 2016, 11:41 PM »
As I understand, it is often suggested to use a keyboard shortcut to execute an icon or desktop shortcut, a .lnk.
As here:
http://www.howtogeek...top-icons-on-or-off/

(I'm a mouse guy. I don't do much with keyboard shortcuts, although I could hit an icon to pop up a group of shortcuts.)

What happens if you want the opposite. You want a desktop icon to execute a global hot-key (one that was defined in an application like Pnote, to show a specific group of notes.)

Is that done with Autohotkey? Or some other way? 

Let me know if I am missing something trivial.

 Thanks!



Steven

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: desktop shortcut to execute a keyboard shortcut
« Reply #1 on: December 05, 2016, 07:12 AM »
As I understand, it is often suggested to use a keyboard shortcut to execute an icon or desktop shortcut, a .lnk.
As here:
http://www.howtogeek...top-icons-on-or-off/

(I'm a mouse guy. I don't do much with keyboard shortcuts, although I could hit an icon to pop up a group of shortcuts.)

What happens if you want the opposite. You want a desktop icon to execute a global hot-key (one that was defined in an application like Pnote, to show a specific group of notes.)

Is that done with Autohotkey? Or some other way? 

Let me know if I am missing something trivial.

 Thanks!



Steven

Yes you could use AHK.  If you do not want to show any tell tale when the program runs use the #NoTrayIcon directive.  It should be trivial.  As example this script sends Winkey e to bring up Explorer File Manager

Code: Autohotkey [Select]
  1. ; if hotkey detection program not running just quit
  2. ;
  3. ; change hotkeyprogram.exe to the name of the hotkey program
  4. ; you want to fire
  5. If (! WinExist("ahk_exe hotkeyprogam.exe"))
  6. Send #e

But you could use another keyboard macro program as alternative.  There are many freewares out there.  If you run other AHK scripts anyway though, AHK would be a natural for Windows.

Edit:  Added an optional check to only fire the macro if the hotkey detecting program is running. Change it to look for the program you want to fire or comment out if you do not need it.

« Last Edit: December 05, 2016, 07:56 AM by MilesAhead »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: desktop shortcut to execute a keyboard shortcut
« Reply #2 on: December 05, 2016, 09:16 AM »
This is exactly to how my WinSendKeys works, though it doesn't have a very simple way to create shortcuts for you, it has all the features you (could possibly) want.
It's just that I wrote it in AutoIt3 instead of AHK :D

Steven Avery

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,038
    • View Profile
    • Donate to Member
Re: desktop shortcut to execute a keyboard shortcut
« Reply #3 on: December 05, 2016, 10:29 PM »
Thanks guys. I am going to use this for the PNote need. Sort of virtual note desktops by group (when the desk is cleared, only icons and little stuff up, actually if I put the notes "on Top" I  could even ignore that.)  Maybe 5-10 nicely colored notes filling up the desktop in a group, maxing the real estate as desired.  Thus I might have a "Today" desk, a "e-commerce work" desk and a "Bible issues" desk and more.  Rather than right click and find Show-hide the specific groups I can lay out the notes using the clear space from max-max (still works in Windows 10) cleared section on the right.

This is so neat I may have to do a pictorial or a video.  (In fact, one of my earlier PNote pics, probably from Donationcoder, ended up in a review or blurb.)

Steven

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: desktop shortcut to execute a keyboard shortcut
« Reply #4 on: December 06, 2016, 02:38 AM »
This is so neat I may have to do a pictorial or a video.

that would be great :up:
Tom

Steven Avery

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,038
    • View Profile
    • Donate to Member
Re: desktop shortcut to execute a keyboard shortcut
« Reply #5 on: December 06, 2016, 07:16 AM »
WinSendKey has many parameters and a lot to read.

Can you tell me simply the cmd for something like.. eg. exexcute Alt-Ctrl-T
[ winsendkey -yada -yada ] - this winsendkey cmd I will call in a shortcut.

This would be "show today" group. While Alt-Shift-T would be "hide today" group (I'm never going to use them as keystrokes in daily use, only in a shortcut icon).  PNote was criticized in one review, Ghacks, for aggressively letting you take a global hot key, it was a strange critique, anyway here it is a plus.  I am planning to have about 10 show-hide icons for five group-sets. (My five note desktops.)  That also leads to the question as to alternate launching methods rather than 10 icons for the 10 shortcuts.

Although theoretically WinSendKey could change the "focus"?  Make the key internal to an app by first calling the .exe? Is that possible. Understanding that the app itself will not take the command as a parameter. It does not matter on PNote since all keys are global, that tends to be the sticky way.

Steven
« Last Edit: December 07, 2016, 06:21 AM by Steven Avery »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: desktop shortcut to execute a keyboard shortcut
« Reply #6 on: December 08, 2016, 01:38 AM »
Can you tell me simply the cmd for something like.. eg. exexcute Alt-Ctrl-T
[ winsendkey -yada -yada ] - this winsendkey cmd I will call in a shortcut.

That would be something like:
"full\path\to\WinSendKeys" ^!t -w "<(partial)window title>" [-x "full path to application exe" [-xp "parameters to exe"]]
Breakdown:
  • "full\path\to\WinSendKeys" : Specify the WinSendKeys executable path and name
  • ^!t : The keystrokes to send <ctrl><alt>-T
  • -w "<(partial)window title>" : Usually the application name part in the title of the window, the most recently used is selected when multiple matches are found
  • -x "full path to application exe" : The executable to start if the window title for -w is not found (optional)
  • -xp "parameters to exe" : Any parameters to pass to the executable specified with -x (optional)