AutoHotkey Community

It is currently May 25th, 2012, 10:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: June 30th, 2007, 6:38 pm 
Offline

Joined: May 24th, 2007, 3:45 am
Posts: 1121
This is a silly little script that will literally blow a hole in any window other than Windows Explorer or My Computer when you double-click. An explosion without a suitable sound effect would be no fun, so you can download one here. Just put it in the same folder as the script. You can also Download the script if you prefer it top copy and paste.

Commands:
Double-Click - Explode!
Ctrl+Alt+Shift+Z - "Repair" the active window.
Ctrl+Alt+Shift+F12 - End program.

Code:
#SingleInstance Force
#NoEnv
;#NoTrayIcon ;uncomment if you want to be sneaky...

LastClick = 0
CoordMode, Mouse, Screen

;Get this at http://www.autohotkey.net/~ManaUser/KBoom.wav
FileInstall KBoom.wav, %A_Temp%\KBoom.wav
sStr = OPEN %A_Temp%\KBoom.wav TYPE waveaudio ALIAS KBoom
DllCall("winmm.dll\mciExecute", "Str", sStr)

OnExit DoExit

GroupAdd System, ahk_class ExploreWClass ;Windows Explore
GroupAdd System, ahk_class CabinetWClass ;My Computer type window
GroupAdd System, ahk_class Shell_TrayWnd ;Task bar
GroupAdd System, ahk_class Progman       ;Desktop

~LButton::
If WinActive("ahk_group System")
   Return
ClickSpeed := A_TickCount - LastClick
If (ClickSpeed > 200) ;rough approximation of a double-click.
{
   LastClick := A_TickCount
   Return
}
MouseGetPos X, Y, Win
WinGetPos WX, WY, , , ahk_id %Win%
X -= WX ;adjsut for screen co-ord mode.
Y -= WY
Pattern = 0:-5|4:-12|4:-6|8:-7|7:-3|11:-2|7:-1|13:1|7:0|12:4|8:3|10:6|13:7|10:7|10:9|9:6|5:4|7:10|3:5|3:11|0:7|-2:14|-3:6|-6:9|-5:4|-11:5|-6:2|-11:-2|-6:-3|-10:-10|-3:-5|-2:-7|-3:-13|-1:-9|0:-11
;These are off-sets from the cursor for each point in the shape. It was a pain to encode...
CCrack := Crack%Win% ;get current shape (if any) from active window.
CCrack .= " " . X . "-0" ;a point on at the top of the window, centered over the cutout.
Loop Parse, Pattern, |
{
   StringSplit XY, A_LoopField, :
   ;Parse the offset string and add the mouse position.
   CCrack .= " " . X + XY1 * 10 . "-" . Y + XY2 * 10
}
CCrack .= " " . X . "-0" ;another point on at the top of the window, centered over the cutout.
Crack%Win% := CCrack ;save shape in a unique variable for active window.
sStr = PLAY KBoom FROM 0
DllCall("winmm.dll\mciExecute", "Str", sStr) ;Kaboom!
sleep 100
WinSet Region, 0-0 %CCrack% 3000-0 3000-2000 0-2000, ahk_id %Win%
; So it "draws" a region like this... (2-4 repeat for each shape)
;
; 1----(2,4)----+ - - - - 5
; |      |      |         :
; |      |      |         :
; |      3      |         :
; |    SHAPE    |         :
; |             |         :
; +-------------+         :
; :                       :
; :                       :
; 7 - - - - - - - - - - - 6
;
; It's bigger than the window to allow for resizing.
Return

^+!z::
Win := WinExist("A")
WinSet Region, , ahk_id %Win%
Crack%Win% =
Return

^+!F12::
FileDelete %A_Temp%\KBoom.wav
ExitApp
Return

DoExit:
FileDelete %A_Temp%\KBoom.wav
ExitApp
Return


Aside from being amusing (I hope) it demonstrates a way to cut one or more shapes out of a window using WinSet Region.


Last edited by ManaUser on July 9th, 2007, 2:31 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2007, 9:13 am 
For some reason it wont work for me. Nothing happens at all when I double click in a window, the script is still running too.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2007, 9:14 am 
scratch that. Damn thing made me jump. I had my speakers turned up.


Report this post
Top
  
Reply with quote  
 Post subject: cool
PostPosted: July 1st, 2007, 11:33 pm 
man, this script it really cool.

I really enjoy it.

Thanks for sharing.

:)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 6th, 2008, 4:41 pm 
Offline

Joined: August 6th, 2008, 12:19 pm
Posts: 13
it didnt work forme i downloaded everything


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 6th, 2008, 10:09 pm 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3328
Location: Simi Valley, CA
highly amusing, nice one :wink:

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 6th, 2008, 10:18 pm 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
That, is very cool.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2008, 9:13 am 
Offline

Joined: December 19th, 2006, 2:14 pm
Posts: 72
Location: France
excellent POC, thx for sharing :)

_________________
Assembler-coded MCode.ahk ASCII85.ahk library


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2008, 10:26 am 
ok mates for those of you had made it work what did u exactly do please help :P


Report this post
Top
  
Reply with quote  
 Post subject: Vista effect
PostPosted: August 7th, 2008, 6:41 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
On Vista Home Premium,
the holes are blown, but not immediately visible, till the window is minimized and again restored..

otherwise, the effect works well.. very nice!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2008, 5:32 pm 
yeah mate i wish i could see it run but on xp sp2 the program runs but does nothing i, hate my life


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2008, 3:19 am 
Anonymous wrote:
...i, hate my life

...oookkk, then, well did you try double clicking? Let me revise that, run the program (by double clicking on it)...THEN open notepad (for example)...then double click in the empty notepad...you should get a (non-circular) hole...plus testing on notepad you don't have to deal with a hole in a window you need...(yes I know there's a "repair" key)...I can confirm in XP SP1 it works...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 20th, 2011, 7:07 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Just had the chance to test this out, Very nice. :)

mci error dialog gets triggered in AHK Unicode version.
The couple of mciExecute() need to be altered as follows:

Code:
DllCall( "winmm.dll\mciExecute", A_IsUnicode ? "AStr" : "Str", sStr )


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 20th, 2011, 7:19 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4171
Location: Awesometown, USA
There is a dllcall for "GetDoubleClickSpeed" or something like that. You should use it instead of 200

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 20th, 2011, 7:26 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
@nimda: user32\GetDoubleClickTime


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group