Script para criar novo arquivo no explorer txt, js, ts, jsx

Compartilhe seus scripts, funções, ferramentas e programas

Moderator: Gio

Post Reply
coreilabs
Posts: 2
Joined: 19 Mar 2022, 18:27
Contact:

Script para criar novo arquivo no explorer txt, js, ts, jsx

Post by coreilabs » 19 Mar 2022, 18:34

Testado no Windows 10 (W10), pesquisei muito mas não achei uma forma melhor para criar um arquivo txt, ou outro tipo de arquivo na pasta atual do windows

Code: Select all

#SingleInstance Force
Exit 

getRandom(){
s := (s := "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z") "," s "," s
Sort, s, Random D,
i := SubStr(StrReplace(s, ","), 1, 4)
return i
}
getPath(){
	ControlGetText, var, ToolbarWindow323, A
	;English windows version has to change "Endereço: " to "Adress: " 
	var2 := StrReplace(var, "Endereço: ")
	Return var2
	}

F1:: ; F1 hotkey

; new txt file random name without prompt

; fullPath := getPath()
; random := getRandom()
; FileAppend, This is a blank line`n, %fullPath%\Novo-%random%.txt

; new file with prompt filename and extension prompt
random := getRandom()
fullPath := getPath()
InputBox, fileName, Type the file name, Type filename with extension (file.txt), ,,,,,,,file-%random%.txt
FileAppend, This is a blank line`n, %fullPath%\%fileName%

Post Reply

Return to “Scripts e Funções”