---
title: "在 firefox 里选中文字就复制[AutoHotKey]"
date: 2008-11-24T12:39:19Z
modified: 2008-11-24T12:39:19Z
permalink: "https://www.appinn.com/autocopy-ahk/"
type: post
status: publish
excerpt: ""
categories:
  - AutoHotKey
tags:
  - AutoHotKey
  - AHK
  - Firefox
  - 自动
author: sfufoet
timestamp: 2008-11-24T12:39:19Z
---

感谢[小众](http://www.appinn.com/)读者 李栋 发过来的脚本。以下是原文和脚本：

使用 [Fterm](http://fterm.zj001.net/)（是个 BBS 和 Telnet 客户端软件） 的时候很喜欢它自动复制的功能：选中一段文字之后其内容会自动复制到剪切板内，很方便。原来在 Firefox 中也有类似插件[ AutoCopy](https://addons.mozilla.org/en-US/firefox/addon/383)，但可惜该插件目前尚不兼容 3.0.4。今日初试 [AutoHotKey](http://www.appinn.com/tag/ahk)，写下第一个脚本，感觉还挺方便，拿出来现一下，班门弄斧，贻笑大方而已。

~LButton::
 CoordMode, Mouse, Screen
 ;这一句，最好加上，不然在切换窗口的时候容易误触发；当然误触发应该也没啥事…
 MouseGetPos, x1, y1
 KeyWait, LButton, U
 WinGetActiveTitle, Title
 IfInString, Title, Firefox
 {
 MouseGetPos, x2, y2
 if (abs(x1-x2)>10 or abs(y1-y2)>10)
 ;当然得拖动一段距离才触发
 send ^c
 }
return

sfufoet 注：此脚本只在 Firefox 是有效，如果希望在 IE 或者 Opera 下启用，就把“IfInString, Title, Firefox” 修改为“If Title contains Firefox, Opera, Internet Explorer”。

用了这个脚本，会发生很受不了的问题：无法用剪贴板的文字来替换当前选中的文字。只能用键盘来选择文字。这个功能仁者见仁智者见智啦。

一次性解决 firefox 插件不兼容最新版的问题：

1. 打开 about:config
2. 右键点击页面， New->Boolean ，名称为 `extensions.checkCompatibility 值为 false`
3. 右键点击页面， New->Boolean ，名称为 ```extensions.checkUpdateSecurity ` 值为 false

via [花儿开了](http://blog.istef.info/2008/02/21/firefox-3-beta-3/)

## Topics

**分类目录:** [AutoHotKey](https://www.appinn.com/autohotkey-all-in-one.md)

**标签:** [AHK](https://www.appinn.com/tag/ahk/?output_format=md), [Firefox](https://www.appinn.com/firefox2.md), [自动](https://www.appinn.com/tag/%e8%87%aa%e5%8a%a8/?output_format=md)