Most smartphones have a feature in which you can double tap the spacebar to insert a period. Wouldn’t it be nice if you could do that on your Windows PC too? We’ll show you how you can.
大多数智能手机都有一项功能,您可以双击空格键以插入句点。 如果您也可以在Windows PC上做到这一点,这不是很好吗? 我们将向您展示如何做到。
We’re going to create an
AutoHotkey
script to insert a period followed by a space when you double tap on the space bar. AutoHotkey is a free, open-source program that allows you to automate repetitive tasks in Windows. It uses a scripting language that was originally designed to create keyboard shortcuts, or hotkeys, but it evolved into a scripting language that allows you to automate almost anything—no programming knowledge required.
我们将创建一个
AutoHotkey
脚本,当您在空格键上双击时插入一个句点,后跟一个空格。 AutoHotkey是一个免费的开放源代码程序,可让您在Windows中自动执行重复性任务。 它使用一种脚本语言,该脚本语言最初旨在创建键盘快捷键或热键,但后来演变为一种脚本语言,使您几乎可以自动化所有内容,而无需编程知识。
If you’re curious, check out
our beginner’s guide to AutoHotkey
to learn more about it. But even if you’ve never used it before, you should be able to follow the steps below easily.
如果您好奇,请查看
我们的AutoHotkey初学者指南
以了解更多信息。 但是,即使您以前从未使用过它,也应该可以轻松地遵循以下步骤。
Download AutoHotkey
, install it using the Express Installation, and restart your PC. Then, right-click on any empty area of the desktop and go to New > AutoHotkey Script.
下载AutoHotkey
,使用快速安装进行安装,然后重新启动PC。 然后,右键单击桌面上的任何空白区域,然后转到“新建”>“ AutoHotkey脚本”。
A file with the extension .ahk is created on your desktop. Rename the file, making sure to keep the .ahk extension. You can also move it wherever you want on your PC—put it in a safe place, because you’ll need to keep the script as long as you want this feature.
在您的桌面上创建扩展名为.ahk的文件。 重命名文件,确保保留.ahk扩展名。 您还可以将其移动到PC上的任何位置,将其放在安全的地方,因为只要需要此功能,就需要保留脚本。
Then, right-click on the file and select “Edit Script” from the popup menu.
然后,右键单击该文件,然后从弹出菜单中选择“编辑脚本”。
We will use what’s called a “hotstring” to replace two spaces with a period followed by a space. This will work in any program, any time you type two spaces.
我们将使用所谓的“ hotstring”将两个空格替换为一个句点,后跟一个空格。 每当您键入两个空格时,该命令均可在任何程序中使用。
When you select Edit Script, the script file you created opens in the default text editor, which in our case is Notepad. There are some lines automatically added to the beginning of the file. Put the cursor at the end and add the following text on a new line. You can just copy and paste the text.
选择“编辑脚本”后,创建的脚本文件将在默认文本编辑器(在我们的情况下为记事本)中打开。 有些行自动添加到文件的开头。 将光标放在末尾,然后在新行中添加以下文本。 您可以只复制并粘贴文本。
:*: ::{NumpadDot}{space}
Here’s what this line does:
这行的内容如下:
The asterisk (*
) between the first pair of colons is an option that indicates an ending character is not required. This means that as soon as you type two spaces, they will be replaced by a period followed by a space.
第一对冒号之间的星号( *
)是一个选项,指示不需要结尾字符。 这意味着,一旦您键入两个空格,它们就会被句号后跟一个空格所代替。
- There are two spaces between the next pair of colons. This indicates what you type to insert the replacement text.
下一对冒号之间有两个空格。 这表明您键入要插入替换文本的内容。
- The pair of colons after the two spaces is just a divider between the activating action (the two spaces) and what the action executes (replacing the two spaces with a period and a space).
两个空格后面的一对冒号只是激活动作(两个空格)和动作执行内容(用句点和空格替换两个空格)之间的分隔线。
- The items in brackets after the last colon are the characters that will replace the two spaces.
最后一个冒号后面方括号中的项目是将替换两个空格的字符。
Press Ctrl+S to save the script file and then click the “X” button in the upper-right corner of the window to close the text editor.
按Ctrl + S保存脚本文件,然后单击窗口右上角的“ X”按钮以关闭文本编辑器。
Double-click on the script file to run the script.
双击脚本文件以运行脚本。
Now, in any program where you can type text, such as text editors, word processors, and browsers, you can double-tap the space bar to type a period and a space. You may have to test the speed at which you need to double-tap the space bar for this to work.
现在,在任何可以键入文本的程序中,例如文本编辑器,文字处理器和浏览器,都可以点按两次空格键以键入句点和空格。 您可能需要测试双击空格键才能使其正常工作的速度。
You can edit the script at any time by right-clicking on the script file and selecting Edit Script, just like when you first created the script. You can also edit the script by right-clicking the AutoHotkey icon in the system tray and selecting “Edit This Script” from the popup menu. If you change the script, or add additional actions to it, use the “Reload This Script” option on the popup menu on the system tray icon to run the revised script without having to exit and re-run the script.
您可以随时通过右键单击脚本文件并选择“编辑脚本”来编辑脚本,就像您首次创建脚本一样。 您还可以通过右键单击系统任务栏中的AutoHotkey图标并从弹出菜单中选择“编辑此脚本”来编辑脚本。 如果更改脚本或对其添加其他操作,请使用系统任务栏图标弹出菜单上的“重新加载此脚本”选项来运行修改后的脚本,而不必退出并重新运行该脚本。
If you want your AutoHotkey script to run automatically when Windows starts, you can create a shortcut and put that shortcut in the Startup folder. Right-click on the .ahk script file and select “Create shortcut” from the popup menu.
如果希望Windows启动时自动运行 AutoHotkey脚本,则可以创建一个快捷方式并将该快捷方式放入“启动”文件夹中。 右键单击.ahk脚本文件,然后从弹出菜单中选择“创建快捷方式”。
Select the new shortcut and press Ctrl+C to copy it.
选择新的快捷方式,然后按Ctrl + C进行复制。
Press Windows+R on your keyboard to open the Run dialog box, type shell:startup
in the Open box, and click “OK” to open the Startup folder.
在键盘上按Windows + R打开“运行”对话框,在“打开”框中键入shell:startup
,然后单击“确定”以打开“启动”文件夹。
NOTE: When you add a shortcut to the shell:startup
folder, it will only launch when you are logged into the current account. If you want the shortcut to launch whenever any user logs in, type shell:common startup
in the Open box on the Run dialog box.
注意:将快捷方式添加到shell:startup
文件夹时,仅当您登录到当前帐户时,它才会启动。 如果希望在任何用户登录时启动快捷方式,请在“运行”对话框的“打开”框中键入shell:common startup
。
Press Ctrl+V to paste the shortcut into the Startup folder. Now, your AutoHotkey script will always run when Windows starts and you’ll be able to type two spaces to insert a period followed by a space.
按Ctrl + V将快捷方式粘贴到“启动”文件夹中。 现在,您的AutoHotkey脚本将始终在Windows启动时运行,并且您将能够键入两个空格以在句号后插入一个空格。
Again, to learn more about using scripts in Windows with AutoHotkey, read our beginner’s guide to using an AutoHotkey script.
同样,要了解有关在Windows中将脚本与AutoHotkey结合使用的更多信息,请阅读有关使用AutoHotkey脚本的初学者指南 。
翻译自: https://www.howtogeek.com/289862/how-to-automatically-type-a-period-with-a-double-space-in-windows/
objShell.SendKeys “{F5}”
使用 SendKeys 方法可以将
键击发送到无
自动化界面的应用程序
中。多数
键盘字符都可用一个
键击表示。某些
键盘字符由多个
键击组合而成(例如,CTRL+SHIFT+HOME)。要发送单个
键
mysqldump 导出数据库表数据到sql文件
中
mysqldump -hlocalhost -uroot -p table1 table2>E:/backup/wcs_xxx.sql
假设当前时间为20220318092532
Linux
xxx=`date '+%Y%m%d%H%M%S'`等于号前后不能有
空格,会被当作内容处理
Windows
xxx=%date:~0,4%%date...
word
中将
空格替换为If you find yourself in possession of a Word document where someone has typed two spaces between every sentence and you need to change those to use just one space, Word makes it easy to do ...