AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Smart quotation marks and em dashes in BlogJet

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
twwilliams



Joined: 24 May 2004
Posts: 23
Location: Bellevue, WA USA

PostPosted: Sun Jun 13, 2004 4:58 pm    Post subject: Smart quotation marks and em dashes in BlogJet Reply with quote

I've recently started using BlogJet to post to my blog, but it has one limitation: it doesn't have any way to enter "smart" quotation marks and other typographically-correct symbols (such as em dashes).

So I wrote this script that makes it behave like Microsoft Word with its autoformat as you type capabilities:

Code:

#SingleInstance
SetBatchLines,  10ms
SetKeyDelay,   -1

enabled             = 1
blogJetAndEnabled   = 0
inQuotedString      = 0

#F12::
If enabled = 1
{
    ToolTip, Typography disabled
    SetTimer, RemoveToolTip, 1000
    enabled = 0
}
else
{
    ToolTip, Typography enabled
    SetTimer, RemoveToolTip, 1000
    enabled = 1
}
return

~'::
Gosub, CheckForBlogJet
If blogJetAndEnabled = 1
    Send, {backspace}{ASC 0146}
return

~"::
Gosub, CheckForBlogJet
If blogJetAndEnabled = 1
{
    If inQuotedString = 0
    {
        ;not in a quoted string
        Send, {backspace}{ASC 0147}
        inQuotedString = 1
    }
    else
    {
        ;in a quoted string
        Send, {backspace}{ASC 0148}
        inQuotedString = 0
    }
}
return

~-::
Gosub, CheckForBlogJet
If blogJetAndEnabled = 1
{
    MatchChar = -
    Input, UserInput, VT2L1, {esc}{tab}, -
    if UserInput = -
        Send, {backspace 2}{ASC 0151}
}
return

CheckForBlogJet:
IfWinActive, Tommy Blogs - BlogJet
    blogJetAndEnabled = 1
else
    blogJetAndEnabled = 0
If enabled = 0
    blogJetAndEnabled = 0
return

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return

_________________
Tommy
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Jun 13, 2004 5:46 pm    Post subject: Reply with quote

Looks interesting. It's great that someone's used the Input command for something other than auto-replace (abbreviation expansion).
Back to top
View user's profile Send private message Send e-mail
twwilliams



Joined: 24 May 2004
Posts: 23
Location: Bellevue, WA USA

PostPosted: Sun Jun 13, 2004 7:54 pm    Post subject: Reply with quote

Well, even my use of the Input command is just a variation on auto-replace, since I'm turning -- into an em dash.

But I could imagine turning Input into something like ActiveWords (http://www.activewords.com/) where you can type a word anywhere, and it can become an autoreplace value, or a trigger to launch another process.
_________________
Tommy
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Wed Jun 16, 2004 2:32 am    Post subject: Reply with quote

ActiveWords sounds interesting. I hope to make auto-replace a more intrinsic feature of AHK in future versions: Something that supports a set of configurable end-word punctation marks , while being easier to script than Input (Input will still have its uses because it is very flexible). With the ideas that others have shared with me, I'm starting visualize auto-replace as a subset of Rajat's "hot strings", which are basically abbreviations that trigger some type of action, whether it be auto-replace or launching a program.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group