AutoHotkey Community

It is currently May 26th, 2012, 8:54 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: July 8th, 2008, 3:19 pm 
Offline

Joined: July 8th, 2008, 2:44 pm
Posts: 12
Found a lot of information here and there that helped, but no actual script examples of what I was trying to do, which is to reproduce some two-key combinations like the old WordStar/WordMaster keystrokes. Here is what I came up with, for the particular keystrokes ^ks (save), ^kd (done: save and close), and ^kx (exit). The particular output was for InDesign CS3 but the output is fairly standard Windows conventions, so should work for most programs.

Note that if you hit ^k and then pause, there is a reminder that pops up with the list of keys you can hit.

Code:
;--------------------------------------------------------------------------
;                            FUNCTION GETCMD()
;--------------------------------------------------------------------------
GetCmd(Desc,Title)
 {
  Input, Selection, L1 M T2

  If Errorlevel = Timeout
   {
     Progress, c01 fm12 wm600 fs10 ws300 zh0, %Desc%, , %Title%, , Arial
     Input, Selection, L1 M
     Progress, Off
   }
  Return Selection
 }
;--------------------------------------------------------------------------
;                            ^k hotkeys
;--------------------------------------------------------------------------
^k::
 {
  s       = !f {s}
  d       = !f {c}
  x       = !f {x}
  ShortCutKeys    = s,d,x
  Description   = s = save  d = done - save and close  x = exit
  WinTitle   =  ^k Shortcuts

  UserInput := GetCmd(Description, WinTitle)

  If UserInput in %ShortCutKeys%
   {
     Command := %UserInput%
     sendinput %Command%
   }

  Return
 }


[ Moderator!: [code] tagged ]

_________________
--Keith Conover, M.D., FACEP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2008, 3:45 pm 
Offline

Joined: November 24th, 2005, 8:16 am
Posts: 851
Nice.
You may want to wrap your code in the post with [ code ] [ /code ] tags
Code:
so it will look like this
     with the indentation (if you used any) and all

_________________
Sector-Seven - Freeware tools built with AutoHotkey


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: fusion1920, Google Feedfetcher, Stigg and 6 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group