October 28, 2018

AutoHotkey Script to Open file in Explorer with specific application

Solution is available https://autohotkey.com/board/topic/77665-open-files-with-portable-notepad/


; AutoExecute Section must be on the top of the script
#NoEnv
SetWorkingDir %A_ScriptDir%
GroupAdd, Explore, ahk_class CabinetWClass         ; Add a class to the group
GroupAdd, Explore, ahk_class ExploreWClass         ; Add a other class to the group


; Open file With Notepad++ from Explorer using Alt+N hotkey
; https://autohotkey.com/board/topic/77665-open-files-with-portable-notepad/

#ifWinActive,ahk_group Explore              ; Set hotkeys to work in explorer only
; Alt+N
!n::
   ClipSaved := ClipboardAll
   Clipboard := ""
   Send ^c
   ClipWait, 0.5
   file := Clipboard
   Clipboard := ClipSaved
   Run D:\DSUsers\uid41890\PortableApps\Notepad++Portable\Notepad++Portable.exe "%file%"
return



Code is available in Gist


Add this script to your Startup folder.

No comments:

Post a Comment