 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ahkiot0
Joined: 31 May 2008 Posts: 36
|
Posted: Sat Nov 21, 2009 10:56 pm Post subject: SplitPath current Dir |
|
|
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 Sun Dec 06, 2009 7:55 pm; edited 8 times in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Sat Nov 21, 2009 11:29 pm Post subject: |
|
|
| Refer AHK Documentation for A_MyDocuments and A_WorkingDir |
|
| Back to top |
|
 |
ahkiot0
Joined: 31 May 2008 Posts: 36
|
Posted: Mon Nov 23, 2009 8:23 pm Post subject: |
|
|
| Help still needed |
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 1886 Location: Germany
|
Posted: Tue Nov 24, 2009 12:20 am Post subject: |
|
|
| 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)
} |
|
|
| Back to top |
|
 |
Guest
|
Posted: Thu Nov 26, 2009 1:41 am Post subject: |
|
|
work, but.. rename not "AutoHotkey", previous folder "Programme"  |
|
| Back to top |
|
 |
ahkiot0
Joined: 31 May 2008 Posts: 36
|
Posted: Thu Nov 26, 2009 1:46 am Post subject: |
|
|
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! |
|
| 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
|