슬라이드쇼 도중 단축키로 원하는 프로그램을 실행하거나 원하는 파일을 여는 방법입니다.

아래는 AutoHotKey로 <F3>키를 누르면 바탕화면의 msgbox.pyw 를 실행하는 예시입니다.

Run_F3.ahk
0.00MB
Run_F3.exe
0.34MB

 

첨부파일 Run_F3.exe 를 Run_F4.exe로 바꾸면 단축키는 F4가 됩니다.

특수키 등의 단축키 형식은 링크를 참고하세요.

Run_F3.exe를 실행하면 아래처럼 F3단축키가 눌렸을 때 실행할 대상을 지정하고

Get Ready버튼을 누르면 단축키를 기다리게 됩니다.

Get Ready를 누르면 오토핫키프로그램은 시스템 트레이로 가게 됩니다.

이제 슬라이드 쇼 도중 F3을 누르면 위에서 지정한 바탕화면의 msgbox.pyw 가 실행됩니다.

.py대신 .pyw 확장자는 콘솔창 없이 파이썬코드를 실행합니다.

샘플 msgbox.pyw 파일 내용

위 파일이 하는 일은 프리젠테이션을 하나 추가하고 1슬라이드에 주황색 네모를 추가하고 Hello World메시지를 출력합니다. 단, win32com이 설치되어 있어야 합니다.

실행화면

 

더보기
;#notrayicon
sName := % SubStr( A_ScriptName, 1, -4)
StringSplit, tmp, sName,_
if (tmp2 ="") {
MsgBox,Hotkey is not specified. ex)Rename this file to Run_F3.exe
ExitApp
}
Gui, Add, Text, Left x5 y10 w40 h20 , Target:
Gui, Add, Edit, vtarget g2 left x50 y10 w300 h20, %A_Desktop%\msgbox.pyw
Gui, Add, Text, Left x5 y55 w300 h20, Press %tmp2% to run the target above
Gui, Add, Button, g3 vBtn x250 y35 w100 h40 , Get Ready
Gui, Show, x1 y1 h90 w360, Run
Return
2:
return
3:
guicontrol,text,Btn,Ready
guicontrol,Disable,Btn
Gui,submit,Hide
;Gui,destroy
#SingleInstance off
#persistent
;msgbox %target%
IfNotExist, %target%
{
MsgBox, The target file doesn't exists: %target%
ExitApp
}
Menu, Tray, Tip , Run
Menu, Tray, Icon, shell32.dll,266
Menu, Tray, NoStandard
Menu, Tray, add, Show, Show
Menu, Tray, add, Quit, GuiClose
Hotkey, % tmp2, myLabel
return
#a::
myLabel:
;msgbox, %target%
run, %target%
;run, c:\users\user\Desktop\Sample.pptx
;run, ""C:\Program Files\Microsoft Office\root\Office16\POWERPNT.EXE"" /S ""C:\Users\User\Desktop\Slide2.pptm""
return
Begin:
IfWinExist, Run
WinActivate, Run
IfWinNotExist, Run
Goto, Show
Return
Show:
Gui, Show, , Run
Menu, Tray, ToggleEnable, Show
Return
#x::
ExitApp
GuiClose:
ExitApp

Target 에 프로그램 뿐만 아니라 특정 문서나 파일을 지정할 수 있습니다.