Hi
I have a very simple script:
^t::
InputBox, name, Please select file name
FileAppend,,% name% .txt
Run% name% .txt
I would like to create a txt file in my folder (which I have just opened) ...
but how can I address the current window?
Kind regards
notepad // txt file in same folder
Re: notepad // txt file in same folder
What do you want to do with the window that you just opened? Put text in it after you opened it? It would have been easier to put the text in it before you opened it with FileAppend. Is there a reason why you don't want to do that?
By the way, there are a few places where you have a space in the wrong place around a % character. Should be like this:
(you should also have a return at the end)
By the way, there are a few places where you have a space in the wrong place around a % character. Should be like this:
Code: Select all
^t::
InputBox, name, Please select file name
FileAppend,,%name% .txt ; removed space before "name"
Run %name%.txt ; added space after "Run" and removed the space before "name" and before ".txt"
return
Re: notepad // txt file in same folder
I just want to create a txt file in the opened Explorer window
Re: notepad // txt file in same folder
Some like this ?
Code: Select all
#if WinActive("ahk_class CabinetWClass ahk_exe explorer.exe")
^t::
InputBox, name, Please select file name
if ErrorLevel
return
fname := Explorer_GetCurrentFolder() "\" name ".txt"
FileAppend,, % fname
Run % fname
return
#if
Explorer_GetCurrentFolder() {
global hwnd
WinGet, process, processName, % "ahk_id" hwnd:=WinExist("A")
WinGetClass class, ahk_id %hwnd%
if (process = "explorer.exe")
if (class ~= "(Cabinet|Explore)WClass") {
for window in ComObjCreate("Shell.Application").Windows
if (window.hwnd==hwnd)
path := window.Document.FocusedItem.path
SplitPath, path,,dir
}
return dir
}
*Esc::
ExitApp
return
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Re: notepad // txt file in same folder
wow thanks, now only code understand ^ ^
Who is online
Users browsing this forum: Google [Bot], madensuyu1, peter_ahk and 348 guests