---
title: "AHK 快餐店[14] 之 复制粘贴，右键加左键"
date: 2007-11-04T23:58:17Z
modified: 2007-11-15T03:46:42Z
permalink: "https://www.appinn.com/coy-paste-hotkey/"
type: post
status: publish
excerpt: ""
categories:
  - AutoHotKey
tags:
  - AutoHotKey
  - AHK
featured_image: "https://www.appinn.com/wp-content/uploads/213923_2061216184_drdltcra-11.jpg"
author: sfufoet
timestamp: 2007-11-15T03:46:42Z
---

[![](https://static2.appinn.com/images/img1/yupoo/20071029/213923_2061216184_drdltcra.jpg)

](https://www.appinn.com/coy-paste-hotkey.md)[上回](https://www.appinn.com/ahk-fast-food-restaurant-13-stop-watch.md)介绍了一个秒表，并教大家怎么读写 ini 文件。

先声明一下：读者 plato 留言抗议说讲故事部分啰嗦了点。我想说的是，这是我的风格。不喜欢的话，请直接略过。

今天掌柜我在门口挂了个牌子：特价 AHK 技巧大减价——复制粘贴，右键加左键。没多久 [poisson](http://ipoisson.net/) 就进门来抗议鸟。“喂喂，掌柜啊，你是不是搞错啦。前天才卖过‘[秒杀窗口，左键加右键](https://www.appinn.com/ahk-fast-food-restaurant-12-lbutton-rbutton-close-window.md)’，怎么今天换汤不换药啊。”

没搞错啊，今天要卖的是右键加左键，上次卖的是左键加右键，不一样的啦。

简介一下用法：按住右键点击左键，复制选中的东东。到目标位置之后呢，按下鼠标滚轮粘贴。滚轮只会在右键加左键按下之后有粘贴功能，粘贴动作完成之后，滚轮又变回正常的滚轮。Ctrl + 滚轮是粘贴功能。这样日常的复制粘贴工作全靠鼠标就能完成。[点击这里下载代码](http://g1.appinn.com/194)。

> ~RButton::
> Hotkey, MButton, Paste
> Keywait, LButton, d, t0.2
> ; 参数 d （down）表示按键处于按下状态，t0.2 是等待 0.2 秒。
> if errorlevel = 0
> ; 如果返回的错误码（errorlevel，很多的 AHK 命令都会返回错误码，这个变量是 AHK 自带的。）是 0 ，也就是说上面的 Keywait 命令执行成功。如果是 1 的话，说明 Keywait 执行失败。失败说明我们按下了右键之后，没有在 0.2 秒内按下左键。
> {
> send ^c
> Hotkey, MButton, on
> }
> return
> 
> Paste:
> send ^v
> Hotkey, MButton, off
> return
> 
> ^MButton::
> send ^v
> return

今天的代码好简单，看过这一系列的朋友应该都能看明白的。Hotkey 命令在[第十期有过详细的介绍](https://www.appinn.com/ahk-fast-food-restaurant-10-change-keys.md)。

要补充的是，这样写出来的热键，也就说不用 Keywait 命令：

> ~RButton & LButton::

只在火狐里面能用，奇怪了。

下回预告：[AHK 快餐店\[15\] 之 史上最强的 Alt + Tab](https://www.appinn.com/ahk-fast-food-restaurant-15-alt-tab-enhance/?output_format=md)

## Topics

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

**标签:** [AHK](https://www.appinn.com/tag/ahk/?output_format=md)