Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • December 03, 2016, 03:35:48 AM
  • Proudly celebrating 10 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 3094 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,136
    • View Profile
    • Donate to Member
DONE: ESC closes Windows Explorer (AHK)
« on: October 08, 2006, 07:00:49 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:48 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:47 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:37 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:40 AM by kimmchii »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,136
    • View Profile
    • Donate to Member
Re: IDEA: ESC closes Windows Explorer (AHK)
« Reply #3 on: October 08, 2006, 07:14:59 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:30 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