---
title: "AHK 快餐店[11] 之 虚拟桌面 AHK 版"
date: 2007-11-01T23:26:57Z
modified: 2007-11-03T00:41:34Z
permalink: "https://www.appinn.com/ahk-fast-food-restaurant-11-desktop-switch/"
type: post
status: publish
excerpt: ""
categories:
  - AutoHotKey
tags:
  - AutoHotKey
  - AHK
  - 桌面工具
  - 虚拟
featured_image: "https://www.appinn.com/wp-content/uploads/213923_2061216184_drdltcra-14.jpg"
author: sfufoet
timestamp: 2007-11-03T00:41:34Z
---

![](https://static2.appinn.com/images/img1/yupoo/20071029/213923_2061216184_drdltcra.jpg)
[上回](https://www.appinn.com/ahk-fast-food-restaurant-10-change-keys.md)我们把键盘折腾个半死，今天我们要折腾的是：桌面。

虚拟桌面有什么用捏？如果你想在上班的时候看[小众](http://www.appinn.com)、[煎蛋](http://jandan.net)、[玩游戏](http://playbus.net)……又怕 boss 走过来的时候，手忙脚乱地关闭一堆窗口，那么虚拟桌面是必备的啦。

小众介绍过三款虚拟桌面：[Yod’m 3D – 3D 虚拟桌面](http://www.appinn.com/yodm-3d/ "Permanent Link to Yod’m 3D - 3D 虚拟桌面")、[VirtuaWin – 很酷的虚拟桌面\[更新\]](http://www.appinn.com/virtuawin/ "Permanent Link to VirtuaWin - 很酷的虚拟桌面[更新]")、[VirtuaWin – 很酷的虚拟桌面\[更新\]](http://www.appinn.com/virtuawin/ "Permanent Link to VirtuaWin - 很酷的虚拟桌面[更新]")。

废话少说。[下载虚拟桌面 AHK 版](http://g1.appinn.com/190) | [来源](http://www.autohotkey.com/forum/topic6182.html&postdays=0&postorder=asc&highlight=multiple+virtual+desktops&start=15)。

运行，看看下面代码你就知道怎么用了：

> !1::SwitchToDesktop(1)
> !2::SwitchToDesktop(2)
> !3::SwitchToDesktop(3)
> !4::SwitchToDesktop(4)
> 
> ^!1::SendActiveToDesktop(1)
> ^!2::SendActiveToDesktop(2)
> ^!3::SendActiveToDesktop(3)
> ^!4::SendActiveToDesktop(4)

再啰嗦一下使用方法：Alt + 1 切换到第一个桌面。其他类推。Ctrl + Alt + 1 把当前窗口发送到 第一个桌面。另外，如果虚拟桌面不够用的话，再添加：

> !5::SwitchToDesktop(5)

如果你的键盘按键够用的话，是可以支持无限多个虚拟桌面的。

看着本期这么短，不好意思发出去。顺便教大家怎么把 AHK 脚本编译成 exe，这样就可以很方便和你的朋友分享了。以本文的脚本为例。

打开 AHK 所在文件夹下的 Compiler 文件夹，双击里面的 Ahk2Exe.exe。

然后依次浏览文件：要编译的 AHK 文件，编译后的 exe 文件名，编译后的 exe 要显示的图标。其他一般不用输入。如下图。选择好后，点击 convert。

![](https://static2.appinn.com/images/img1/yupoo11/20071101/213259_327503835.jpg)

下回预告：[AHK 快餐店\[12\] 之 秒杀窗口，左键加右键](https://www.appinn.com/ahk-fast-food-restaurant-12-lbutton-rbutton-close-window/?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), [桌面工具](https://www.appinn.com/tag/%e6%a1%8c%e9%9d%a2%e5%b7%a5%e5%85%b7/?output_format=md), [虚拟](https://www.appinn.com/tag/%e8%99%9a%e6%8b%9f/?output_format=md)