topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 7:37 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: ESC closes Windows Explorer (AHK)  (Read 5751 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
    • View Profile
    • Donate to Member
DONE: ESC closes Windows Explorer (AHK)
« on: October 08, 2006, 07:00 AM »
Hi!

I came up with this little script to easily close Windows Explorer windows:

#Persistent
$ESC::
  Send, {ESC}
If WinActive("ahk_class ExploreWClass")
  Send !{F4}
return

It works great, it just has one problem: you can't use ESC anymore to abort renaming of files, like when you accidentally deleted important parts of the file name and can't just press enter to "OK" the change.

So I need some way to 'only send Alt+F4 (!{F4}) if ESC is pressed twice within one second'. Got any ideas for a smart solution? I bet you do!

 :Thmbsup:
« Last Edit: October 08, 2006, 11:27 AM by brotherS »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: ESC closes Windows Explorer (AHK)
« Reply #1 on: October 08, 2006, 07:06 AM »
Something in this terms might solve it:

ESCflag := false

$ESC:
  Send,{ESC}
  IF WinActive("ahk_class ExploreWClass")
    IF ESCflag
      send,!{F4}
    else
    {
      ESCflag := True
      settimer,SomeTimer,1000
    }
  return

SomeTimer:
  settimer,SomeTimer,off
  ESCflag := false
  return
Warning: untested code. But should work ;)

kimmchii

  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 360
    • View Profile
    • Donate to Member
Re: IDEA: ESC closes Windows Explorer (AHK)
« Reply #2 on: October 08, 2006, 07:08 AM »
i use this:
Opt("WinTitleMatchMode", 4)
while WinExists("classname=CabinetWClass", "")
   Winclose("classname=CabinetWClass", "")
wend
edit: unrelated code, sorry lol.
If you find a good solution and become attached to it, the solution may become your next problem.
~Robert Anthony
« Last Edit: October 08, 2006, 07:12 AM by kimmchii »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
    • View Profile
    • Donate to Member
Re: IDEA: ESC closes Windows Explorer (AHK)
« Reply #3 on: October 08, 2006, 07:14 AM »
Thanks jgpaiva, works!  :up:

kimmchii: what does that do: close *all* Windows Explorer windows?

kimmchii

  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 360
    • View Profile
    • Donate to Member
Re: IDEA: ESC closes Windows Explorer (AHK)
« Reply #4 on: October 08, 2006, 07:55 AM »
yes, close *all* Windows Explorer  :D
If you find a good solution and become attached to it, the solution may become your next problem.
~Robert Anthony