AutoHotkey Community

It is currently May 27th, 2012, 3:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: March 18th, 2010, 11:44 pm 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
Hi, I'm trying to make a looping case changer like the one in MS Word. There if you hold down the Shift key and tap on the F3 key, it will cycle through setting the selection to lower case, upper case and Title case and then back to lower case on the fourth tap of F3.

I have succeeded in doing simple modifications and synthesizing of skrommel's excellent CAPShift, HotKeyIt's RapidHotkey and Laszo's Morse Key, both also excellent.

I have two problems now:

1. Unlike MS Word, the case doesn't change until I lift the shift key. In Word every time you tap the F3 key and change happens right away. I have tried a bunch of things to fix this without success.

2. I was able to move the text insertion point/caret back to the start, selecting along the way by sending the shift key, however, if I'm changing the case of a whole paragraph, the caret takes some time to get back to the start. It would nice if it just jumped and still kept the paragraph selected.

Thanks in advance for the help.

Below is the code:
Code:
Shift & F3::RapidHotkey("LOWER""UPPER""TITLE""INVERT",1,0.2,1)

LOWER:
Gosub,CUT
StringLower,string,string
Gosub,PASTE
Return

UPPER:
Gosub,CUT
StringUpper,string,string
Gosub,PASTE
Return

TITLE:
Gosub,CUT
StringLower,string,string,T
Gosub,PASTE
Return

INVERT:
AutoTrim,Off
StringCaseSense,On
Gosub,CUT
lower=abcdefghijklmnopqrstuvwxyzæøå
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
StringLen,length,string

Loop,%length%
{
  StringLeft,char,string,1
  StringGetPos,pos,lower,%char%
  pos+=1
  If pos<>0
    StringMid,char,upper,%pos%,1
  Else
  {   
    StringGetPos,pos,upper,%char%
    pos+=1
    If pos<>0
      StringMid,char,lower,%pos%,1
  }
  StringTrimLeft,string,string,1
  string=%string%%char%
}
Gosub,PASTE
Return

CUT:
   Send,^x
   ClipWait,1
   string=%clipboard%
   Return

PASTE:
   clipboard=%string%
   Send,^v
   StringLen,length,clipboard
   Send,{Shift Down}
   Send,{Left %length%}
   Send,{Shift Up}
   Return
   
;#####################################
;RapidHotkey() and Morse() functions #
;#####################################
RapidHotkey(keystroke, times="1", delay=0, IsLabel=1)
{
   Pattern := Morse(delay*1000)
   If (StrLen(Pattern) < 2 and Chr(Asc(times)) != "1")
      Return
   If (times = "" and InStr(keystroke, """"))
   {
      Loop, Parse, keystroke,""   
         If (StrLen(Pattern) = A_Index+1)
            continue := A_Index, times := StrLen(Pattern)
   }
   Else if (RegExMatch(times, "^\d+$") and InStr(keystroke, """"))
   {
      Loop, Parse, keystroke,""
         If (StrLen(Pattern) = A_Index+times-1)
            times := StrLen(Pattern), continue := A_Index
   }
   Else if InStr(times, """")
   {
      Loop, Parse, times,""
         If (StrLen(Pattern) = A_LoopField)
            continue := A_Index, times := A_LoopField
   }
   Else if (times = "")
      continue = 1, times = 2
   Else if (times = StrLen(Pattern))
      continue = 1
   If !continue
      Return
   Loop, Parse, keystroke,""
      If (continue = A_Index)
         keystr := A_LoopField
   Loop, Parse, IsLabel,""
      If (continue = A_Index)
         IsLabel := A_LoopField
   hotkey := RegExReplace(A_ThisHotkey, "[\*\~\$\#\+\!\^]")
   IfInString, hotkey, %A_Space%
      StringTrimLeft, hotkey,hotkey,% InStr(hotkey,A_Space,1,0)
   Loop % times
      backspace .= "{Backspace}"
   keywait = Ctrl|Alt|Shift|LWin|RWin
   Loop, Parse, keywait, |
      KeyWait, %A_LoopField%
   If ((!IsLabel or (IsLabel and IsLabel(keystr))) and InStr(A_ThisHotkey, "~") and !RegExMatch(A_ThisHotkey
   , "i)\^[^\!\d]|![^\d]|#|Control|Ctrl|LCtrl|RCtrl|Shift|RShift|LShift|RWin|LWin|Escape|BackSpace|F\d\d?|"
   . "Insert|Esc|Escape|BS|Delete|Home|End|PgDn|PgUp|Up|Down|Left|Right|ScrollLock|CapsLock|NumLock|AppsKey|"
   . "PrintScreen|CtrlDown|Pause|Break|Help|Sleep|Browser_Back|Browser_Forward|Browser_Refresh|Browser_Stop|"
   . "Browser_Search|Browser_Favorites|Browser_Home|Volume_Mute|Volume_Down|Volume_Up|MButton|RButton|LButton|"
   . "Media_Next|Media_Prev|Media_Stop|Media_Play_Pause|Launch_Mail|Launch_Media|Launch_App1|Launch_App2"))
      Send % backspace
   If (WinExist("AHK_class #32768") and hotkey = "RButton")
      WinClose, AHK_class #32768
   If !IsLabel
      Send % keystr
   else if IsLabel(keystr)
      Gosub, %keystr%
   Return
}   
Morse(timeout = 400) { ;by Laszo -> http://www.autohotkey.com/forum/viewtopic.php?t=16951 (Modified to return: KeyWait %key%, T%tout%)
   tout := timeout/1000
   key := RegExReplace(A_ThisHotKey,"[\*\~\$\#\+\!\^]")
   IfInString, key, %A_Space%
   StringTrimLeft, key, key,% InStr(key,A_Space,1,0)
   Loop {
      t := A_TickCount
      KeyWait %key%, T%tout%
     Pattern .= A_TickCount-t > timeout
     If(ErrorLevel)
      Return Pattern
     KeyWait %key%,DT%tout%
      If (ErrorLevel)
         Return Pattern
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 1:49 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6071
Location: San Diego, California
try this code,
sorry it moves the mouse but doesn't put it back where it was :oops:
Code:
#Persistent
return

f12::reload

f1::
SetTimer, WatchCaret, 100
return
WatchCaret:
ToolTip, X%A_CaretX% Y%A_CaretY%, A_CaretX, A_CaretY - 20
return



Shift & F3::RapidHotkey("LOWER""UPPER""TITLE""INVERT",1,0.2,1)

where_was_caret:
msgbox start %startx% %starty% `nend %endx% %endy%`nafterpaste %afterpastex% %afterpastey%
return

LOWER:
Gosub,CUT
StringLower,string,string
Gosub,PASTE
;gosub where_was_caret
Return

UPPER:
Gosub,CUT
StringUpper,string,string
Gosub,PASTE
Return

TITLE:
Gosub,CUT
StringLower,string,string,T
Gosub,PASTE
Return

INVERT:
AutoTrim,Off
StringCaseSense,On
Gosub,CUT
lower=abcdefghijklmnopqrstuvwxyzæøå
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
StringLen,length,string

Loop,%length%
{
  StringLeft,char,string,1
  StringGetPos,pos,lower,%char%
  pos+=1
  If pos<>0
    StringMid,char,upper,%pos%,1
  Else
  {   
    StringGetPos,pos,upper,%char%
    pos+=1
    If pos<>0
      StringMid,char,lower,%pos%,1
  }
  StringTrimLeft,string,string,1
  string=%string%%char%
}
Gosub,PASTE
Return

CUT:

   endx:=A_CaretX
   endy:=A_CaretY

   Send,^x
   ClipWait,1
   string=%clipboard%

;sleep, 2000
   startx:=A_CaretX
   starty:=A_CaretY

   Return

PASTE:
   clipboard=%string%
   Send,^v
   StringLen,length,clipboard
   Send,{Shift Down}
;sleep ,1000
   afterpastex:=A_CaretX
   afterpastey:=A_CaretY
;sleep, 1000
    mousemove, %startx%, %starty%, 10
    click

;temp:=A_KeyDelay
;SetKeyDelay , -1

;sleep ,1000
;   Send,{Left %length%}

;SetKeyDelay , %temp%

   Send,{Shift Up}
   Return
   
;#####################################
;RapidHotkey() and Morse() functions #
;#####################################
RapidHotkey(keystroke, times="1", delay=0, IsLabel=1)
{
   Pattern := Morse(delay*1000)
   If (StrLen(Pattern) < 2 and Chr(Asc(times)) != "1")
      Return
   If (times = "" and InStr(keystroke, """"))
   {
      Loop, Parse, keystroke,""   
         If (StrLen(Pattern) = A_Index+1)
            continue := A_Index, times := StrLen(Pattern)
   }
   Else if (RegExMatch(times, "^\d+$") and InStr(keystroke, """"))
   {
      Loop, Parse, keystroke,""
         If (StrLen(Pattern) = A_Index+times-1)
            times := StrLen(Pattern), continue := A_Index
   }
   Else if InStr(times, """")
   {
      Loop, Parse, times,""
         If (StrLen(Pattern) = A_LoopField)
            continue := A_Index, times := A_LoopField
   }
   Else if (times = "")
      continue = 1, times = 2
   Else if (times = StrLen(Pattern))
      continue = 1
   If !continue
      Return
   Loop, Parse, keystroke,""
      If (continue = A_Index)
         keystr := A_LoopField
   Loop, Parse, IsLabel,""
      If (continue = A_Index)
         IsLabel := A_LoopField
   hotkey := RegExReplace(A_ThisHotkey, "[\*\~\$\#\+\!\^]")
   IfInString, hotkey, %A_Space%
      StringTrimLeft, hotkey,hotkey,% InStr(hotkey,A_Space,1,0)
   Loop % times
      backspace .= "{Backspace}"
   keywait = Ctrl|Alt|Shift|LWin|RWin
   Loop, Parse, keywait, |
      KeyWait, %A_LoopField%
   If ((!IsLabel or (IsLabel and IsLabel(keystr))) and InStr(A_ThisHotkey, "~") and !RegExMatch(A_ThisHotkey
   , "i)\^[^\!\d]|![^\d]|#|Control|Ctrl|LCtrl|RCtrl|Shift|RShift|LShift|RWin|LWin|Escape|BackSpace|F\d\d?|"
   . "Insert|Esc|Escape|BS|Delete|Home|End|PgDn|PgUp|Up|Down|Left|Right|ScrollLock|CapsLock|NumLock|AppsKey|"
   . "PrintScreen|CtrlDown|Pause|Break|Help|Sleep|Browser_Back|Browser_Forward|Browser_Refresh|Browser_Stop|"
   . "Browser_Search|Browser_Favorites|Browser_Home|Volume_Mute|Volume_Down|Volume_Up|MButton|RButton|LButton|"
   . "Media_Next|Media_Prev|Media_Stop|Media_Play_Pause|Launch_Mail|Launch_Media|Launch_App1|Launch_App2"))
      Send % backspace
   If (WinExist("AHK_class #32768") and hotkey = "RButton")
      WinClose, AHK_class #32768
   If !IsLabel
      Send % keystr
   else if IsLabel(keystr)
      Gosub, %keystr%
   Return
}   
Morse(timeout = 400) { ;by Laszo -> http://www.autohotkey.com/forum/viewtopic.php?t=16951 (Modified to return: KeyWait %key%, T%tout%)
   tout := timeout/1000
   key := RegExReplace(A_ThisHotKey,"[\*\~\$\#\+\!\^]")
   IfInString, key, %A_Space%
   StringTrimLeft, key, key,% InStr(key,A_Space,1,0)
   Loop {
      t := A_TickCount
      KeyWait %key%, T%tout%
     Pattern .= A_TickCount-t > timeout
     If(ErrorLevel)
      Return Pattern
     KeyWait %key%,DT%tout%
      If (ErrorLevel)
         Return Pattern
   }
}


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 19th, 2010, 5:37 am 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
This seems acceptable for now:
Code:
PASTE:
   clipboard=%string%
   Send,^v
   StringLen,length,clipboard
    SetKeyDelay, -1
   Send,{Shift Down}
   Send,{Left %length%}
   Send,{Shift Up}
   Return


I tried fooling around with getting the carets X and Y position via A_CaretX and A_CaretY. Apparently these functions don't work reliably in many programs like Adobe Reader and Firefox.

I even saw someone suggest using PixelGetColor to find the color of the selection/highlighting from just to the left of the caret (or something similar) and then finding the first instance of this color at the beginning of the selection. So I moved the mouse around with the left button clicked down between the coordinate for the first discovered pixel with the color and the A_CaretX and A_CaretY. The latter sort of worked too, but left some sections of the original text unhighlighted.

My code above is not instantaneous but it may be good enough for now...unless someone has a better suggestion. Thanks again for giving me the spirit to try some more stuff :D.


Last edited by socrtwo on March 19th, 2010, 5:41 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 19th, 2010, 5:40 am 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
So #2 is fine for now, but #1 still needs taking care of :D, if anyone is in the suggestion spirit.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 19th, 2010, 5:37 pm 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
It turns out there is an issue with topic #2. In this code:
Code:
PASTE:
   clipboard=%string%
   Send,^v
   StringLen,length,clipboard
    SetKeyDelay, -1
   Send,{Shift Down}
   Send,{Left %length%}
   Send,{Shift Up}
   Return

StringLen is counting the line returns as characters in for instance Notepad. Thus the
Code:
Send,{Left %length%}

line sends too many left arrow caret movements and the selection overshoots the initial selection adding to it as many characters as there are lines in the selection...

Any suggestions how to stop this??


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 8:34 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
I was messing with it just including the built in ones and came up with this
Code:
State=0
*F3::
If !GetKeyState("Shift","P")
  Return
Send ^x
StringReplace, Length, Clipboard, `r`n , `n, All ;Replace `r`n with single char before counting
Len:=strlen(Length)
If State=0
 Stringlower, Changed, Clipboard
If State=1
 Stringupper, Changed, Clipboard
If State=2
 Stringlower, Changed, Clipboard ,T
State:=State<2 ? State+1 : 0
Clipboard:=Changed
Send ^v
Sleep 50
SendInput {Blind}{Left %Len%}
Return
You could easily add more states for sentence case and inverse case (but invert of what original? Title?)


Last edited by None on March 19th, 2010, 10:43 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 19th, 2010, 9:31 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6071
Location: San Diego, California
socrtwo wrote:
I tried fooling around with getting the carets X and Y position via A_CaretX and A_CaretY. Apparently these functions don't work reliably in many programs like Adobe Reader and Firefox.


You show me where your paste routine works in Adobe Reader :arrow: and I'll eat my hat 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Sorry Adobe Writer
PostPosted: March 19th, 2010, 9:44 pm 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
Brain Freeze :oops:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Excellent!
PostPosted: March 19th, 2010, 11:25 pm 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
None wrote:
I was messing with it just including the built in ones and came up with this
Code:
State=0
*F3::
If !GetKeyState("Shift","P")
  Return
Send ^x
StringReplace, Length, Clipboard, `r`n , `n, All
Len:=strlen(Length)
If State=0
 Stringlower, Changed, Clipboard
If State=1
 Stringupper, Changed, Clipboard
If State=2
 Stringlower, Changed, Clipboard ,T
State:=State<2 ? State+1 : 0
Clipboard:=Changed
Send ^v
Sleep 50
SendInput {Blind}{Left %Len%}
Return


Excellent! :D . This is going to take some time to see how you did it.

Anyway it works outstandingly. Maybe it's too much to ask but can we extend Shift-F3 to Sentence and Invert case too. I'll see what headway I can make on those. There is some code from Invert Case Code from my original, but I haven't seem to get it to work with the above yet.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2010, 2:38 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
I altered the Invert code you had above to make it a function
Code:
Invert(String) {
AutoTrim,Off
StringCaseSense,On
lower=abcdefghijklmnopqrstuvwxyzæøå
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
StringLen,INVlength,string

Loop,%INVlength%
{
  StringLeft,char,string,1
  StringGetPos,pos,lower,%char%
  pos+=1
  If pos<>0
    StringMid,char,upper,%pos%,1
  Else
  {   
    StringGetPos,pos,upper,%char%
    pos+=1
    If pos<>0
      StringMid,char,lower,%pos%,1
  }
  StringTrimLeft,string,string,1
  string=%string%%char%
}
Return %string%
}
so you could use it like
Code:
State=0
*F3::
If !GetKeyState("Shift","P")
  Return
Send ^x
StringReplace, Length, Clipboard, `r`n , `n, All
Len:=strlen(Length)
If State=0
 Changed:=Invert(Clipboard) ;call the INVERT function
If State=1
 Stringlower, Changed, Clipboard
If State=2
 Stringupper, Changed, Clipboard
If State=3
 Stringlower, Changed, Clipboard ,T
State:=State<3 ? State+1 : 0
Clipboard:=Changed
Send ^v
Sleep 50
SendInput {Blind}{Left %Len%}
Return
you can put the function at the end of the script a Standard Lib folder or include it from anywhere you want :)

Also Laszlo made some Sentence Case code that could also be turned into a function and used the same way. If you need help with that just ask :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Excellent
PostPosted: March 20th, 2010, 4:20 am 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
Excellent, thanks so much. I'll try out yours and Laszlo's functions. This is super.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Took Your Suggestion
PostPosted: March 20th, 2010, 8:08 pm 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
I took the suggestion. Here's the result:
Code:
State=0
*F3::
If !GetKeyState("Shift","P")
  Return
Send ^x
StringReplace, Length, Clipboard, `r`n , `n, All
Len:=strlen(Length)
If State=0
 Changed:=Invert(Clipboard) ;call the Invert function
If State=1
 Stringlower, Changed, Clipboard
If State=2
 Stringupper, Changed, Clipboard
If State=3
 Stringlower, Changed, Clipboard ,T
If State=4
 Changed:=Title(Clipboard) ;call the Title function
State:=State<4 ? State+1 : 0
Clipboard:=Changed
Send ^v
Sleep 50
SendInput {Blind}{Left %Len%}
Return

INVERT(String){
AutoTrim,Off
StringCaseSense,On
lower=abcdefghijklmnopqrstuvwxyzæøå
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
StringLen,INVlength,String

Loop,%INVlength%
{
  StringLeft,char,string,1
  StringGetPos,pos,lower,%char%
  pos+=1
  If pos<>0
    StringMid,char,upper,%pos%,1
  Else
  {   
    StringGetPos,pos,upper,%char%
    pos+=1
    If pos<>0
      StringMid,char,lower,%pos%,1
  }
  StringTrimLeft,string,string,1
  string=%string%%char%
}
Return %string%
}

Title(Title){
X = I,AHK,AutoHotkey

Title := RegExReplace(Title, "[\.\!\?]\s+|\R+", "$0þ") ; mark 1st letters of sentences with char 254
Loop Parse, Title, þ
{
   StringLower L, A_LoopField
   I := Chr(Asc(A_LoopField))
   StringUpper I, I
   S .= I SubStr(L,2)
}
Loop Parse, X, `,
   S := RegExReplace(S,"i)\b" A_LoopField "\b", A_LoopField)

Return %S%
}


It seems to work pretty well in Notepad, although cursory trying in Gmail shows erratic behavior sometimes requires 2 or 3 taps to change case and sometimes the case changed to, is not the proper one in the order. Oh well. This may be due to frequent background saves of messages by Gmail...

I did compile the program and make it available on one of my sites: http://www.godskingsandheroes.info/soft ... se-changer

Update: 03/20/2010
I may have had two instances of the program running hence the need for two taps on the F3 key to advance to the next case. So it may be consistent after all :D.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 22nd, 2010, 12:17 pm 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
I added some code for preserving the clipboard text that I had found earlier. It appears to have first been suggested in the forum by Neobrew here: http://www.autohotkey.com/forum/viewtopic.php?t=23654, although for the experts or even an average programmer it's not too complicated I think.

Anyway, the changes are added to the script below, along with a filled in header I found by creating an empty new AutoHotKey file from the template found on the Windows New File and Folder Context Menu.
Code:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         socrtwo <socrtwo@s2services.com>, "None" and "Lazslo" from the AutoHotKey forum, most of the coding of this script is by "None".  See - http://www.autohotkey.com/forum/viewtopic.php?t=55868
;
; Script Function: Summary: Change case in any Windows app by holding down the shift key and tapping F3. Details: In any Windows application thIs script translates holding down the shift key and tapping on f3 into cycling your selected text through invert, lower, upper, title and sentence cases.  This program uses the clipbaoard in order to carry out its function but returns at least the text that existed on the clipbaord in the beginning. This program copies the similar feature in MS Word that uses the same key combination. The feature in word omits the invert and sentence case but in word, these can be accessed from customizing the quick access toolbar. The script is mostly by none with the sentence case function by laszlo both from the AutoHotkey forum. The script idea was suggested and after minor synthesis and adjustment compiled by me socrtwo (paul d pruitt).
;   
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

State=0
*F3::
If !GetKeyState("Shift","P")
  Return
  Clip_Save:= ClipboardAll                                                 ; save original contents of clipboard
 Clipboard:= ""
Send ^x
StringReplace, Length, Clipboard, `r`n , `n, All
Len:=strlen(Length)
If State=0
 Changed:=Invert(Clipboard) ;call the Invert function
If State=1
 Stringlower, Changed, Clipboard
If State=2
 Stringupper, Changed, Clipboard
If State=3
 Stringlower, Changed, Clipboard ,T
If State=4
 Changed:=Title(Clipboard) ;call the Title function
State:=State<4 ? State+1 : 0
Clipboard:=Changed
Send ^v
Sleep 50
Clipboard:= ""
Clipboard:= Clip_Save
SendInput {Blind}{Left %Len%}
Return

INVERT(String){
AutoTrim,Off
StringCaseSense,On
lower=abcdefghijklmnopqrstuvwxyzæøå
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
StringLen,INVlength,String

Loop,%INVlength%
{
  StringLeft,char,string,1
  StringGetPos,pos,lower,%char%
  pos+=1
  If pos<>0
    StringMid,char,upper,%pos%,1
  Else
  {   
    StringGetPos,pos,upper,%char%
    pos+=1
    If pos<>0
      StringMid,char,lower,%pos%,1
  }
  StringTrimLeft,string,string,1
  string=%string%%char%
}
Return %string%
}

Title(Title){
X = I,AHK,AutoHotkey

Title := RegExReplace(Title, "[\.\!\?]\s+|\R+", "$0þ") ; mark 1st letters of sentences with char 254
Loop Parse, Title, þ
{
   StringLower L, A_LoopField
   I := Chr(Asc(A_LoopField))
   StringUpper I, I
   S .= I SubStr(L,2)
}
Loop Parse, X, `,
   S := RegExReplace(S,"i)\b" A_LoopField "\b", A_LoopField)

Return %S%
}



Still to do is, is to preserve the clipboard even if it has an image or file on it.[/code]


Report this post
Top
 Profile  
Reply with quote  
 Post subject: it's not working...
PostPosted: December 8th, 2010, 9:04 pm 
:(
I tried this by pasting it into my AutoHotkey.ahk file and then reloaded it.
It is not changing case and it IS messing up the text and moving the cursor to the left each time I press SHIFT F3.

Not so good. :(
I am not into fixing it. Is there some better code to do this elsewhere?


Report this post
Top
  
Reply with quote  
 Post subject: Maybe Better Source Code
PostPosted: December 8th, 2010, 10:31 pm 
Offline

Joined: March 17th, 2010, 11:34 pm
Posts: 13
https://sourceforge.net/projects/shiftf3/ - this may be better sourcecode. However, I think the problem of losing previous text is not corrected.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: rbrtryn and 31 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