AutoHotkey Community

It is currently May 27th, 2012, 1:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: SplitPath current Dir
PostPosted: November 21st, 2009, 11:56 pm 
Offline

Joined: May 31st, 2008, 3:22 pm
Posts: 47
for why that script? for quick renaming ReadMe.txt file to %CurrentDir%.txt

work in Windows Explorer (CabinetWClass or ExploreWClass)

example:

Before F:\1Prg\Vid\ReadMe.txt
After F:\1Prg\Vid\Vid.txt


1st i try find in AHK.chm

Example from AutoHotkey.chm Version 1.0.48.05


Code:
; To fetch all info:
SplitPath, FullFileName, name, dir, ext, name_no_ext, drive
   
; The above will set the variables as follows:
; name = Address List.txt
; dir = C:\My Documents
; ext = txt
; name_no_ext = Address List
; drive = C:


current dir = My Documents < that need how?
Need not %A_WorkingDir% and not %A_MyDocuments% need NAME OF DIR ONLY! that just example!!!


part in my script

Code:
F1::
FormatTime, 3DnT,, ddMMyy,HH-mm-sss
ControlGetText, cgt, Edit1, A ;Get Address Bar from Win Explorer
FileMove, %cgt%\Readme.txt, %cgt%\%hereMustBeCurrentDirName%_%3DnT%_ReadMe.txt
return

Code:
 ;Same shit but with file what you selected now
F2::
ControlGetText, addr, Edit1, A
ControlGet, file, List, Selected, SysListView321, A,
FileMove, %cgt%\Readme.txt, %cgt%\%CurrentDir%.txt
return



Help still needed


Last edited by ahkiot0 on December 6th, 2009, 8:55 pm, edited 8 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 12:29 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Refer AHK Documentation for A_MyDocuments and A_WorkingDir


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2009, 9:23 pm 
Offline

Joined: May 31st, 2008, 3:22 pm
Posts: 47
Help still needed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 1:20 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
Code:
path = %A_AhkPath%

MsgBox %path% ; in example "C:\Programme\AutoHotkey\AutoHotkey.exe"
SplitPath, path,, dir
MsgBox %dir% ; in example "C:\Programme\AutoHotkey"

dirNameOnly := getDirName(dir)
MsgBox %dirNameOnly% ; in example "AutoHotkey"

getDirName(_path) {
    Return SubStr(_path,InStr(_path,"\",0,0)+1)
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 2:41 am 
work, but.. rename not "AutoHotkey", previous folder "Programme" :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 2:46 am 
Offline

Joined: May 31st, 2008, 3:22 pm
Posts: 47
Tuncay Try that script in programm files, dont work.. thanks anyway

Code:
F1:: ;Current Dir to Readme.txt :(
ControlGetText, cgt, Edit1, A
path = %cgt%

;MsgBox %path% ; in example "C:\Programme\AutoHotkey\AutoHotkey.exe"
SplitPath, path,, dir
MsgBox %dir% ; in example "C:\Programme\AutoHotkey"

dirNameOnly := getDirName(dir)
MsgBox %dirNameOnly% ; in example "AutoHotkey"

getDirName(_path) {
    Return SubStr(_path,InStr(_path,"\",0,0)+1)
}

SplitPath, cgt, name, dir, ext, name_no_ext, drive
FileMove, %cgt%\Readme.txt, %cgt%\%dirNameOnly%_ReadMe.txt  ; Rename a single file.
Return

F2:: ;Create Test ReadMe file
FileAppend, `n%1DT%, %A_ScriptDir%\ReadMe.txt
Return

F3:: ; That work no problem.
ControlGetText, cgt, Edit1, A
FormatTime, 3DT,, ddMMyy,HH-mm-sss
FileMove, %cgt%\Readme.txt, %cgt%\%3DT%_ReadMe.txt

!x::ExitApp


sorry Humans, im terrible noob!!!

that's what i need,

Code:
F3::
ControlGetText, cgt, Edit1, A
SplitPath, cgt, name, dir, ext, name_no_ext, drive
FileMove, %cgt%\Readme.txt, %cgt%\%name%_ReadMe.txt
Return

thank U all!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, iDrug, Tipsy3000, Yahoo [Bot] and 17 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