Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;tab nation may 2021 v1
- SetWorkingDir %A_ScriptDir%
- ;===============================================
- ;Main GUI
- ;===============================================
- f1::
- mainGUI:
- List=
- loop, Files, % A_ScriptDir "\*.*"
- {
- SplitPath, A_LoopFileName,,,, FileName
- List .= FileName "|"
- }
- List := RTrim(List, "|")
- List := StrReplace(List, "|", "||",, 1) ; make first item default
- List := StrReplace(List, "Template Saver|")
- List := StrReplace(List, "Template Saver")
- Gui, Destroy
- Gui, Add, GroupBox, x12 y9 w330 h50 , Pick Your Template
- Gui, Add, DropDownList, x22 y29 w200 h250 vTempPick, % List
- Gui, Add, Button, x232 y29 w100 h20 gCopy2Clip, Copy to Clipboard
- Gui, Add, GroupBox, x12 y59 w330 h50 , New / Edit Template
- Gui, Add, Button, x22 y79 w90 h20 gCreateNew, New
- Gui, Add, Button, x122 y79 w90 h20 gEditDelete, Edit / Delete
- Gui, Add, Text, x122 y109 w120 h20 , Press F1 to reopen GUI
- Gui, Show, x784 y451 h131 w357, Template Main
- Return
- GuiClose:
- Gui, Destroy
- Return
- Copy2Clip:
- Gui, submit, Nohide
- FileRead, TempPick, %TempPick%.txt
- Clipboard = %TempPick%
- Return
- ;===============================================
- ;Create New Template
- ;===============================================
- CreateNew:
- Gui, Destroy
- Gui, Add, GroupBox, x12 y9 w450 h240 , Enter Template
- Gui, Add, Edit, x22 y29 w430 h210 vNewTemp, Hello _______ how was your day
- Gui, Add, GroupBox, x12 y249 w450 h50 , Name Your Template and Press Save
- Gui, Add, Edit, x22 y269 w270 h20 vNameTemp,
- Gui, Add, Button, x302 y269 w150 h20 gSaveTemp, Save
- Gui, Show, x704 y365 h318 w479, Create New
- Return
- ;===============================================
- ;Save New Template
- ;===============================================
- SaveTemp:
- Gui, Submit
- FileAppend, %NewTemp%, %NameTemp%.txt
- goto mainGUI
- Return
- ;===============================================
- ;Edit Delete Template
- ;===============================================
- EditDelete:
- List=
- loop, Files, % A_ScriptDir "\*.*"
- {
- SplitPath, A_LoopFileName,,,, FileName
- List .= FileName "|"
- }
- List := RTrim(List, "|")
- List := StrReplace(List, "|", "||",, 1) ; make first item default
- List := StrReplace(List, "Template Saver|")
- List := StrReplace(List, "Template Saver")
- Gui, Destroy
- Gui, Add, GroupBox, x12 y39 w450 h240 , Enter Template
- Gui, Add, Edit, x22 y59 w430 h210 vEditTemp,
- Gui, Add, DropDownList, x12 y9 w210 h250 vTempPick, % List
- Gui, Add, Button, x232 y9 w70 h20 gLoadTemp, Load
- Gui, Add, Button, x392 y9 w70 h20 gDeleteTemp, Delete
- Gui, Add, Button, x312 y9 w70 h20 gSaveEdit, Save
- Gui, Show, x670 y380 h294 w479, Edit / Delete Template
- Return
- DeleteTemp:
- Gui, Submit
- FileDelete, %TempPick%.txt
- goto mainGUI
- Return
- LoadTemp:
- Gui, Submit, nohide
- FileRead, EditTemp, %TempPick%.txt
- GuiControl,, EditTemp, %EditTemp%
- Return
- SaveEdit:
- Gui, Submit
- FileDelete, %TempPick%.txt
- FileAppend, %EditTemp%, %TempPick%.txt
- goto mainGUI
- Return
- f2::
- Loop, %A_ScriptDir%\*.txt{ ; insert dir of current folder see link below
- StringReplace, ItemInList, A_LoopFileName, .txt, , All
- Menu, MyMenu, Add, %ItemInList%, MenuHandler
- }
- Menu, MyMenu, Show
- Return
- MenuHandler:
- FileRead, TempPick, %A_ThisMenuItem%.txt
- Clipboard = %TempPick%
- send ^v
- return
Add Comment
Please, Sign In to add comment