Hi All,
First I have no experiance, this is totally forign to me, so I'm hoping that one of you geniuses can help me flesh something out.
I have a folder of hundreds of .txt files, all I want to be able to do is when I open a .txt file , Select All, Copy , so that I can quickly paste the contents in another program.
Any help would be appreciated.
BASIC MACRO
Re: BASIC MACRO
You don't have to open a text file you can read it directly into the clipboard using the http://ahkscript.org/docs/commands/FileRead.htm
FileRead, Clipboard, c:\pathto\file.txt
Now you can paste the text.
You can use a http://ahkscript.org/docs/commands/LoopFile.htm to read all files one by one, I assume you would need to read them in a specific order, that would also be possible.
Here is good http://ahkscript.org/docs/Tutorial.htm to get you started.
Tip: post in Ask for Help in future. A mod will probably move this thread there.
FileRead, Clipboard, c:\pathto\file.txt
Now you can paste the text.
You can use a http://ahkscript.org/docs/commands/LoopFile.htm to read all files one by one, I assume you would need to read them in a specific order, that would also be possible.
Here is good http://ahkscript.org/docs/Tutorial.htm to get you started.
Tip: post in Ask for Help in future. A mod will probably move this thread there.
Re: BASIC MACRO
a DOS command , but not searches in subfolder
Code: Select all
f1=%a_desktop%\NEW_alltext.csv ;- < save all text files here
preselect=%a_desktop% ;- search for folder from here
FileSelectFolder,fd,%PRESELECT%
if fd=
return
setworkingdir,%fd%
runwait, %comspec% /k type *.txt >>"%F1%",,hide ; search text-files in selected folder , but not in subfolders
;runwait, %comspec% /k type *.txt >>"%F1%",,
run,%fd% ;- open folder
run,notepad %f1% ;- open csv-file
return
Re: BASIC MACRO
If you prefer to open your file in notepad, inspect or alter the contents then copy all of it to the clipboard, try this script. Run the script. When ready be sure notepad is the active window and press keys Ctrl & Spacebar.
Code: Select all
^space::
send {ctrldown}ac{ctrlup}
click ;this will remove the highlighting
TrayTip,Success,Contents were copied to clipboard,3
return
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
Re: BASIC MACRO
thank you Datalife
also an example , copy marked text to a GUI edit and then save
or can also make script with loop files folders and save the content of desired extensions (text-files) to one text-file
also an example , copy marked text to a GUI edit and then save
or can also make script with loop files folders and save the content of desired extensions (text-files) to one text-file
Code: Select all
;-- mark text and have it in edit ( not dragdrop) sendtoeditx
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
f2=%a_scriptdir%\SAVED.txt
edcol1=white
GUI,2:+AlwaysOnTop
Gui,2: Color, ControlColor, Black
Gui,2: Font, CDefault, FixedSys
Gui,2:Add, Edit , x5 y10 w800 h110 c%edcol1% vF1,
Gui,2:add, button, x5 y130 w100 h25 gSave1,SAVE
GUI,2:show, NA W820 H160 X20 Y0, Mark Text and use alt+F6
return
;----------------------------------------------------------
2GuiClose:
ExitApp
save1:
Gui,2:submit,nohide
ifexist,%f2%
filedelete,%f2%
if f1<>
{
fileappend,%f1%,%f2%
run,%f2%
}
return
*~$!F6::
sc=ahk_class AutoHotkeyGUI
classNN=Edit1
C2=
Clipboard := ""
Send, ^c
sleep,100
clipwait,1
C2:=clipboard
stringreplace,c2,c2,`r`n,`n,all
;if (ErrorLevel)
; return
IfWinNotActive ,%SC%,,WinActivate,%SC%
WinWaitActive,%SC%
ControlSend,%classnn%,%c2%`n,%sc%
return
;=========================================================
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 71 guests