Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active November 26, 2021 19:52
Show Gist options
  • Save davebrny/fd31caabaa02a3e7e60095011e97b783 to your computer and use it in GitHub Desktop.
Save davebrny/fd31caabaa02a3e7e60095011e97b783 to your computer and use it in GitHub Desktop.
(autohotkey) - open properties for the selected file (and use "run" if the hotkey didnt send)
#ifWinActive ahk_class CabinetWClass
^+p::goSub, file_properties
#ifWinActive
file_properties:
revert_clipboard := clipboardAll
clipboard =
send ^{c}
clipWait, 0.6
selected_file := clipboard
clipboard := revert_clipboard
if (selected_file = "")
trayTip, file properties, clipWait timed out. try again, 8
else
{
send !{enter} ; default properties hotkey
splitPath, selected_file, filename
winWaitActive, % filename " Properties ahk_class #32770", , 0.5
if (errorLevel = 1) ; if !{enter} didnt open any properties
and !inStr(selected_file, "`n") ; and only a single file was selected
run, properties "%selected_file%"
}
return
/*
[script info]
version = 1.1
description = open properties for the selected file (and use "run" if the hotkey didnt send)
author = davebrny
source = https://gist.github.com/davebrny/fd31caabaa02a3e7e60095011e97b783
*/
@MrrrrTony
Copy link

Hey @davebrny, thanks for the quick answer.
Given the fact that last time only a restart "fixed" it, I haven't dared to try again yet :)
But I will and post the feedback in here in case someone needs it in the future.

@MrrrrTony
Copy link

Hello again @davebrny. I've done several tests and the problem didn't appear again. That was weird the first time, didn't understand why would something like that even happen - some sort of loop, yes, but how? :)

While testing I noticed just one thing: the script doesn't seem to work for desktop files or folders. Tested in several places and on several file extensions, including repeatedly on file_properties.ahk, nothing "bad" happened anymore, but on desktop it just won't work. :)

Anyway, thanks very much for this script and the rest of them, some are sooo, sooo helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment