博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
非常NB的一款快捷启动软件--Merry
阅读量:3526 次
发布时间:2019-05-20

本文共 9580 字,大约阅读时间需要 31 分钟。

Merry 被设计为了能将日常重复性操作简化为一个快捷键或者命令。Merry 采用完全开放的体系, 可以使用或者外部程序来扩展 Merry 的功能。

另附一个自己扩展的LUA脚本:

--启动MerryaddCommand{ key = 'A-R', func = toggleMerry }--最大化/还原当前窗口addCommand{ key = 'A-M', func = function()	local window = getForegroundWindow()	if isWindowMax(window) then		showWindow(window, 'restore')	else		showWindow(window, 'max')	endend }--关闭当前窗口addCommand{ key = 'A-Q', func = function()	closeWindow(getForegroundWindow())end }--隐藏/显示当前窗口local curHideWindowaddCommand{ key = 'A-H', func = function()    if not curHideWindow then        curHideWindow = getForegroundWindow()        showWindow(curHideWindow, 'hide')    else        showWindow(curHideWindow, 'normal')        curHideWindow = nil    endend }if WINDOWS then	for i = string.byte('a'), string.byte('z') do		local disk = string.char(i)		local isOk, errMsg = io.open(disk .. ':')		if isOk or errMsg:find('Permission denied') then			addCommand{ command = disk, func = function() shellExecute(disk .. ':', '', '', 'normal') end }		end	end		--打开我的电脑	addCommand{ command = 'computer', func = function() shellExecute('::{20D04FE0-3AEA-1069-A2D8-08002B30309D}', '', '', 'normal') end }			--打开merry根目录	addCommand{ command = 'merry', func = function() shellExecute('explorer', '.', '', 'normal') end }			--打开t00ls根目录	addCommand{ command = 'tools', func = function() shellExecute('explorer', TOOLS_PATH, '', 'normal') end }			--打开ha4k目录	addCommand{ command = 'hack', func = function() shellExecute('explorer', 'F:\\H4ck', '', 'normal') end }		--打开cmd	addCommand{ command = 'cmd', key = 'A-T', func = function(arg)		local window = getForegroundWindow()		local dir = getWindowText(window)		shellExecute('cmd', '', dir)	end }		-- 增加命令 say	-- 在 merry 的命令窗口输入的 say 命令的参数将以字符串的形式传递给 arg	addCommand{ command = 'say', func = function(arg)		message(arg)	end }			--调整音量(依赖nircmdc)	addCommand{ key = 'A-Up', func = function() shellExecute('nircmdc', 'changesysvolume 65535', '', 'hide') end }	addCommand{ key = 'A-Down', func = function() shellExecute('nircmdc', 'changesysvolume -65535', '', 'hide') end }	addCommand{ key = 'A-Left', func = function() shellExecute('nircmdc', 'changesysvolume -4000', '', 'hide') end }	addCommand{ key = 'A-Right', func = function() shellExecute('nircmdc', 'changesysvolume 4000', '', 'hide') end }			--应用软件	addCommand{ command = 'qq', func = function() shellExecute('QQScLauncher.exe', '', 'D:\\Program Files (x86)\\Tencent\\QQLite\\Bin', 'normal') end }	addCommand{ command = 'music', func = function() shellExecute('cloudmusic.exe', '', 'D:\\Program Files (x86)\\Netease\\CloudMusic', 'normal') end }	addCommand{ command = 'itools', func = function() shellExecute('iTools.exe', '', 'D:\\Program Files (x86)\\iTools', 'normal') end }	addCommand{ command = 'chrome', func = function() shellExecute('chrome.exe', '', 'C:\\Program Files (x86)\\Google\\Chrome\\Application', 'normal') end }	addCommand{ command = 'Everything', func = function(arg) 		if arg == "" then			shellExecute('Everything.exe', '', 'C:\\Program Files\\Everything', 'normal') 		else			shellExecute('Everything.exe', '-search ' .. arg, 'C:\\Program Files\\Everything', 'normal') 		end	end }	addCommand{ command = 'notepad++', func = function() shellExecute('notepad++.exe', '-multiInst', 'F:\\notepaid++', 'normal') end }	addCommand{ command = 'PotPlayer', func = function(arg)		if arg == "" then			shellExecute('PotPlayerMini64.exe', '', 'F:\\PotPlayer', 'normal')		else			shellExecute('PotPlayerMini64.exe', arg, 'F:\\PotPlayer', 'normal') 		end	end }			--系统软件	addCommand{ command = 'ie', func = function() shellExecute('iexplore.exe', '', 'C:\\Program Files\\Internet Explorer', 'normal') end }	addCommand{ command = 'calc', func = function() shellExecute('calc.exe', '', '%windir%\\system32', 'normal') end }	addCommand{ command = 'paint', func = function() shellExecute('mspaint.exe', '', '%windir%\\system32', 'normal') end }			--工具包	addCommand{ command = 'snapshot', key = 'A-C-S', func = function() shellExecute('SnapShot.exe', '', TOOLS_PATH .. '\\Merry\\plugins', 'normal') end }	addCommand{ command = 'stikynot', func = function() shellExecute('StikyNot.exe', '', TOOLS_PATH .. '\\Merry\\plugins', 'normal') end }	addCommand{ command = 'ipmsg', func = function() shellExecute('ipmsg.exe', '', TOOLS_PATH .. '\\Merry\\plugins', 'normal') end }	addCommand{ command = 'gif', func = function() shellExecute('GifCam.exe', '', TOOLS_PATH .. '\\Merry\\plugins', 'normal') end }	addCommand{ command = 'apimonitor', func = function() shellExecute('apimonitor-x64.exe', '', TOOLS_PATH .. '\\ApiMonitor\\API Monitor', 'normal') end }	addCommand{ command = 'baiduyun', func = function() shellExecute('BaiduYunGuanjia.exe', '', TOOLS_PATH .. '\\BaiduYun\\yun', 'normal') end }	addCommand{ command = 'compare', func = function() shellExecute('BCompare.exe', '', TOOLS_PATH .. '\\Beyond Compare 4', 'normal') end }	addCommand{ command = 'c32', func = function() shellExecute('C32Asm.exe', '', TOOLS_PATH .. '\\C32Asm', 'normal') end }	addCommand{ command = 'ccleaner', func = function() shellExecute('CCleaner64.exe', '', TOOLS_PATH .. '\\CCleaner', 'normal') end }	addCommand{ command = 'cmder', func = function() shellExecute('Cmder.exe', '', TOOLS_PATH .. '\\cmder', 'normal') end }	addCommand{ command = 'ditto', func = function() shellExecute('Ditto.exe', '', TOOLS_PATH .. '\\Ditto', 'normal') end }	addCommand{ command = 'fiddler', func = function() shellExecute('Fiddler.exe', '', TOOLS_PATH .. '\\Fiddler', 'normal') end }	addCommand{ command = 'fscapture', func = function() shellExecute('FSCapture.exe', '', TOOLS_PATH .. '\\FSCapture', 'normal') end }	addCommand{ command = 'hosts', func = function() shellExecute('explorer.exe', TOOLS_PATH .. '\\HostsTool', '', 'normal') end }	addCommand{ command = 'pass', func = function() shellExecute('KeePass.exe', '', TOOLS_PATH .. '\\KeePass', 'normal') end }	addCommand{ command = 'listary', func = function() shellExecute('Listary.exe', '', TOOLS_PATH .. '\\Listary', 'normal') end }	addCommand{ command = 'logview', func = function() shellExecute('LogView.exe', '', TOOLS_PATH .. '\\LogViewerPro', 'normal') end }	addCommand{ command = 'mdict', func = function() shellExecute('MDict.exe', '', TOOLS_PATH .. '\\MDict', 'normal') end }	addCommand{ command = 'mstsc', func = function() shellExecute('mstsc.exe', '', TOOLS_PATH .. '\\mstsc\\mstsccopy', 'normal') end }	addCommand{ command = 'pdf', func = function() shellExecute('SumatraPDF.exe', '', TOOLS_PATH .. '\\mstsc\\pdf', 'normal') end }	addCommand{ command = 'picpick', func = function() shellExecute('picpick.exe', '', TOOLS_PATH .. '\\PicPick', 'normal') end }	addCommand{ command = 'xxnet', func = function() shellExecute('start.bat', '', TOOLS_PATH .. '\\XX-Net', 'normal') end }	addCommand{ command = 'sublime_text', func = function() shellExecute('sublime_text.exe', '', TOOLS_PATH .. '\\SublimeText', 'normal') end }	addCommand{ command = 'proxifier', func = function() shellExecute('Proxifier.exe', '', TOOLS_PATH .. '\\Proxifier', 'normal') end }	addCommand{ command = 'kmplayer', func = function() shellExecute('KMPlayer.exe', '', TOOLS_PATH, 'normal') end }	addCommand{ command = 'virtuawin', func = function() shellExecute('VirtuaWin.exe', '', TOOLS_PATH .. '\\VirtuaWin', 'normal') end }	addCommand{ command = 'hash', func = function() shellExecute('Hash.exe', '', TOOLS_PATH .. '\\others\\hash', 'normal') end }	addCommand{ command = 'filetypesman', func = function() shellExecute('FileTypesMan.exe', '', TOOLS_PATH .. '\\others\\filetypesman-x64', 'normal') end }	addCommand{ command = 'pchunter', func = function() shellExecute('PCHunter64.exe', '', TOOLS_PATH .. '\\others\\PCHunter', 'normal') end }	addCommand{ command = 'winscp', func = function() shellExecute('WinSCP.exe', '', TOOLS_PATH .. '\\others\\WinScp', 'normal') end }	addCommand{ command = 'putty', func = function() shellExecute('putty.exe', '', TOOLS_PATH .. '\\others\\WinScp', 'normal') end }		elseif MAC then	addCommand{ command = 'terminal', key = 'A-T', func = function() shellExecute('/Applications/Utilities/terminal.app') end }end--google搜索addCommand{ command = 'google', func = function(arg) shellExecute('http://www.google.com.hk/search?q=' .. arg) end }--百度搜索addCommand{ command = 'baidu', func = function(arg) shellExecute('http://www.baidu.com/s?wd=' .. arg) end }-- Eventslocal histroy = io.open(MERRY_ROOT_PATH .. 'histroy.lua', 'a')addEventHandler('onUndefinedCommand', function(commandName, commandArg)	local commandNameArray = { commandName }	if MAC then		table.insert(commandNameArray, "/Applications/" .. commandName .. ".app")		table.insert(commandNameArray, "/Applications/Utilities/" .. commandName .. ".app")	end	for _, commandNameFull in ipairs(commandNameArray) do		if shellExecute(commandNameFull, commandArg) then			addCommand{ command = commandName, func = function() shellExecute(commandNameFull) end }			local strCommandName = string.gsub(commandName, '\\', '\\\\')			local strCommandNameFull = string.gsub(commandNameFull, '\\', '\\\\')			histroy:write(string.format("addCommand{ command = '%s', func = function() shellExecute('%s') end }\n",				strCommandName, strCommandNameFull))			histroy:flush()			break		end	endend)addEventHandler('onClose', function()	histroy:close()	showWindow(curHideWindow, 'normal')end)--[[shellExecuteshellExecute(commandName, commandArg, workingDir, show)用于执行一个 shell 命令commandName 为 shell 命令名commandArg 为 shell 命令需要的参数workingDir 为 shell 命令的工作路径show 表示显示的方式,包括 'normal'、'max'、'min'、'hide'(常规显示、最大化、最小化、隐藏)函数返回 true / false 表示是否执行是否成功范例,打开 cmd 窗口并且最大化shellExecute('cmd', '', '', 'max')]]

你可能感兴趣的文章