AutoHotkey Community

It is currently May 25th, 2012, 11:57 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: August 11th, 2007, 12:58 am 
first of all thanks for replying.

initially i added a space here
Code:
Else If InStr(".!?",key)

and deleted the space here.
Code:
Else If InStr("`t `n",key)


but that didnt work. your reply actually made me understand your first script more.

Quote:
Don't forget, this is a very simple script: if you move around with the arrow keys, PgDn, End, etc., it cannot tell if at the new caret position a new word starts, or we are in the middle of a word.


Thank you very much for the assistance. I appreciate it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2007, 3:08 pm 
So which version should be used for just general sentence writing? I am a noob at ahk and want to make sure I am use the most efficient script.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2007, 3:33 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
It is not the efficiency, but different functionality. The original script makes sentences start with capitals after ".", "!" or "?" followed by white space, even if you type lower case letters. Any non-numeric key, or mouse button restarts monitoring key strokes, so there are fewer unwanted capitalizations.

The third version restarts the key monitoring on fewer non-letter keys (not on F-keys), and it includes the functionality d-man proposed: switch it on/off with the Apps key.

The last script is a special one, which makes all words to start with capitals (~title mode). This you may need only if you quote titles of papers, books, etc. You could make it more intelligent, by excluding unimportant words, like "and", "or", "in", "of"…, or adding the capability to switch between the two modes, sentence- or word capitalization.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 1:54 am 
Just found out about ahk, & came across this script! Its nice, but I read it could cause system instability in some cases?

So how about a version which can be activated when one is finished typing the document. Then one can press some hotkey to activate the script which will parse the entire document & do the needful, & then return to some sleep state, and be invoked later when needed.

Sorry, completely new to ahk, but thought of mentioning this!

Thanks for sharing the code! :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 2:29 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
yogi wrote:
I read it could cause system instability in some cases
I have not experienced any, but you could use the version, which allows you to activate only when needed.
yogi wrote:
how about a version which can be activated when one is finished typing the document. Then one can press some hotkey to activate the script which will parse the entire document & do the needful, & then return to some sleep state, and be invoked later when needed.
The problem is that there is no universal way to get the text from an application. Even if you could (like with Ctrl-A, Ctrl-X), the formatting will be lost in processing the text. In some text editors (Notepad) you can get the text, but large files are painfully slow to process.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 10th, 2008, 12:18 pm 
Laszlo wrote:
If you finish a sentence with ".", "?" or "!" followed by white space or new line, we know that a new sentence follows, which should start with a capital (uppercase) letter. Here is a simple script, which fixes accidental lower case there, as it was discussed here.



This is an awesome script, and I am using it consistently now on my machine. Just one question: What would I need to change in the script, so that the very first letter in a new paragraph would be capitalized as well (independent whether a .!? was shown in the line before), i.e. mimicking exactly what word is doing ?

Thanks a lot in advance!!!

Thomas


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2008, 4:22 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
This version capitalizes the first letter in new lines, too:
Code:
#SingleInstance Force
#NoEnv
SetBatchLines -1
Process Priority,,High

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 ",key)   ; White space
      state += (state = 1)    ; state1 -> state2
   Else If key = `n           ; New line
      state = 2               ; ..to be followed by Capital
   Else {
      StringUpper key, key
      If state = 2            ; End-Space*-Letter
         Send {BS}{%key%}     ; Letter -> Upper case
      state =
   }
}

~LButton::
~RButton::
~MButton::
~WheelDown::
~WheelUp::
~XButton1::
~XButton2::State =


Report this post
Top
 Profile  
Reply with quote  
 Post subject: THANK YOU!!!
PostPosted: February 10th, 2008, 5:20 pm 
Laszlo wrote:
This version capitalizes the first letter in new lines, too:[


My goodness, that was quick. THANK YOU very much indeed, this works perfectly now.

Cheers
Thomas


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2008, 7:21 pm 
Offline

Joined: September 28th, 2007, 9:32 am
Posts: 32
Hi.

I currently use AutoCorrect for English which can be downloaded from here:

http://www.autohotkey.com/download/OtherDownloads.htm

And having this script running with the above seems like the best solution for proper typing. It's just that whenever I start a sentence with a word that is autocorrected, the case is reverted.

For example:

1. to start a sentence, I type "doesnt".

2. Laszlo's script will turn it into "Doesnt"

3. but after hitting an ending character, the autocorrect script will bring it back to "doesn't" :cry:

I read through the help file, I added a "#hotstring C0" at the top of the autocorrect script file, it doesn't seem to help. (I'm not sure if I understood that though)

Anyway, do you think its possible for the autocorrect script and Laszlo's script to run without overriding each other?

Thank you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2008, 7:56 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Help wrote:
Hotstrings can never be triggered by keystrokes produced by any AutoHotkey script.
AutoCorrect does not see our "Send {BS}{%key%}", it reacts to the original key.

I know of no simple workaround. You have to replace the Send command with your own function imitating a physical keystroke (SendPlay does not help), or replace all the hotstrings in AutoCorrect with function calls, which react to script generated keystrokes.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2008, 5:03 pm 
Offline

Joined: September 28th, 2007, 9:32 am
Posts: 32
It's a pity they both can't be run together. Laszlo, thank you all the same for the response :) and for your script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2008, 11:40 pm 
Offline

Joined: July 24th, 2008, 8:27 pm
Posts: 16
Riley wrote:
hi. Im just a beginner and im trying to learn and study your script.

how do i modify the script to capitalize the first letter of every word i type?

Thank you.


I'm kinda of a beginner myself, but i'd try to make a script that checks every SPACE you press. After every SPACEBAR you automatically make it capital.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2008, 2:40 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
It is a simplification of the script on the previous page (the AppsKey activates/suspends the script):
Code:
Loop {
   if !onn {
     Sleep 100
     Continue
   }
   Input key, I L1 M V,{Esc}{BS}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}
   if !onn
     Continue
   StringUpper key, key
   If InStr(ErrorLevel,"EndKey")
     state =
   Else If key = %A_Space%
     state = 1
   Else {
     If state = 1
        Send {BS}{%key%}
     state =
   }
}
return

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2008, 11:05 am 
how could I make the script default to On when it is ran? And then turn off with the AppsKey?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2008, 3:20 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
add a 1st line
Code:
onn = 1


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Google Feedfetcher, XX0 and 5 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