topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Saturday December 14, 2024, 8:58 pm
  • 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: IDEA : Start-Quit Program w/Single Key?  (Read 6105 times)

MourningStar

  • Participant
  • Joined in 2013
  • *
  • Posts: 11
    • View Profile
    • Donate to Member
IDEA : Start-Quit Program w/Single Key?
« on: August 16, 2013, 02:40 PM »
I request help to configure a keyboard key to run and quit a task. For example a desktop clock, calendar, cpu meter, etc (app, gadget, pgm etc,). It should function as follows :

 

key press-hold = app (e.g. clock) appears (executes a run command?)

key release = app (e.g. clock) disappears (executes a exit/quit command?)

 

In the clock example, I would like to simply press-hold a key and a custom desktop clock appears (program start) and then disappears (program quit) when I release the key. Defining many tasks in this manner would prevent the need for having multiple tasks running and eating cpu/ram when occasionally 'checking in' super-quickly on something is all that's required.

 

-thnx

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA : Start-Quit Program w/Single Key?
« Reply #1 on: August 16, 2013, 05:02 PM »

With a slight modification, something like this can kill an existing service.

AppleMobileDeviceSupport service prevents my comp from rebooting!

So rather than fish for it in Task Manager, some random defined key could kill it.

BigVent

  • Member
  • Joined in 2013
  • **
  • Posts: 36
    • View Profile
    • Donate to Member
Re: IDEA : Start-Quit Program w/Single Key?
« Reply #2 on: August 19, 2013, 12:53 PM »


Code: Autohotkey [Select]
  1.  
  2. ;//change hotkey to your desired key
  3. Numpad5::       ;//Number Pad 5 hotkey
  4. {
  5.                
  6.         while GetKeyState("Numpad5")    ;//while Number Pad 5 key is held
  7.         {
  8.                 Traytip, Key Is Held, Your hotkey is being held., ,1
  9.                
  10.                 IfWinExist, Date and Time Properties    ;//Windows clock & date
  11.                         Continue
  12.                 IfWinNotExist, Date and Time Properties
  13.                         run, Timedate.cpl
  14.         }
  15.         Traytip
  16.  
  17.                 WinClose, Date and Time Properties      ;//upon release close the window
  18. }
  19. Return
  20.  
  21. ESC & Numpad5:: ;//esc & Number Pad 5 will exit the script
  22.         Critical
  23.         ExitApp
  24. Return
~BigVent

MourningStar

  • Participant
  • Joined in 2013
  • *
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : Start-Quit Program w/Single Key?
« Reply #3 on: August 20, 2013, 07:02 PM »
^
thank you BigVent - I tied your script, unfortunately the date-time window does not close upon key release.

BigVent

  • Member
  • Joined in 2013
  • **
  • Posts: 36
    • View Profile
    • Donate to Member
Re: IDEA : Start-Quit Program w/Single Key?
« Reply #4 on: August 21, 2013, 09:49 AM »
Perhaps I should've clarified that this was an example that can be modified to suit your needs & I only tested it on my XP box, sorry about that.
Anyway, I've made an adjustment to the window & it should work as desired.  (e.g. "Date and Time Properties" on XP & "Date and Time" on > Vista)

Tested on Win XP, Vista, & 7


Enjoy!

Code: Autohotkey [Select]
  1.        
  2.     ;//change hotkey to your desired key
  3.     Numpad5:: ;//Number Pad 5 hotkey
  4.     {
  5.      
  6.                 while GetKeyState("Numpad5")    ;//while Number Pad 5 key is held
  7.                 {
  8.                         Traytip, Key Is Held, Your hotkey is being held., ,1
  9.      
  10.                         IfWinExist, Date and Time ;//Windows clock & date
  11.                                 Continue
  12.                         IfWinNotExist, Date and Time
  13.                                 run, Timedate.cpl
  14.                 }
  15.  
  16.                 sleep, 3000    ;//small delay
  17.                 Traytip
  18.      
  19.                 WinClose, Date and Time ;//upon release close the window
  20.     }
  21.     Return
  22.      
  23.     ESC & Numpad5:: ;//esc & Number Pad 5 will exit the script
  24.                 Critical
  25.                 ExitApp
  26.     Return
~BigVent
« Last Edit: August 21, 2013, 09:55 AM by BigVent »

MourningStar

  • Participant
  • Joined in 2013
  • *
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : Start-Quit Program w/Single Key?
« Reply #5 on: August 21, 2013, 10:50 PM »
^
 :up:
thnx!