AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get full path of an active window

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Hansol



Joined: 27 Dec 2005
Posts: 18

PostPosted: Tue Jul 29, 2008 9:29 pm    Post subject: Get full path of an active window Reply with quote

Hi, is it possible to get the full path of an open notepad document? I would need to know where its located.
Back to top
View user's profile Send private message MSN Messenger
scottmattes



Joined: 21 May 2007
Posts: 98
Location: USA

PostPosted: Wed Jul 30, 2008 2:55 pm    Post subject: Re: Get full path of an active window Reply with quote

Hansol wrote:
Hi, is it possible to get the full path of an open notepad document? I would need to know where its located.


I had this problem with another program that doesn't display the full filename in the window title.

What I did was to send Alt-F, A, Ctl-C, Shift-Tab, Space, Ctl-C and ESC

Alt-F to open the Notepad File menu
A to select Save As
Ctl-C to save the filename
Shift-Tab to position on first file of displayed files
Space to select that file
Ctl-C to copy it to the clipboard (save and restore the clipboard folks)
ESC to close the Save As dialog

then assign the clipboard to a variable and you have the filename with complete path.

here is the working code that I am using
Code:

         send, !fa ; alt / file / save as
         winwait, Save
         send, {ctrldown}c{ctrlup}  ; copy filename
         clipwait 2,1
         xFilename = %clipboard% ; save the filename
         OutputDebug, l(%A_LineNumber%): xFilename="%xFilename%" - file(%A_LineFile%)
clipboard =
         send, {shiftdown}{tab}{shiftup} ; move focus to file list
         send, {space} ; hilight first file
         send, {ctrldown}c{ctrlup} ; copy to clipboard, this has the directory path on it
         clipwait 2,1
         first_file = %clipboard%
         OutputDebug, l(%A_LineNumber%): first_file='%first_file%' - file(%A_LineFile%)

         send, {esc} ; close the save as dialog
         SplitPath, first_file, sFilename, sDir, sExt

         OutputDebug, l(%A_LineNumber%): sFilename="%sFilename%" - file(%A_LineFile%)
         OutputDebug, l(%A_LineNumber%): sDir="%sDir%" - file(%A_LineFile%)
         OutputDebug, l(%A_LineNumber%): sExt="%sExt%" - file(%A_LineFile%)
         sFilename = %xFilename%.rdf
         OutputDebug, l(%A_LineNumber%): sFilename="%sFilename%" - file(%A_LineFile%)

_________________
-------------
Scott Mattes

My small, but growing, collection of scripts.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group