js插入单击事件_只需单击一次即可插入任何特殊字符

js插入单击事件

js插入单击事件

Have you ever tried to insert a special character such as the cent sign or the copyright symbol, only to realize that this key isn’t available on your normal keyboard?  Here’s how you can make an AutoHotkey script that will let you easily insert any character you want.

您是否曾经尝试插入特殊字符(例如,分号或版权符号),只是为了意识到此键在普通键盘上不可用? 这是制作AutoHotkey脚本的方法,该脚本使您可以轻松插入所需的任何字符。

The Problem

问题

Special characters can often be annoying to use.  There are many different ways to insert special characters, and many programs have specific ways to insert them.  For example, in Microsoft Word you can insert a special character from the Symbol button on the Insert tab in the ribbon.

特殊字符经常会令人讨厌地使用。 插入特殊字符的方式有很多,许多程序都有插入特殊字符的方式。 例如,在Microsoft Word中,您可以从功能区中“ 插入”选项卡上的“ 符号”按钮插入特殊字符。

image

Word also has specialized keyboard shortcuts for many of the common special characters.  For example, you can insert the Registered Trademark symbol ® by pressing Alt+Ctrl+R.

Word还具有用于许多常见特殊字符的专用键盘快捷键。 例如,您可以通过按Alt + Ctrl + R插入注册商标符号®。

SNAGHTML24db69d

That’s a rather unwieldy shortcut, but it’s better than the default Windows shortcut for that symbol.  If you open the Character Map and select the Registered Trademark symbol, you’ll see that you could enter the ® symbol by pressing Alt+0174.  Now that’s a difficult shortcut to remember.

这是一个相当笨拙的快捷方式,但是比该符号的默认Windows快捷方式好。 如果打开“字符映射表”并选择“注册商标”符号,则会看到可以通过按Alt + 0174输入®符号。 现在,这是一个很难记住的捷径。

SNAGHTML25121cc

The Solution

解决方案

Thanks to AutoHotkey, we can solve this problem and make our own keyboard shortcuts for our favorite symbols.  AutoHotkey is a great tool that we frequently mention here, but if you don’t already have it installed, download it at the link below and setup as normal.

借助AutoHotkey,我们可以解决此问题,并为自己喜欢的符号制作自己的键盘快捷键。 AutoHotkey是我们在这里经常提到的一个很棒的工具,但是如果您尚未安装AutoHotkey,请在下面的链接中下载它并进行常规设置。

image

Once AutoHotkey is running, you can right-click it’s icon in the tray and select Edit This Script to add your special character shortcut to your script.

AutoHotkey运行后,可以右键单击任务栏中的图标,然后选择“ 编辑此脚本”以将特殊字符快捷方式添加到脚本中。

image

Adding a Special Character Hotkey

添加特殊字符热键

Here’s what you need to enter in your AutoHotkey script to create a shortcut for your special character.  This will let you press Alt+ the character of your choice to enter a special character.  Substitute your_hotkey with the character you want to use as your shortcut, and your_special_character with the special character you want to input.:

这是您需要在AutoHotkey脚本中输入的内容,用于为您的特殊字符创建快捷方式。 这样您就可以按Alt +选择的字符来输入特殊字符。 替换your_hotkey与您要用作快捷方式的性格,你要输入特殊字符your_special_character:

!your_hotkey:: { SendInput {your_special_character} } return

your_hotkey :: {SendInput { your_special_character }}返回

To find the special character you need to enter, open the Character Map in Windows, find the character, and then select Copy.  Now paste this instead of Your_special_character.

要查找需要输入的特殊字符,请在Windows中打开“字符映射表”,找到该字符,然后选择“ 复制” 。 现在粘贴它,而不是Your_special_character

image

For Example, we want to enter the degrees symbol by pressing Alt+o.  So, we entered the following in AutoHotkey:

例如,我们要通过按Alt + o输入度数符号。 因此,我们在AutoHotkey中输入了以下内容:

!o:: { SendInput {°} } return

!o :: {SendInput {°}}返回

Press Save in Notepad, and then reload the AutoHotkey script from the taskbar.

在记事本中,按保存,然后从任务栏重新加载AutoHotkey脚本。

image

Now, we can simply press Alt+o to enter °.  Entering the temperature just got easier!

现在,我们只需按Alt + o输入°。 输入温度变得更加容易!

You can substitute ! for ^ if you’d like to use Ctrl instead of Alt for your shortcuts.  Note also that many programs have keyboard shortcuts using Ctrl and Alt, and even many default Windows shortcuts such as Cut and Paste use Ctrl, so make sure to not make a shortcut that overrides these.

您可以替代! 如果您想使用Ctrl而不是Alt作为快捷方式,请输入^。 还要注意,许多程序都具有使用Ctrl和Alt的键盘快捷键,甚至许多默认的Windows快捷键(如“剪切”和“粘贴”)都使用Ctrl,因此请确保不要使用会覆盖它们的快捷键。

Here’s some scripts for common special characters we wanted to use this with.  Note that you can have as many of these in one script file as you like.

这是一些我们想与之配合使用的常见特殊字符的脚本。 请注意,您可以根据需要在一个脚本文件中包含多个。

Cent:

Euro:

Registered Trademark:

Copyright:

ñ:

!c::
{
SendInput {¢}
}
return
!e::
{
SendInput {€}
}
return
!r::
{
SendInput {®}
}
return
!p::
{
SendInput {©}
}
return
!n::
{
SendInput {ñ}
}
return

分:

欧元:

注册商标:

版权:

ñ:

!C::
{
SendInput {¢}
}
返回
!e ::
{
SendInput {€}
}
返回
!r ::
{
SendInput {®}
}
返回
!p ::
{
SendInput {©}
}
返回
!n ::
{
SendInput {ñ}
}
返回

Conclusion

结论

Whether you’re trying to enter a character from another language or simply need to make sure you show that your product name is copyrighted every time you right it, this simple trick will help you find and enter what you need quicker.  Although it may take a minute to setup, once it’s done you can simply leave it and just remember your new shortcut.  If you find that your shortcut interacts with another program, you can also easily change it anytime.

无论您是尝试输入另一种语言的字符,还是只需要确保每次显示正确时都表明您的产品名称受版权保护,此简单技巧就可以帮助您更快地找到并输入所需内容。 尽管可能要花一分钟的时间来设置,但一旦完成,您就可以直接保留它,并记住新的快捷方式。 如果发现快捷方式与另一个程序交互,则还可以随时轻松地对其进行更改。

Link

链接

Download AutoHotkey

下载AutoHotkey

翻译自: https://www.howtogeek.com/howto/21187/insert-any-special-character-with-a-single-keystroke/

js插入单击事件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值