scottmattes
Joined: 21 May 2007 Posts: 98 Location: USA
|
Posted: Wed Jul 30, 2008 2:55 pm Post subject: Re: Get full path of an active window |
|
|
| 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. |
|