 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
thanks~ Guest
|
Posted: Thu Nov 15, 2007 1:28 pm Post subject: rename file under show extensions |
|
|
| How can I do press F2 and only select file name exclusive of extensions under show extensions for know file types? |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1259 Location: Denmark
|
Posted: Thu Nov 15, 2007 1:37 pm Post subject: |
|
|
| Code: |
; use $ to allow the script to send F2
$f2::
send {f2}
; save clipboard and get new value
savecb = %clipboard%
clipboard =
send ^c
clipwait, 0.5
; check if . is found in the name
pos := InStr(clipboard,".",false,0)
; if so change the marking by issuing +left until caret is before dot
if (pos)
{
pos := StrLen(clipboard) - pos + 1
SendInput +{left %pos%}
}
; restore cb
clipboard = %savecb%
return |
_________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir |
|
| Back to top |
|
 |
thanks~ Guest
|
Posted: Fri Nov 16, 2007 5:42 am Post subject: |
|
|
| tonne wrote: | | Code: |
; use $ to allow the script to send F2
$f2::
send {f2}
; save clipboard and get new value
savecb = %clipboard%
clipboard =
send ^c
clipwait, 0.5
; check if . is found in the name
pos := InStr(clipboard,".",false,0)
; if so change the marking by issuing +left until caret is before dot
if (pos)
{
pos := StrLen(clipboard) - pos + 1
SendInput +{left %pos%}
}
; restore cb
clipboard = %savecb%
return |
|
OH!OH!
It`s working.I finally solved this problem.
Thank you so much.
 |
|
| Back to top |
|
 |
philou
Joined: 26 Jul 2006 Posts: 49 Location: Wuppertal
|
Posted: Fri Nov 16, 2007 1:53 pm Post subject: |
|
|
a different technique:
| Code: |
; FilenameSelect.ahk
#Persistent
#SingleInstance force
SetBatchLines, -1
SendMode, Input
SetControlDelay, 0
GroupAdd, Explorer_Desktop, ahk_class CabinetWClass
GroupAdd, Explorer_Desktop, ahk_class ExploreWClass
GroupAdd, Explorer_Desktop, ahk_class Progman
GroupAdd, Explorer_Desktop, ahk_class #32770 ;(
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#IfWinActive, ahk_group Explorer_Desktop
$F2::
ControlGetFocus, Control, A
If Control not contains ListView
Return
ControlGet, FileName, List, Selected, %Control%, A
If !FileName
ControlGet, FileName, List, Focused, %Control%, A
ControlGet, FileCount, List, Count Selected, %Control%, A
Send, {F2}
If FileCount > 1
Return
Sleep, 10
; Extract only Filename
FileName := SubStr(FileName, 1, InStr(FileName, A_Tab)-1)
;Find dot position
DotPos := InStr(FileName, ".", "", 0)
If !DotPos
Return
DotPos -= 1
ControlGetFocus, Control, A
SendMessage, 0xB1, 0, %Dotpos%, %Control%, A ; EM_SETSEL
return
#IfWinActive
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|