Difference between revisions of "AutoHotkey: Inplace rename facilities"

From TotalcmdWiki
Jump to: navigation, search
m (Interwiki)
(Save clipboard contents)
Line 4: Line 4:
 
  ;#1 -> Win Key + 1
 
  ;#1 -> Win Key + 1
 
  #1::
 
  #1::
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   StringLower, lowercase_string, clipboard
 
   StringLower, lowercase_string, clipboard
   Send, %lowercase_string%
+
   SendRaw, %lowercase_string%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return  
 
  Return  
  
 
;First letter uppercase
 
;First letter uppercase
 
  #2::
 
  #2::
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   StringLower, lowercase_string, clipboard
 
   StringLower, lowercase_string, clipboard
 
   StringLeft, first_letter_of_string, lowercase_string, 1
 
   StringLeft, first_letter_of_string, lowercase_string, 1
 
   StringUpper, first_letter_of_string_uppercase, first_letter_of_string
 
   StringUpper, first_letter_of_string_uppercase, first_letter_of_string
 
   StringTrimLeft, rest_of_string, lowercase_string, 1
 
   StringTrimLeft, rest_of_string, lowercase_string, 1
   Send, %first_letter_of_string_uppercase%%rest_of_string%
+
   SendRaw, %first_letter_of_string_uppercase%%rest_of_string%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return  
 
  Return  
  
 
;First Of Each Word Uppercase
 
;First Of Each Word Uppercase
 
  #3::
 
  #3::
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   ;StringUpper, OutputVar, InputVar [, T]  
 
   ;StringUpper, OutputVar, InputVar [, T]  
 
   ;StringLower, OutputVar, InputVar [, T]  
 
   ;StringLower, OutputVar, InputVar [, T]  
 
   ;[, T] = If the parameter is the letter T, the string will be converted to title case.
 
   ;[, T] = If the parameter is the letter T, the string will be converted to title case.
 
   StringLower, first_each_word_uppercase_string, clipboard, T
 
   StringLower, first_each_word_uppercase_string, clipboard, T
   Send, %first_each_word_uppercase_string%
+
   SendRaw, %first_each_word_uppercase_string%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return  
 
  Return  
  
 
;ALL UPPERCASE
 
;ALL UPPERCASE
 
  #4::
 
  #4::
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   StringUpper, uppercase_string, clipboard
 
   StringUpper, uppercase_string, clipboard
   Send, %uppercase_string%
+
   SendRaw, %uppercase_string%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return  
 
  Return  
  
 
;Replace Space by Underscore
 
;Replace Space by Underscore
 
  #5::
 
  #5::
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   StringReplace, string_space2underscore, clipboard, %A_SPACE%, _, All
 
   StringReplace, string_space2underscore, clipboard, %A_SPACE%, _, All
   Send, %string_space2underscore%
+
   SendRaw, %string_space2underscore%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return  
 
  Return  
  
 
;Replace Underscore by Space (Remove Underscore)
 
;Replace Underscore by Space (Remove Underscore)
 
  #6::
 
  #6::
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   StringReplace, string_underscore2space, clipboard, _, %A_SPACE%, All
 
   StringReplace, string_underscore2space, clipboard, _, %A_SPACE%, All
   Send, %string_underscore2space%
+
   SendRaw, %string_underscore2space%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return
 
  Return
  
 
;Replace Dot by Space (Remove Underscore)
 
;Replace Dot by Space (Remove Underscore)
 
  #7::
 
  #7::
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   StringReplace, string_underscore2space, clipboard, ., %A_SPACE%, All
 
   StringReplace, string_underscore2space, clipboard, ., %A_SPACE%, All
   Send, %string_underscore2space%
+
   SendRaw, %string_underscore2space%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return
 
  Return
  
 
;Replace \ by /  
 
;Replace \ by /  
 
  #8::   
 
  #8::   
 +
  saved_clipboard := ClipboardAll
 
   ControlGetFocus, ActiveControl, A
 
   ControlGetFocus, ActiveControl, A
 
   Send, ^c
 
   Send, ^c
 +
  ClipWait
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]   
 
   StringReplace, string_underscore2space, clipboard, \, /, All
 
   StringReplace, string_underscore2space, clipboard, \, /, All
   Send, %string_underscore2space%
+
   SendRaw, %string_underscore2space%
 +
  Clipboard := saved_clipboard
 +
  saved_clipboard = ; Free the memory in case the clipboard was very large.
 
  Return
 
  Return
  
 
{{translated|AutoHotkey: Umbenennbox: verschiedene Spezialfunktionen|AutoHotkey}}
 
{{translated|AutoHotkey: Umbenennbox: verschiedene Spezialfunktionen|AutoHotkey}}

Revision as of 16:12, 3 May 2006

Set of small AHK scripts allowing to perform different tasks (uppercase, lowercase, add or remove underscore ... from the highlighted file in Inplace rename field). It can also be used anywhere else just highlight the text you want to modify and press WinKey+1 or WinKey+2 ...

All lowercase
;#1 -> Win Key + 1
#1::
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  StringLower, lowercase_string, clipboard
  SendRaw, %lowercase_string%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return 
First letter uppercase
#2::
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  StringLower, lowercase_string, clipboard
  StringLeft, first_letter_of_string, lowercase_string, 1
  StringUpper, first_letter_of_string_uppercase, first_letter_of_string
  StringTrimLeft, rest_of_string, lowercase_string, 1
  SendRaw, %first_letter_of_string_uppercase%%rest_of_string%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return 
First Of Each Word Uppercase
#3::
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  ;StringUpper, OutputVar, InputVar [, T] 
  ;StringLower, OutputVar, InputVar [, T] 
  ;[, T] = If the parameter is the letter T, the string will be converted to title case.
  StringLower, first_each_word_uppercase_string, clipboard, T
  SendRaw, %first_each_word_uppercase_string%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return 
ALL UPPERCASE
#4::
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  StringUpper, uppercase_string, clipboard
  SendRaw, %uppercase_string%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return 
Replace Space by Underscore
#5::
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]  
  StringReplace, string_space2underscore, clipboard, %A_SPACE%, _, All
  SendRaw, %string_space2underscore%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return 
Replace Underscore by Space (Remove Underscore)
#6::
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]  
  StringReplace, string_underscore2space, clipboard, _, %A_SPACE%, All
  SendRaw, %string_underscore2space%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return
Replace Dot by Space (Remove Underscore)
#7::
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]  
  StringReplace, string_underscore2space, clipboard, ., %A_SPACE%, All
  SendRaw, %string_underscore2space%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return
Replace \ by /
#8::  
  saved_clipboard := ClipboardAll
  ControlGetFocus, ActiveControl, A
  Send, ^c
  ClipWait
  ;StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]  
  StringReplace, string_underscore2space, clipboard, \, /, All
  SendRaw, %string_underscore2space%
  Clipboard := saved_clipboard
  saved_clipboard = ; Free the memory in case the clipboard was very large.
Return

Back to AutoHotkey