How to display a folder's properties window?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
JnLlnd
Posts: 327
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

How to display a folder's properties window?

15 Sep 2014, 18:20

Is there a Windows command-line command (to call with Run), a DllCall or COM object that would allow me to display the properties window of a given folder?

I've found this but the info there looks outdated:
http://www.autohotkey.com/board/topic/3 ... ments-ect/

Thanks,

Jean
:thumbup: Author of Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Quick Access Popup Knowledge base
:ugeek: The Automator's Courses on AutoHotkey
lexikos
Posts: 7189
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: How to display a folder's properties window?

15 Sep 2014, 18:25

Code: Select all

Run properties %A_ScriptDir%
Sleep 10000
Interestingly, it closes when the script terminates, at least on this system.
User avatar
JnLlnd
Posts: 327
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: How to display a folder's properties window?

15 Sep 2014, 20:12

Great. I was to follow up with what I've found here (http://blogs.msdn.com/b/oldnewthing/arc ... 55658.aspx) but the "properties" command is exactly when I need.

I guess I'll have to add a WinWaitClose command to wait for the user to close the Properties window. I'll be back with something working.

Thanks Lexikos.
:thumbup: Author of Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Quick Access Popup Knowledge base
:ugeek: The Automator's Courses on AutoHotkey
User avatar
JnLlnd
Posts: 327
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: How to display a folder's properties window?

15 Sep 2014, 20:21

Oops! I tough this would do the job:

Code: Select all

Run, Properties %A_ScriptDir%, , , PID
Sleep, 1000
WinWaitClose, ahk_pid %PID%
But it seems the Properties command could not set the PID. Doc says:
The variable will be made blank if the PID could not be determined, which usually happens if a system verb, document, or shortcut is launched rather than a direct executable file.
Any idea on how to work around this?
Last edited by JnLlnd on 15 Sep 2014, 21:44, edited 1 time in total.
:thumbup: Author of Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Quick Access Popup Knowledge base
:ugeek: The Automator's Courses on AutoHotkey
User avatar
JnLlnd
Posts: 327
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: How to display a folder's properties window?

15 Sep 2014, 21:44

Re-Oops! I posted the wrong code version in the comment above. RunWait shoud be Run. I'll edit it.
:thumbup: Author of Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Quick Access Popup Knowledge base
:ugeek: The Automator's Courses on AutoHotkey
User avatar
JnLlnd
Posts: 327
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: How to display a folder's properties window?

15 Sep 2014, 22:19

Found two solutions:

From the Rundoc:
Note: The properties window will automatically close when the script terminates. To prevent this, use WinWait to wait for the window to appear, then use WinWaitClose to wait for the user to close it.

Code: Select all

Run, Properties %A_ScriptDir%
SplitPath, A_ScriptDir, MyDir ; Don't use "Properties" to work in other Windows locales. Only use the last folders's name.
WinWait, %MyDir%
WinWaitClose
Or simply prompt the user to continue after he closes the Properties window (not elegant, but could work depending on the context):

Code: Select all

Run, Properties %A_ScriptDir%
MsgBox, Click OK to continue
:thumbup: Author of Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Quick Access Popup Knowledge base
:ugeek: The Automator's Courses on AutoHotkey
User avatar
JnLlnd
Posts: 327
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: How to display a folder's properties window?

15 Sep 2014, 22:33

Hummm... In the first script above, it seems that WinWaitClose does not detect when the Properties window is closed. The script keeps running until I kill the process.
:thumbup: Author of Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Quick Access Popup Knowledge base
:ugeek: The Automator's Courses on AutoHotkey
lexikos
Posts: 7189
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: How to display a folder's properties window?

17 Sep 2014, 03:04

Do you have something else open with %MyDir% in the title; for instance, the script editor?

You can add ahk_class #32770 to reduce the ambiguity.
User avatar
JnLlnd
Posts: 327
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: How to display a folder's properties window?

17 Sep 2014, 18:19

Ah! The issue was with the first WinWait command. The window name was not recognized because of the SetTitleMatchMode mode. Now this works:

Code: Select all

SetTitleMatchMode, 2
Run, Properties %A_AppDataCommon%
SplitPath, A_AppDataCommon, MyDir ; Don't use "Properties" to work in other Windows locales. Only use the last folders's name.
WinWait, %MyDir%
WinWaitClose
Issue closed :-) Thanks lexikos.
:thumbup: Author of Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Quick Access Popup Knowledge base
:ugeek: The Automator's Courses on AutoHotkey

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], roysubs and 59 guests