I'm able to get active window's file path of Sublime Text using the method below:
Code: Select all
RunWait, "subl --command ""copy_path""",,Hide
filepath = Clipboard
Code: Select all
RunWait, "subl --command ""copy_path""",,Hide
filepath = Clipboard
Code: Select all
WinGetTitle, filepath, ahk_exe Code.exe
RegExMatch(filepath, Chr(9679) . "? ?\K.*(?= - Visual Studio Code)", filepath)
This doesn't work for new versions of VS Code (I have 1.50.1) because VS Code shows only the file name on title.boiler wrote: ↑27 Oct 2020, 04:30You can get the file path from the title of the VS Code window. The RegExMatch below removes the ● and space preceding the filename if it appears (indicating unsaved changes) and the - Visual Studio Code from the end.Code: Select all
WinGetTitle, filepath, ahk_exe Code.exe RegExMatch(filepath, Chr(9679) . "? ?\K.*(?= - Visual Studio Code)", filepath)