Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

How to reload file within Calcpad without restarting

Notepad++

  1. Install https://github.com/guilryder/clavier-plus
  2. Create file: C:\my-cli\npp-run-calcpad.bat:
"%SystemRoot%\System32\chcp.com" 65001 > nul
"%SystemRoot%\System32\tasklist.exe" | "%SystemRoot%\System32\find.exe" "Calcpad.exe" || ("%programfiles%\Clavier\Clavier.exe /sendkeys  "[{Focus,10,*Notepad++}][Ctrl+S]" & timeout 1 & start "" "%programfiles%\Calcpad\Calcpad.exe" "%~1" & exit)
"%programfiles%\Clavier\Clavier.exe" /sendkeys "[{Focus,10,*Notepad++}][Ctrl+S][{Copy,%~1}][{Wait,10}][{Focus,10,Calcpad 5.*}][{Wait,10}][Alt][{Wait,10}][Down][{Wait,10}][Enter][{Wait,10}][Right][{Wait,10}][Enter][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+O][{Wait,10}][Ctrl+V][{Wait,10}][Enter][{Wait,200}][{Focus,200,*Notepad++}]"
  1. Change shortcuts.xml inside Notepad++ folder:
<?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus>
    <InternalCommands />
    <Macros>
        <Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
            <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
        </Macro>
    </Macros>
    <UserDefinedCommands>
        <Command name="Get PHP help" Ctrl="no" Alt="yes" Shift="no" Key="112">https://www.php.net/$(CURRENT_WORD)</Command>
        <Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command>
        <Command name="Open selected file path in new instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command>
        <Command name="CalcPad" Ctrl="no" Alt="no" Shift="no" Key="120">C:\my-cli\npp-run-calcpad.bat &quot;$(FULL_CURRENT_PATH)&quot;</Command>
    </UserDefinedCommands>
    <PluginCommands />
    <ScintillaKeys>
        <ScintKey ScintID="2469" menuCmdID="42010" Ctrl="yes" Alt="no" Shift="yes" Key="68" />
    </ScintillaKeys>
</NotepadPlus>
  1. NOTE!!! It runs by F9 now (Key="120") - you can change it from menu Run -> Modify Shortcut/Delete command
  2. Remove RunMe plugin from Notepad++ if you don't use it for other cases.

CudaText

  1. Install https://github.com/guilryder/clavier-plus
  2. Create file: C:\my-cli\cudatext-run-calcpad.bat:
"%SystemRoot%\System32\chcp.com" 65001 > nul
"%SystemRoot%\System32\tasklist.exe" | "%SystemRoot%\System32\find.exe" "Calcpad.exe" || (start "" "%programfiles%\Calcpad\Calcpad.exe" "%~1" & exit)
"%programfiles%\Clavier\Clavier.exe" /sendkeys "[{Copy,%~1}][{Wait,10}][{Focus,10,Calcpad 5.*}][{Wait,10}][Alt][{Wait,10}][Down][{Wait,10}][Enter][{Wait,10}][Right][{Wait,10}][Enter][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+O][{Wait,10}][Ctrl+V][{Wait,10}][Enter][{Wait,200}][{Focus,200,*Notepad++}]"
  1. Install plugin "External Tools"
  2. Add tool with Tools -> Config… -> Add…:
  • Name: cudatext-run-calcpad.bat
  • File name: C:\my-cli\cudatext-run-calcpad.bat
  • Parameters: {FileName}
  • Initial folder: {FileDir}
  • Lexers: Calcpad
  • Save before: Current document
  • Hotkey: F9
  • Capture output: Ignore
@Proektsoftbg
Copy link

Proektsoftbg commented Apr 6, 2022

Great Job! Thank you for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment