Mar 25 2011

How AutoHotKey Can Help Bloggers Write Better


yccfbps3_thumb How AutoHotKey Can Help Bloggers Write BetterI believe that every blogger has the same issues with writing; they have certain phrases or words they have to type all the time, on more an a repetitive basis. Some bloggers are focused on one or two topics while others can have a wide range of subjects they write about…

If you can have the computer make the correction to punctuation, capitalization or to give you an edge on doing some of these words or phrases, it can really help a lot; and writing blogs doesn’t have to be all about writing and then going back and checking to ensure every instance of ‘Google’ was capitalized.

AutoHotKey is much more than a text expander; it’s a macro language that’s fairly easy to learn, the documentation on it is great; and you couldn’t ask for a more active user forum…

Here’s a few of my favorite snippets of AutoHotKey code…

Capitalization

You can insert this bit of AutoHotKey code in to your AHK file and see if it helps you.

This is the loop portion of the script where it’s always searching for places to capitalize a letter. You can put this in your script anywhere you’d like to…

;;--- Capitalization
Loop {
   Input key, I L1 V,
(  Join
{ScrollLock}{CapsLock}{NumLock}{Esc}{BS}{PrintScreen}{Pause}{LControl}{RControl}
{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}
{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}
)
   If StrLen(ErrorLevel) > 3   ; NewInput, EndKey
      state =
   Else If InStr(".!?",key)    ; Sentence end
      state = 1
   Else If InStr("`t `n",key)  ; White space
      state += (state = 1)     ; state1 -> state2
   Else {
      StringUpper key, key
      If state = 2             ; End-Space*-Letter
         SendInput {BS}{%key%} ; Letter -> Upper case
      state =
   }
}
return

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

And this is a toggle to turn the capitalization on or off…

The activation here is CTRL ALT F10… for the toggle… and again you can put this in your script anywhere you’d like.

^!F10::   ; AppsKey Switches Capitalization ON/OFF
   onn:=!onn
   state = 1
   TrayTip,Status:,% "Capital after space is now O". (onn ? "N" : "FF")
Return

Of course this working any application…

 

 

Encapsulating Text

Another snippet I like is the encapsulation of text; and this can be applied in many different areas, not just blogging— programmers could find this very useful.

What this bit of code does, or how it works… after the code has been put in to an ahk script and launched, the users needs to select the text they want to affect and then using the hotkey to execute the action.

Example:

Test [original]

[Test]

(Test)

‘Test’

 

;;--- Text Formatting---
    xsleep=20
    
^[::
    charpf=[
    Charsf=]
    gosub, formatting
    Return

^'::
    charpf='
    Charsf='
    gosub, formatting
    Return

^9::
    charpf=(
    Charsf=)
    gosub, formatting
    Return


formatting:
    clipboard=
    sleep, 30
    Send, {ctrldown}x{ctrlup}
    ClipWait
    StringRight, OutputVar, clipboard, 1

if outputvar is Space
{
    TrayTip, Status, Formatting...`n%clipboard%, 20, 17
    sleep, 20
    StringTrimRight, OutputVar, clipboard, 1
    Send, %charpf%%outputvar%%charsf% `
    sleep, 20
}
else
{
    ;msgbox, the last char of '%clipboard%' had NO space!    
    TrayTip, Status, Formatting...`n%clipboard%, 20, 17
    sleep, 20
    Send, %charpf%%clipboard%%charsf%
    sleep, 20
}
return

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

There can be lots of other effects as well, but you can add those on your own…

 

 

Special Characters

Getting special characters in to a document or a blog sometimes can be a real pain.. if you’re attempting to find a copyright symbol to insert, it’s going to be kind of hard, but you can simplify on your self by creating a phrase or hot to insert those characters for you…

Here’s just a few…

;; — Special chars
:?*:...::{ASC 0133} ;dot dot dot looks nicer :?*: 1/4 :: {ASC 0188} ` :?*: 1/2 :: {ASC 0189} ` :?*: 3/4 :: {ASC 0190} ` :?*:--::{ASC 0151} ;long dash :?*:---::{ASC 0151} ;long dash :?*:(tm)::™ :?*:(c)::{ASC 0169} :?*:(r)::®

Now I can insert that copyright symbol by typing (c) and get this © …much nicer.

 

 

Standard Keyboard Formatting/Documentation

Let’s just say that you do a lot of procedural stuff with documentation and so on and you’re constantly typing thing like ‘Choose START’ or ‘go to the run box’. Having to account for these formatting nuances each time, yeah that’ll get old quick, but if you can have AutoHotKey fix that for you, life could get a bit easier.

Here’s a snippet that might help you…

;;Key combinations
::control ALT::CTRL-ALT
::ALT control::CTRL-ALT
::control ALT delete::CTRL-ALT-DEL
::control shift::CTRL-SHIFT
::shift control::CTRL-SHIFT
::ALT shift::SHIFT-ALT
::Shift ALT::SHIFT-ALT

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

So now I can type ‘control alt’ and the result will be ‘CTRL-ALT’… life gets a little better.

 

 

Inserting a current time date/formatted

I like this one a lot… the ability to insert the current date in just about anywhere you need it.

^d::
formattime,ctime,,MMddyyyy
sendraw, %ctime%
return

^!d::
formattime,ctime,,MM/dd/yyyy
sendraw, %ctime%
return

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

and so now by using the CTRL D or the CTRL ALT D, you can have this ‘03252011’ or ‘03/25/2011’ any time you need it; very quickly.

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 

These are just a few ways AutoHotKey can help you with your blogging. Formatting names, companies’ names, phrases and so on can be very useful. And you’re abbreviating your posts to avoid having to type out the full name of the service or the device, you can fix that here and it will make your posts look as though more effort went in to it; and not being so lazy.

 

AutoHotKey is freeware, you can use it for personal or private use..
AutoHotKey can be downloaded from their website.

download How AutoHotKey Can Help Bloggers Write Better 

AutoHotKey 
DOWNLOAD IT

download How AutoHotKey Can Help Bloggers Write Better

I hope this helps you…

 

Thank you,
Larry Henry Jr.
LEHSYS.com 

zemified_c How AutoHotKey Can Help Bloggers Write Better

Support the site — Share this!