Get path of an active file

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rokkyboy
Posts: 16
Joined: 01 Sep 2017, 07:04

Get path of an active file

24 Jan 2018, 01:43

Hey guys,

Is there an easy way to get path of an active file, be it excel, word, or others?

or

is it difficult to achieve this as accessing path information varies from an application to application?

The workflow I'm trying to automate is follows:

1. I'm working on a file (Excel, Powerpoint, Word, PDF, etc)
2. I need to send this file to someone

Current workflow:

1. Save the file and close the application
2. use Everything to search for the file name
3. Drag and drop

Ideally, i was hoping to achieve

1. copy active file's path to clipboard & open an explorer at target path

from there I can either use Onedrive, Dropbox, outlook, etc to send the file.

Thanks in advance,

Rok
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Get path of an active file

24 Jan 2018, 07:00

Setting explorer to show the full path of a selected file (should work for other apps window as well), that way you can grep that path from there. Good luck :)
Guest

Re: Get path of an active file

24 Jan 2018, 08:00

I don't think there is a "catch all" way of seeing all opened files, for Office application you can use COM, for other programs you may need to find specific methods (some programs show the entire file path in the program window, some just the file name) - here is one for Word:

Code: Select all

;Press F1 while MicroSoft Word is open.  
SetTitleMatchMode, 2
#IfWinExist, ahk_class OpusApp 
F1::
ActiveDocumentFile := ComObjActive("Word.Application").ActiveDocument.FullName
MsgBox % ActiveDocumentFile 
Return
Other methods:
https://autohotkey.com/board/topic/9536 ... /?p=600943

Third party app (use command line mode, filter the resulting text file):
https://www.nirsoft.net/utils/opened_files_view.html

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, doodles333 and 386 guests