# 请教：如何管理为数众多的脚本

**URL:** <https://forum.freemdict.com/t/topic/15861>\
**Category:** 软件经验交流展望\
**Created:** [2022 年9 月 30 日 14:57 UTC](https://forum.freemdict.com/t/topic/15861 "2022-09-30T14:57:45Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年9 月 30 日 14:57 UTC](https://forum.freemdict.com/t/topic/15861/1 "2022-09-30T14:57:45Z")

</div>

一般常写点小程序自用的朋友，在很长一段时间内应该都会积攒数量不少的脚本。

我的脚本多是JS的用于处理文本，因此都放在文本编辑器里，做成按钮或是菜单项，有些脚本可能和文本编辑器本身无关而是用于处理完全外部的独立文件，所以文本编辑器就起到脚本管理器的作用，要编辑修改某个脚本也方便。总觉得这个做法不太专业。另外，IDE可以管理项目，但是管理一堆小的脚本似乎也不太对。前些天从坛友处知道油猴这个东西，就想有没有类似的一个通用工具。

最近准备把脚本开始逐步迁移到Python平台来，原有的方法就不好用了。当然也可以直接把一堆 .py 文件放在文件夹里，但翻起来就麻烦了。想请教下各位先进一般都是如何管理一堆脚本的？谢谢！

---

<div class="post-metadata">

作者： ![Vim](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/vim/32/8408_2.png) [@Vim](https://forum.freemdict.com/u/Vim)\
发布日期： [2022 年9 月 30 日 15:46 UTC](https://forum.freemdict.com/t/topic/15861/2 "2022-09-30T15:46:29Z")

</div>

我也是用文本编辑器来管理：Vim + Vimwiki，主要是在Vimwiki笔记中创建相关脚本索引，查询、编辑、运行兼得。

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年9 月 30 日 15:50 UTC](https://forum.freemdict.com/t/topic/15861/3 "2022-09-30T15:50:50Z")

</div>

🤝 象Vim这样的高度依赖键盘的东西实在玩不来，敲键盘错误率太高。我是希望有一个图形界面，出来的东西就像Office一样，有工具条、按钮、菜单。

---

<div class="post-metadata">

作者： ![舒服员](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/%E8%88%92/13edae/32.png) [@舒服员](https://forum.freemdict.com/u/%E8%88%92%E6%9C%8D%E5%91%98)\
发布日期： [2022 年9 月 30 日 17:47 UTC](https://forum.freemdict.com/t/topic/15861/4 "2022-09-30T17:47:47Z")

</div>

试试这个 [Download | massCode](https://masscode.io/download/) , 不过我没用过.

---

<div class="post-metadata">

作者： ![mdxfan](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/mdxfan/32/31774_2.png) [@mdxfan](https://forum.freemdict.com/u/mdxfan)\
发布日期： [2022 年9 月 30 日 19:42 UTC](https://forum.freemdict.com/t/topic/15861/5 "2022-09-30T19:42:58Z")

</div>

用git管理

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 1 日 03:34 UTC](https://forum.freemdict.com/t/topic/15861/6 "2022-10-01T03:34:38Z")

</div>

@舒服员 看了下，是个管理 snippet 的工具，EmEditor中也有一个插件干这个，每个 snippet 的确可用于放一个独立脚本，但问题是它的全部 snippet 被打包放在自有格式的文件中。

@mdxfan 这目的是为了方便本地脚本的使用。

谢谢！

---

<div class="post-metadata">

作者： ![步天歌](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/%E6%AD%A5%E5%A4%A9%E6%AD%8C/32/29973_2.png) [@步天歌](https://forum.freemdict.com/u/%E6%AD%A5%E5%A4%A9%E6%AD%8C)\
发布日期： [2022 年10 月 1 日 04:18 UTC](https://forum.freemdict.com/t/topic/15861/7 "2022-10-01T04:18:16Z")

</div>

试试 Jupyter Notebook ？理由：

1. 可以按照分块运行代码，这样就可以把经常要修改的脚本全放在一起，不常改动的脚本记录下路径，要改的时候找起来也不麻烦
2. 无需安装其他软件，只需下载第三方库，实际是在浏览器里写代码
3. 本身就支持 Markdown，也可以用于其他编程语言，至少JavaScript是可以的（我还没有上手折腾，但看到有人提过）

一篇不错的教程：

> **[Jupyter Notebook介绍、安装及使用教程](https://zhuanlan.zhihu.com/p/33105153)**
>
> 一、什么是Jupyter Notebook？1. 简介Jupyter Notebook是基于网页的用于交互计算的应用程序。其可被应用于全过程计算：开发、文档编写、运行代码和展示结果。——Jupyter Notebook官方介绍简而言之，Jupyter Noteb…

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 1 日 04:31 UTC](https://forum.freemdict.com/t/topic/15861/8 "2022-10-01T04:31:07Z")

</div>

> [@步天歌](#):
>
> 在浏览器里写代码

我是要管理本地脚本啊

---

<div class="post-metadata">

作者： ![步天歌](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/%E6%AD%A5%E5%A4%A9%E6%AD%8C/32/29973_2.png) [@步天歌](https://forum.freemdict.com/u/%E6%AD%A5%E5%A4%A9%E6%AD%8C)\
发布日期： [2022 年10 月 1 日 05:00 UTC](https://forum.freemdict.com/t/topic/15861/9 "2022-10-01T05:00:59Z")

</div>

……我理解的“管理”不指望一劳永逸，最好的方法是每天都会看到，每天都可以思考改进，所以 Jupyter Notebook 的`%load `语法可以加载指定脚本就已经实现我想管理脚本的目的了：有索引可以快速查找；有类似双向链的功能，修改之后可以快速同步更新（我之前一直用的Obsidian的超链接语法给写过的脚本编写一个目录）；跑代码也不割裂（用Obsidian只能用默认的工具打开脚本，这就意味着我不能用Python的解释器作为默认的打开方式，不然在设置定时的时候有可能会遇到问题:)

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 1 日 05:07 UTC](https://forum.freemdict.com/t/topic/15861/10 "2022-10-01T05:07:22Z")

</div>

我就希望有一个图形界面，出来的东西就像Office一样，有工具条、按钮、菜单，这样调用每个脚本就像在 Office 里面按一个按钮一样方便直观。

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 1 日 08:02 UTC](https://forum.freemdict.com/t/topic/15861/11 "2022-10-01T08:02:32Z")

</div>

EmEditor 官方有一个管理脚本(宏)的脚本，非常方便，但是只能列出指定文件夹下的EmEditor脚本文件 .jsee 和 .vbee  
\<\>[Popup Macros – EmEditor (Text Editor)](https://www.emeditor.com/files/popupmacros-jsee/)\<\>

我把它修改了一下，可同时列出其中的 .exe .py .lnk 文件并点击执行，应该挺好用的  
[PopupMacros\_enhanced3.zip](https://forum.freemdict.com/uploads/short-url/1SVjUSqA1F6jaWR6kBBaU2apn5a.zip) (2.0 KB)  
 ![Image](https://forumcdn.freemdict.com/uploads/default/original/3X/8/4/84843d4404c6ad7d405b9559ca4756f819777e80.png)

（附）把外部程序加入成 EmEditor 中工具条上的按钮 的方法：先在 External Tools \> Customize 中加入该程序，然后就能把它加到定制工具条上成为按钮。

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 1 日 08:43 UTC](https://forum.freemdict.com/t/topic/15861/13 "2022-10-01T08:43:52Z")

</div>

谢谢！能象Office里面一样，把独立脚本都设成工具条按钮、菜单项吗？

这是我以前的文本编辑器中的一个定制工具条，对应几个常用的脚本  
 ![image](https://forumcdn.freemdict.com/uploads/default/original/3X/4/c/4cc88fb0b0a1ed693eaf626a8f279b810a48a2ac.png)

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 1 日 08:48 UTC](https://forum.freemdict.com/t/topic/15861/15 "2022-10-01T08:48:40Z")

</div>

哦额外做插件还是有点复杂，我上面那个工具条只要拖一拖就成了，和Office一样

---

<div class="post-metadata">

作者： ![Vim](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/vim/32/8408_2.png) [@Vim](https://forum.freemdict.com/u/Vim)\
发布日期： [2022 年10 月 1 日 10:58 UTC](https://forum.freemdict.com/t/topic/15861/16 "2022-10-01T10:58:00Z")

</div>

> [@surfactant](#):
>
> 只要拖一拖就成了，和Office一样

目前想到最合适的应该就是Total Commander，无论是文件夹管理、菜单、工具栏；编辑、运行，都可以随意定制。

 ![image](https://forumcdn.freemdict.com/uploads/default/original/3X/a/b/ab65999c2d3d121222d0b4bc6bfe501d721151f2.png)

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 1 日 11:39 UTC](https://forum.freemdict.com/t/topic/15861/17 "2022-10-01T11:39:05Z")

</div>

真是一个很牛X的工具，以前设想过，没想到还真有。谢谢老兄分享！

---

<div class="post-metadata">

作者： ![surfactant](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@surfactant](https://forum.freemdict.com/u/surfactant)\
发布日期： [2022 年10 月 12 日 04:42 UTC](https://forum.freemdict.com/t/topic/15861/18 "2022-10-12T04:42:32Z")

</div>

再推荐一下11楼中我改进的这个 EmEditor 宏。

只要把 Root Folder 设成你的存放所有用于处理mdx词典的python脚本的文件夹，无论这个文件夹的结构多复杂，都会变成一个树形菜单弹出来，十分方便。

由于处理mdx基本上也少不了EmEditor(轻量，运行快，大文件，独特的csv表格模式），如果加上各位自己的专用的python脚本库，EmEditor就可变成一个仿佛专用于处理 mdx 的 Word兼Excel 的集成环境

![image](https://forumcdn.freemdict.com/uploads/default/original/3X/8/a/8a2b12df6109752dd44cccf4c45e7541bdcc4555.png)
