DonationCoder.com Software > Post New Requests Here
Create an empty txt file in the active window
Contro:
Create an empty txt file in the active window
I would like the code for create an empty txt file , by example instructions.txt in the folder open and active with a hotkey assign.
In other words create a file in the open window.
I supposed i need an ini configuration file for this purpose.
:-*
AbteriX:
Which window do you talk about?
WinExplorer? Try right click context menu > New > Text file
c.gingerich:
Here is an AutoHotkey script that will do what you ask (attached is an compiled EXE as well). You can change the hotkey by editing the script. Right now it is set to Win+N (#n in the script). This works on my Windows 7 system. Not sure about others, you'll have to test it out. Hope this helps.
--- ---;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Chris Gingerich
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in
your Windows folder)
;
; Creates a new textfile in the current folder if an explorer window is active.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#n::
IfWinActive,ahk_class CabinetWClass
{
Send !fwt
}
MilesAhead:
If an item to create a new text file is not already in the New menu you can add it using this info:
http://windowsxp.mvps.org/shellnewadd.htm
Also you can put a file such as Template.txt in C:\Windows\ShellNew
and put that info in the registry key. The file will copy whatever boiler plate text is in the template file.
Also you can create an ahk_group to add more window classes such as Progman and WorkerW to do the same thing with the desktop New menu.
The New menu does not open in Computer. You'll need some test to screen out situations where Computer is the "folder" currently open or where a file or folder is selected. If a folder or file is selected you don't get the New menu. You get the context menu for a folder or for that file type. (There's always a fly in said ointment.) :)
MilesAhead:
This is what I have in AutoIt3. It suffers from the same foible that you have to make sure nothing on the desktop or in the folder is selected. (Also as I mentioned, it doesn't work in Computer and other special Shell Object folders, which may include the libraries.)
--- ---#include <WinAPI.au3>
$hotkey = "^+{F10}"
If Not HotKeySet($hotkey, "_MakeNewTextFile") Then
MsgBox(0x1010,"MakeNewTextFile",$hotkey & " could not be assigned as Hotkey")
Exit
EndIf
While 1
Sleep(100)
WEnd
Func _MakeNewTextFile()
Local $handle = _WinAPI_GetForegroundWindow()
Local $className = _WinAPI_GetClassName($handle)
If $className = "Progman" Or $className = "WorkerW" Or $className = "ExploreWClass" Or $className = "CabinetWClass" Then
Send("{AppsKey}")
Sleep(10)
Send("w")
Sleep(10)
Send("t")
Sleep(10)
Send("instructions")
EndIf
EndFunc
Navigation
[0] Message Index
[#] Next page
Go to full version