快捷运行窗口

从大神那学习的代码,自己进行了改编,形成了自己日常使用的快捷运行窗口,在输入命令框中输入需要启动的中文即可启动对应程序或网页,百度搜索关键字方式:bd:关键字,知乎:zh:关键字,淘宝:tb:关键字,其它内容根据代码自行发掘

g_file_keys =
g_send_keys =
g_var_keys =
g_wintitle = 我的运行窗口 ahk_class AutoHotkeyGUI
g_title = 我的运行窗口
g_bAutoList := true
#NoEnv
#Warn
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
Gui +ToolWindow +AlwaysOnTop
Gui Add, ComboBox, x17 y29 w280 v_ComboBox,
Gui Add, Button, x39 y69 w75 h23 Default g【我的运行窗口_确定按钮】, 确定(&Y)
Gui Add, Button, x211 y70 w75 h23  g【我的运行窗口_取消按钮】, 取消(&N)
Gui Add, GroupBox, x6 y12 w307 h50 v_GroupBox, 请输入命令
Gui +LastFound
Gui, Color, EEAA99
Gui Show, xCenter yCenter w324 h107, %g_title%
OnMessage( 0x06, "WM_ACTIVATE" )
Return
-----------------------------------------------------
【我的运行窗口_输入框】:
ControlGetText var_curInput, Edit1, %g_wintitle%

	 if var_curInput =
	     {
	         GuiControl, Text, _GroupBox, 请输入命令
	         Control HideDropDown, , ComboBox1,
	     }
   
	 if (var_preInput == var_curInput)
	     {
      	 return
	     }
	    var_preInput := var_curInput

;;___显示输入内容所对应的具体内容________________________________________

	
return
;;---按钮响应----------------------------------------------------------------
【我的运行窗口_确定按钮】:
gui, Submit
sleep 100
var_user := _ComboBox
	if var_user =
	{
		;ControlGetText var_user, Edit1, %g_wintitle%
	}
	;MsgBox %var_user%
		;;___首字母为";"时直接run分号后面的命令__________________________________
	StringLeft  vartemp, var_user, 1 ;搜索输入内容最左边的第1个字符,var_user为输入内容的存储的变更
	if vartemp = ?
	{
		if (var_user == "?在线帮助")
		{
			run https://www.baidu.com
		}
		return
	}
	else if (var_user = "计算器")
	{
		run calc
                                ExitApp
		return
	}
	else if(var_user = "画图板")
	{
		run mspaint
                               ExitApp
		return
	}
	else if(var_user = "注册表")
	{
		run regedit
                               ExitApp
		return
	}
	else if(var_user = "cmd")
	{
		run *RunAs cmd ,,max
                               ExitApp
		return
	}
	
	else if(var_user = "公司邮箱")
	{
		run https://email.cnnp.com.cn/coremail/index.jsp
                               ExitApp
		return
	}
	else if(var_user = "私人邮箱")
	{
		run http://mail.qq.com
                               ExitApp
		return
	}
                else if(var_user = "文档")
	{
		run https://docs.qq.com/desktop/?
                               ExitApp
		return
	}
	else if(var_user = "卸载")
	{
		run d:Program Files (x86)Uninstall ToolUninstallTool.exe
                               ExitApp
		return
	}
	else if(var_user = "截图")
	{
		run d:Program Files (x86)Snipaste-1.16.2-x64Snipaste.exe
                               ExitApp
		return
	}
	else if(var_user = "语雀")
	{
		run https://www.yuque.com/dashboard
                               ExitApp
		return
	}	
	else if(var_user = "词典")
	{
		run d:Program Files (x86)eudiceudic.exe
                               ExitApp
		return
	}
               else if(var_user = "脑图")
	{
		run D:Program Files (x86)XMindXMind.exe
                               ExitApp
		return
	}
               else if(var_user = "视频剪辑")
	{
		run d:Program Files (x86)SMMVSplitter视频剪辑.bat
                               ExitApp
		return
	}
	 else if(var_user = "微信")
	{
		run d:Program Files (x86)WeChatWeChat.exe
                               ExitApp
		return
}
	 else if(var_user = "ahk")
	{
		run d:AHKSciTE2.1.0cnSciTE.exe
                               ExitApp
		return
}
	else if (vartemp = ";") ;如遇分号开头,则执行后面的命令
	{
		StringMid vartemp, var_user, 2
		run %vartemp%
		;~ iniwrite, %var_user%, temp.ini, run, last
		;~ ∑排序最近运行的命令( var_user, "rundirect" )
		return
	}
	;;___用户输入的是网址或文件路径, 则直接运行______________________________
	StringMid, vartemp, var_user, 2, 2
	StringLeft varhttp, var_user, 7
	if (vartemp = ":/" or varhttp = "http://")
	{
		run %var_user%
		;∑排序最近运行的命令( var_user, "web" )
		return
	}
	stringLeft varwww, var_user, 4
	if (varwww = "www.")
	{
		run http://%var_user%
		;∑排序最近运行的命令( var_user, "web" )
		return
	}
	else if(varwww = "bd::") ;通过百度搜索关键字
	{
		StringMid varwww1, var_user, 5 ;选取从左数第5字符开始的字符串做为关键字
		;MsgBox %varwww1%
		run http://www.baidu.com/s?wd=%varwww1%
                               ExitApp
		return
	}
	else if(varwww = "zh::")  ;通过知乎搜索关键字
	{
		StringMid varwww1, var_user, 5
		;MsgBox %varwww1%
		run https://www.zhihu.com/search?type=content&q=%varwww1%
                               ExitApp
		return
	}
	else if(varwww = "tb::")   ;通过淘宝搜索关键字
	{
		StringMid varwww1, var_user, 5
		;MsgBox %varwww1%
		run https://s.taobao.com/search?q=%varwww1%
                               ExitApp
		return
	}
	return 
【我的运行窗口_取消按钮】:
GuiClose:
ExitApp
Return

Esc::
  ExitApp

Return


为TA充电
共{{data.count}}人
人已赞赏
办公学习

利用AHK快速实现Typora图注

2021-5-16 12:55:37

办公

输入法状态切换(简易板)

2021-5-20 10:28:18

2 条回复 A文章作者 M管理员
  1. 1河许人

    👍

  2. 陌缘离殇

    👍👍👍👍👍👍

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索