Jump to content

Earthquake Notepad


HackerZer0
 Share

Recommended Posts

not very usful, but amusing for a minute or 2...

F8 to turn on, and F9 to turn off, close notepad to exit completely

Run("notepad.exe")
HotKeySet("{F9}", "_Idle")
HotKeySet("{F8}", "_Earthquake")

$magnitude = 1

$window = "Untitled - Notepad"

WinWaitActive($window)
$startpos = WinGetPos($window)
_Idle()

Func _Idle()
WinMove($window, "", $startpos[0], $startpos[1])
While 1
Sleep(5000)
$state = WinGetState("Untitled - Notepad", "")
If $state = 0 Then _Exit()
Wend
EndFunc

Func _Earthquake()
While 1
$pos = WinGetPos($window)
$pos[0] = $pos[0] + Random($magnitude*-1, $magnitude, 1)
$pos[1] = $pos[1] + Random($magnitude*-1, $magnitude, 1)
WinMove($window, "", $pos[0], $pos[1])
Wend
EndFunc

Func _Exit()
Exit
EndFunc
Edited by HackerZer0
Link to comment
Share on other sites

not very usful, but amusing for a minute or 2...

F8 to turn on, and F9 to turn off, close notepad to exit completely

That is fairly entertaining, good job! I would add this though: Actually, I would do it like this:

#NoTrayIcon

Opt("WinTitleMatchMode", 2)

Run("notepad.exe")
HotKeySet("{F9}", "_Idle")
HotKeySet("{F8}", "_Earthquake")

$magnitude = 1

$window = "Notepad"

WinWaitActive($window)
$startpos = WinGetPos($window)
_Idle()

Func _Idle()
    WinMove($window, "", $startpos[0], $startpos[1])
    While 1
        Sleep(5000)
        $state = WinGetState("Notepad", "")
        If $state = 0 Then _Exit()
    Wend
EndFunc

Func _Earthquake()
    While 1
        $pos = WinGetPos($window)
        $pos[0] = $pos[0] + Random($magnitude*-1, $magnitude, 1)
        $pos[1] = $pos[1] + Random($magnitude*-1, $magnitude, 1)
        $startpos = WinGetPos($window)
        WinMove($window, "", $pos[0], $pos[1])
    Wend
EndFunc

Func _Exit()
    Exit
EndFunc

edit: No icon, matches any notepad window (or the first) and leaves it in the last "earthquake" position.

Edited by fisofo
Link to comment
Share on other sites

edit: No icon, matches any notepad window (or the first) and leaves it in the last "earthquake" position.

but if you let it go to far and the blue bar goes above the desktop height its really annoying to get back, cause then all notepads will open in that position

Edited by HackerZer0
Link to comment
Share on other sites

but if you let it go to far and the blue bar goes above the desktop height its really annoying to get back, cause then all notepads will open in that position

I believe you can get desktop width somehow, although can't remember offhand... anyway, get that and you can tell the script to just bounce against the side of the screens.
Link to comment
Share on other sites

Something i made a while back

; ----------------------------------------------------------------------------
; Shake Window
; Author:        Death Pax <death_pax@msn.com>
;
; Script Function:
;   Shake Window
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>
$Gui_Main = GUICreate("Shake Window", 400, 400)
$Button_Shake = GUICtrlCreateButton("Shake Window", 24, 352, 121, 33, 0)
$Button_Close = GUICtrlCreateButton("Close Window", 256, 352, 121, 33, 0)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_Close
        ExitLoop
    Case $msg = $Button_Shake
        _ShakeWindow($Gui_Main, 5)
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit

Func _ShakeWindow($Window,$ShakeAmount)
    $Win_pos=WinGetPos($Window)
    For $i=0 to 20 step 1
    WinMove($Window,"", $Win_pos[0],$Win_pos[1]+$ShakeAmount)
    Sleep(10)
    WinMove($Window,"", $Win_pos[0]+$ShakeAmount,$Win_pos[1])
    Sleep(10)
    WinMove($Window,"", $Win_pos[0],$Win_pos[1]-$ShakeAmount)
    Sleep(10)
    WinMove($Window,"", $Win_pos[0]-$ShakeAmount,$Win_pos[1])
    Sleep(10)
    WinMove($Window,"", $Win_pos[0],$Win_pos[1])
    Sleep(10)
    next
EndFunc
Link to comment
Share on other sites

for my dutch friends , uh , fuck im a nerd i dont have friends ^^

the dutch version :-)

Opt("WinTitleMatchMode", 2)

Run("notepad.exe")
HotKeySet("{F9}", "_Idle")
HotKeySet("{F8}", "_Earthquake")

$magnitude = 1

$window = "Kladblok"

WinWaitActive($window)
$startpos = WinGetPos($window)
_Idle()

Func _Idle()
    WinMove($window, "", $startpos[0], $startpos[1])
    While 1
        Sleep(5000)
        $state = WinGetState("Kladblok", "")
        If $state = 0 Then _Exit()
    Wend
EndFunc

Func _Earthquake()
    While 1
        $pos = WinGetPos($window)
        $pos[0] = $pos[0] + Random($magnitude*-1, $magnitude, 1)
        $pos[1] = $pos[1] + Random($magnitude*-1, $magnitude, 1)
        $startpos = WinGetPos($window)
        WinMove($window, "", $pos[0], $pos[1])
    Wend
EndFunc

Func _Exit()
    Exit
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...