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 

rename file under show extensions

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
thanks~
Guest





PostPosted: Thu Nov 15, 2007 1:28 pm    Post subject: rename file under show extensions Reply with quote

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

PostPosted: Thu Nov 15, 2007 1:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
thanks~
Guest





PostPosted: Fri Nov 16, 2007 5:42 am    Post subject: Reply with quote

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.
Very Happy
Back to top
philou



Joined: 26 Jul 2006
Posts: 49
Location: Wuppertal

PostPosted: Fri Nov 16, 2007 1:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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