热键调用三方程序 --- 实用方法

1. 问题或需求描述:
热键调用三方程序

2.解决方法:
使用 AutoIt3 脚本语言,可以快速编写出热键主调程序。

3.例如:
利用热键调用三方程序,实现特定需要。例程中,我们实现按 “F4”键时调起三方程序,实现清除电脑上的所有蓝牙连接等功能。

au3代码:

If WinExists("firswof-clearbt") Then Exit
GUICreate("firswof-clearbt")
HotKeySet ( "{ESC}" , "_Exit")
HotKeySet ( "{F2}" , "_ShutAllConsole")
HotKeySet ( "{F3}" , "_RestartBT")
HotKeySet ( "{F4}" , "_ClearBT")
ToolTip("[ESC:退出;F4:清除蓝牙]", 0, 0)

While (1)
   Sleep(60000)
WEnd

Func _Exit()
   Exit
EndFunc

Func _ClearBT()
   ShellExecute ( "E:\BT_Pair.exe" , " -u" , "")
EndFunc

Func _RestartBT()
    ShellExecute ( "E:\BT_Pair.exe" , " -r" , "")
EndFunc

Func _ShutAllConsole()
    ShellExecute ( "E:\BT_Pair.exe" , " -a" , "")
EndFunc

猜你喜欢

转载自blog.51cto.com/firswof/2123561
今日推荐