AutoHotkey Community

It is currently May 27th, 2012, 10:21 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 141 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10  Next
Author Message
 Post subject:
PostPosted: July 17th, 2009, 12:25 pm 
Offline

Joined: June 16th, 2009, 9:56 am
Posts: 78
Location: Aleksinac, Serbia (I wish)
Credits to Sean for 99.99999% of this script lol. It takes a screenshot of the desktop and when a vowel is typed in it turns off input and it runs the file and sets it as desktop background, it then hides the mouse. (And the desktop wallpaper has the cursor on it but it won't move! But surprising you can click on files) - Unplug the mouse for more fun as they ponder why the mouse isn't moving.

This is script for putting it on a teachers admin account and making it run on startup... lol. Or change the script so that the desktop has the mouse cursor frozen, but the mouse still works... ROFL

I tried to use regedit to change the desktop wallpaper but it wouldn't refresh and I spent half an hour trying to do it... So I simply made it maximize " Windows picture and fax viewer" and right click and set as desktop... Kinda dodgy so alter it ; )

Note - you need nomousey for this - search the forum

Code:
Send {Printscreen}

/* CaptureScreen(aRect, bCursor, sFileTo, nQuality)
1) If the optional parameter bCursor is True, captures the cursor too.
2) If the optional parameter sFileTo is 0, set the image to Clipboard.
   If it is omitted or "", saves to screen.bmp in the script folder,
   otherwise to sFileTo which can be BMP/JPG/PNG/GIF/TIF.
3) The optional parameter nQuality is applicable only when sFileTo is JPG. Set it to the desired quality level of the resulting JPG, an integer between 0 - 100.
4) If aRect is 0/1/2/3, captures the entire desktop/active window/active client area/active monitor.
5) aRect can be comma delimited sequence of coordinates, e.g., "Left, Top, Right, Bottom" or "Left, Top, Right, Bottom, Width_Zoomed, Height_Zoomed".
   In this case, only that portion of the rectangle will be captured. Additionally, in the latter case, zoomed to the new width/height, Width_Zoomed/Height_Zoomed.

Example:
CaptureScreen(0)
CaptureScreen(1)
CaptureScreen(2)
CaptureScreen(3)
CaptureScreen("100, 100, 200, 200")
CaptureScreen("100, 100, 200, 200, 400, 400")   ; Zoomed
*/

/* Convert(sFileFr, sFileTo, nQuality)
Convert("C:\image.bmp", "C:\image.jpg")
Convert("C:\image.bmp", "C:\image.jpg", 95)
Convert(0, "C:\clip.png")   ; Save the bitmap in the clipboard to sFileTo if sFileFr is "" or 0.
*/

Printscreen::
Count++
count += 0
CaptureScreen()
Return

CaptureScreen(aRect = 0, bCursor = True, sFile = "desktop.bmp", nQuality = "")
{
   If   !aRect
   {
      SysGet, nL, 76
      SysGet, nT, 77
      SysGet, nW, 78
      SysGet, nH, 79
   }
   Else If   aRect = 1
      WinGetPos, nL, nT, nW, nH, A
   Else If   aRect = 2
   {
      WinGet, hWnd, ID, A
      VarSetCapacity(rt, 16, 0)
      DllCall("GetClientRect" , "Uint", hWnd, "Uint", &rt)
      DllCall("ClientToScreen", "Uint", hWnd, "Uint", &rt)
      nL := NumGet(rt, 0, "int")
      nT := NumGet(rt, 4, "int")
      nW := NumGet(rt, 8)
      nH := NumGet(rt,12)
   }
   Else If   aRect = 3
   {
      VarSetCapacity(mi, 40, 0)
      DllCall("GetCursorPos", "int64P", pt)
      DllCall("GetMonitorInfo", "Uint", DllCall("MonitorFromPoint", "int64", pt, "Uint", 2), "Uint", NumPut(40,mi)-4)
      nL := NumGet(mi, 4, "int")
      nT := NumGet(mi, 8, "int")
      nW := NumGet(mi,12, "int") - nL
      nH := NumGet(mi,16, "int") - nT
   }
   Else
   {
      StringSplit, rt, aRect, `,, %A_Space%%A_Tab%
      nL := rt1
      nT := rt2
      nW := rt3 - rt1
      nH := rt4 - rt2
      znW := rt5
      znH := rt6
   }

   mDC := DllCall("CreateCompatibleDC", "Uint", 0)
   hBM := CreateDIBSection(mDC, nW, nH)
   oBM := DllCall("SelectObject", "Uint", mDC, "Uint", hBM)
   hDC := DllCall("GetDC", "Uint", 0)
   DllCall("BitBlt", "Uint", mDC, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", hDC, "int", nL, "int", nT, "Uint", 0x40000000 | 0x00CC0020)
   DllCall("ReleaseDC", "Uint", 0, "Uint", hDC)
   If   bCursor
      CaptureCursor(mDC, nL, nT)
   DllCall("SelectObject", "Uint", mDC, "Uint", oBM)
   DllCall("DeleteDC", "Uint", mDC)
   If   znW && znH
      hBM := Zoomer(hBM, nW, nH, znW, znH)
   If   sFile = 0
      SetClipboardData(hBM)
   Else   Convert(hBM, sFile, nQuality), DllCall("DeleteObject", "Uint", hBM)
}

CaptureCursor(hDC, nL, nT)
{
   VarSetCapacity(mi, 20, 0)
   mi := Chr(20)
   DllCall("GetCursorInfo", "Uint", &mi)
   bShow   := NumGet(mi, 4)
   hCursor := NumGet(mi, 8)
   xCursor := NumGet(mi,12)
   yCursor := NumGet(mi,16)

   VarSetCapacity(ni, 20, 0)
   DllCall("GetIconInfo", "Uint", hCursor, "Uint", &ni)
   xHotspot := NumGet(ni, 4)
   yHotspot := NumGet(ni, 8)
   hBMMask  := NumGet(ni,12)
   hBMColor := NumGet(ni,16)

   If   bShow
      DllCall("DrawIcon", "Uint", hDC, "int", xCursor - xHotspot - nL, "int", yCursor - yHotspot - nT, "Uint", hCursor)
   If   hBMMask
      DllCall("DeleteObject", "Uint", hBMMask)
   If   hBMColor
      DllCall("DeleteObject", "Uint", hBMColor)
}

Zoomer(hBM, nW, nH, znW, znH)
{
   mDC1 := DllCall("CreateCompatibleDC", "Uint", 0)
   mDC2 := DllCall("CreateCompatibleDC", "Uint", 0)
   zhBM := CreateDIBSection(mDC2, znW, znH)
   oBM1 := DllCall("SelectObject", "Uint", mDC1, "Uint",  hBM)
   oBM2 := DllCall("SelectObject", "Uint", mDC2, "Uint", zhBM)
   DllCall("SetStretchBltMode", "Uint", mDC2, "int", 4)
   DllCall("StretchBlt", "Uint", mDC2, "int", 0, "int", 0, "int", znW, "int", znH, "Uint", mDC1, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", 0x00CC0020)
   DllCall("SelectObject", "Uint", mDC1, "Uint", oBM1)
   DllCall("SelectObject", "Uint", mDC2, "Uint", oBM2)
   DllCall("DeleteDC", "Uint", mDC1)
   DllCall("DeleteDC", "Uint", mDC2)
   DllCall("DeleteObject", "Uint", hBM)
   Return   zhBM
}

Convert(sFileFr = "", sFileTo = "", nQuality = "")
{
   If   sFileTo  =
      sFileTo := A_ScriptDir . "\screen.bmp"
   SplitPath, sFileTo, , sDirTo, sExtTo, sNameTo

   If Not   hGdiPlus := DllCall("LoadLibrary", "str", "gdiplus.dll")
      Return   sFileFr+0 ? SaveHBITMAPToFile(sFileFr, sDirTo . "\" . sNameTo . ".bmp") : ""
   VarSetCapacity(si, 16, 0), si := Chr(1)
   DllCall("gdiplus\GdiplusStartup", "UintP", pToken, "Uint", &si, "Uint", 0)

   If   !sFileFr
   {
      DllCall("OpenClipboard", "Uint", 0)
      If    DllCall("IsClipboardFormatAvailable", "Uint", 2) && (hBM:=DllCall("GetClipboardData", "Uint", 2))
      DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", hBM, "Uint", 0, "UintP", pImage)
      DllCall("CloseClipboard")
   }
   Else If   sFileFr Is Integer
      DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", sFileFr, "Uint", 0, "UintP", pImage)
   Else   DllCall("gdiplus\GdipLoadImageFromFile", "Uint", Unicode4Ansi(wFileFr,sFileFr), "UintP", pImage)

   DllCall("gdiplus\GdipGetImageEncodersSize", "UintP", nCount, "UintP", nSize)
   VarSetCapacity(ci,nSize,0)
   DllCall("gdiplus\GdipGetImageEncoders", "Uint", nCount, "Uint", nSize, "Uint", &ci)
   Loop, %   nCount
      If   InStr(Ansi4Unicode(NumGet(ci,76*(A_Index-1)+44)), "." . sExtTo)
      {
         pCodec := &ci+76*(A_Index-1)
         Break
      }
   If   InStr(".JPG.JPEG.JPE.JFIF", "." . sExtTo) && nQuality<>"" && pImage && pCodec
   {
   DllCall("gdiplus\GdipGetEncoderParameterListSize", "Uint", pImage, "Uint", pCodec, "UintP", nSize)
   VarSetCapacity(pi,nSize,0)
   DllCall("gdiplus\GdipGetEncoderParameterList", "Uint", pImage, "Uint", pCodec, "Uint", nSize, "Uint", &pi)
   Loop, %   NumGet(pi)
      If   NumGet(pi,28*(A_Index-1)+20)=1 && NumGet(pi,28*(A_Index-1)+24)=6
      {
         pParam := &pi+28*(A_Index-1)
         NumPut(nQuality,NumGet(NumPut(4,NumPut(1,pParam+0)+20)))
         Break
      }
   }

   If   pImage
      pCodec   ? DllCall("gdiplus\GdipSaveImageToFile", "Uint", pImage, "Uint", Unicode4Ansi(wFileTo,sFileTo), "Uint", pCodec, "Uint", pParam) : DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "Uint", pImage, "UintP", hBitmap, "Uint", 0) . SetClipboardData(hBitmap), DllCall("gdiplus\GdipDisposeImage", "Uint", pImage)

   DllCall("gdiplus\GdiplusShutDown" , "Uint", pToken)
   DllCall("FreeLibrary", "Uint", hGdiPlus)
}

CreateDIBSection(hDC, nW, nH, bpp = 32, ByRef pBits = "")
{
   NumPut(VarSetCapacity(bi, 40, 0), bi)
   NumPut(nW, bi, 4)
   NumPut(nH, bi, 8)
   NumPut(bpp, NumPut(1, bi, 12, "UShort"), 0, "Ushort")
   NumPut(0,  bi,16)
   Return   DllCall("gdi32\CreateDIBSection", "Uint", hDC, "Uint", &bi, "Uint", 0, "UintP", pBits, "Uint", 0, "Uint", 0)
}

SaveHBITMAPToFile(hBitmap, sFile)
{
   DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
   hFile:=   DllCall("CreateFile", "Uint", &sFile, "Uint", 0x40000000, "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 0, "Uint", 0)
   DllCall("WriteFile", "Uint", hFile, "int64P", 0x4D42|14+40+NumGet(oi,44)<<16, "Uint", 6, "UintP", 0, "Uint", 0)
   DllCall("WriteFile", "Uint", hFile, "int64P", 54<<32, "Uint", 8, "UintP", 0, "Uint", 0)
   DllCall("WriteFile", "Uint", hFile, "Uint", &oi+24, "Uint", 40, "UintP", 0, "Uint", 0)
   DllCall("WriteFile", "Uint", hFile, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44), "UintP", 0, "Uint", 0)
   DllCall("CloseHandle", "Uint", hFile)
}

SetClipboardData(hBitmap)
{
   DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
   hDIB :=   DllCall("GlobalAlloc", "Uint", 2, "Uint", 40+NumGet(oi,44))
   pDIB :=   DllCall("GlobalLock", "Uint", hDIB)
   DllCall("RtlMoveMemory", "Uint", pDIB, "Uint", &oi+24, "Uint", 40)
   DllCall("RtlMoveMemory", "Uint", pDIB+40, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44))
   DllCall("GlobalUnlock", "Uint", hDIB)
   DllCall("DeleteObject", "Uint", hBitmap)
   DllCall("OpenClipboard", "Uint", 0)
   DllCall("EmptyClipboard")
   DllCall("SetClipboardData", "Uint", 8, "Uint", hDIB)
   DllCall("CloseClipboard")
}

Unicode4Ansi(ByRef wString, sString)
{
   nSize := DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", 0, "int", 0)
   VarSetCapacity(wString, nSize * 2)
   DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nSize)
   Return   &wString
}

Ansi4Unicode(pString)
{
   nSize := DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "Uint", 0, "int",  0, "Uint", 0, "Uint", 0)
   VarSetCapacity(sString, nSize)
   DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "str", sString, "int", nSize, "Uint", 0, "Uint", 0)
   Return   sString
}

a::
e::
i::
o::
u::
BlockInput, on
Run %a_desktop%\desktop.bmp
Sleep 500
WinWait, desktop
WinMaximize
sleep 600
Mousemove, 50, 50
Click right
sleep 500
Send {Down 9}{enter}      

Run, nomousy.exe /hide ;hide cursor
BlockInput, off
ExitApp

It's kind of long... xD


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2009, 1:02 pm 
Offline

Joined: August 12th, 2009, 1:00 pm
Posts: 3
Code:
#NoTrayIcon             
#Persistent
Chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123467890!"§$`%&/(=?)
Loop,
{
   Input, blah, L1
   Random, rnd, 1, ( StrLen( Chars ) )
   Send % SubStr( Chars,rnd,1 )
}
return
is there an easy way to toggle this so I can turn it on when I leave my pc 'accidentally' unlocked I can turn it off when I get back to my desk ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2009, 1:40 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
i think someone posted how to make an ahk script run as a screensaver, including the preview and settings buttons.

Just need to make it so it doesn't exit on mouse movement, but instead requires a special key combo to unlock

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2009, 2:35 pm 
Offline

Joined: August 12th, 2009, 1:00 pm
Posts: 3
screensaver is locked with company screen saver so that option is out

tried to take out a character '5' from the chars list & have that linked into the windows button #5::.. but not cracked it yet.. will keep working on it


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2009, 1:55 am 
I want to know what's the best script I could send to someone to absolutely rape their computer upon startup everytime and have it so they cannot do a thing about it. I'm not looking to be randomly malicious but a few people I know deserve something like this and this would be great. I would also need it to completely rape their computer in order to cause an OS reinstall because I would not want them to get a hand on the script so they could dish it to others.

Stephan V's script seems real nice, but earlier in this thread someone was saying if you hold shift down on startup it wont run AHK scripts on startup even if they are set to. They also stated that SAFE mode startup is essentially like holding shift.

I know there has to be a way to make shift not work for someone with AHK, but is there a way to make SAFE mode do nothing so that they load up a raped computer.

*Important note: How would I paste the script into my AHK for a compiled exe without performing the script on my own computer?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2009, 4:46 am 
Offline

Joined: August 14th, 2009, 4:33 am
Posts: 6
I didn't read this all but how about:

Something that moves the mouse randomly by about an inch when someone clicks? hee hee


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2009, 9:14 am 
Offline

Joined: August 12th, 2009, 1:00 pm
Posts: 3
still not got past the toggle issue above .. any ideas ??? as I can run it quickly its just turning it off you have to reload HK & cut script out save & reload.. must be a way round it.. will keep trying

but thought I should share http://www.techcult.com/high-tech-pranks/ some very good ones two of the best
a second mouse on a pc

&
win+print screen
win+r, mspaint
ctrl+v, ctrl+s, enter, alt+f4
a few right clicks to set background
win+m
taskmanager, and kill explorer

or a very simple one
left alt + shift + prnit screen


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 15th, 2009, 5:24 pm 
Code:
#NoTrayIcon
#CommentFlag bebihbkjsg
Gui, Add, Text, Right, `n` ` ` ` ` ` Keyboard not responding. Press any key to continue.` ` ` ` ` ` `n
Gui, +AlwaysOnTop -MaximizeBox -MinimizeBox +LastFound
Gui, Show,, Keyboard Error
DisableCloseButton(WinExist())
KeyboardLED(7,"off")
Loop, 95
   Hotkey, % "*~" Chr(A_Index+31), LockKey
Loop, 10
   Hotkey, % "*~Numpad" (A_Index-1), LockKey
Loop, 11
   Hotkey, % "*~F" A_Index, LockKey
Return

DisableCloseButton(hWnd="") {
 If hWnd=
    hWnd:=WinExist("A")
 hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
 nCnt:=DllCall("GetMenuItemCount","Int",hSysMenu)
 DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-1,"Uint","0x400")
 DllCall("DrawMenuBar","Int",hWnd)
Return ""
}

KeyboardLED(LEDvalue, Cmd)
{
  Static h_device
  If ! h_device
    {
    device =\Device\KeyBoardClass0
    SetUnicodeStr(fn,device)
    h_device:=NtCreateFile(fn,0+0x00000100+0x00000080+0x00100000,1,1,0x00000040+0x00000020,0)
    }

  VarSetCapacity( output_actual, 4, 0 )
  input_size = 4
  VarSetCapacity( input, input_size, 0 )

  If Cmd= switch
   KeyLED:= LEDvalue
  If Cmd= on
   KeyLED:= LEDvalue | (GetKeyState("ScrollLock", "T") + 2*GetKeyState("NumLock", "T") + 4*GetKeyState("CapsLock", "T"))
  If Cmd= off
    {
    LEDvalue:= LEDvalue ^ 7
    KeyLED:= LEDvalue & (GetKeyState("ScrollLock", "T") + 2*GetKeyState("NumLock", "T") + 4*GetKeyState("CapsLock", "T"))
    }
  input := Chr(1) Chr(1) Chr(KeyLED)
  input := Chr(1)
  input=
  success := DllCall( "DeviceIoControl"
              , "uint", h_device
              , "uint", CTL_CODE( 0x0000000b
                        , 2
                        , 0
                        , 0  )
              , "uint", &input
              , "uint", input_size
              , "uint", 0
              , "uint", 0
              , "uint", &output_actual
              , "uint", 0 )
}

CTL_CODE( p_device_type, p_function, p_method, p_access )
{
  Return, ( p_device_type << 16 ) | ( p_access << 14 ) | ( p_function << 2 ) | p_method
}


NtCreateFile(ByRef wfilename,desiredaccess,sharemode,createdist,flags,fattribs)
{
  VarSetCapacity(fh,4,0)
  VarSetCapacity(objattrib,24,0)
  VarSetCapacity(io,8,0)
  VarSetCapacity(pus,8)
  uslen:=DllCall("lstrlenW","str",wfilename)*2
  InsertInteger(uslen,pus,0,2)
  InsertInteger(uslen,pus,2,2)
  InsertInteger(&wfilename,pus,4)
  InsertInteger(24,objattrib,0)
  InsertInteger(&pus,objattrib,8)
  status:=DllCall("ntdll\ZwCreateFile","str",fh,"UInt",desiredaccess,"str",objattrib,"str",io,"UInt",0,"UInt",fattribs
                  ,"UInt",sharemode,"UInt",createdist,"UInt",flags,"UInt",0,"UInt",0, "UInt")
  return % ExtractInteger(fh)
}


SetUnicodeStr(ByRef out, str_)
{
  VarSetCapacity(st1, 8, 0)
  InsertInteger(0x530025, st1)
  VarSetCapacity(out, (StrLen(str_)+1)*2, 0)
  DllCall("wsprintfW", "str", out, "str", st1, "str", str_, "Cdecl UInt")
}


ExtractInteger(ByRef pSource, pOffset = 0, pIsSigned = false, pSize = 4)
{
  Loop %pSize%
    result += *(&pSource + pOffset + A_Index-1) << 8*(A_Index-1)
  if (!pIsSigned OR pSize > 4 OR result < 0x80000000)
    return result
  return -(0xFFFFFFFF - result + 1)
}


InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
{
  Loop %pSize%
    DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}

LockKey:
Return

F12::
ExitApp


Keyboard lights code is from evl:
http://www.autohotkey.com/forum/topic10532.html

And the code to disable the close button is from SKAN's awesome thread:
http://www.autohotkey.com/forum/viewtop ... 2506#62506

Use F12 to kill.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 15th, 2009, 8:15 pm 
What's funny is that after 7 pages of this stuff, THIS THREAD is getting annoying!


Report this post
Top
  
Reply with quote  
PostPosted: August 18th, 2009, 4:37 am 
Offline

Joined: January 20th, 2007, 1:29 pm
Posts: 96
Location: Melbourne
my wife is gonna kill me if she ever finds out what i did to her pc,
I wrote a couple of lines to play those "Windows 'attention' grabber" sounds like the Messenger 'Message' sound and the windows critical error sound.
it plays randomly every couple of hours and has no tray icon.
She ALWAYS has to get up and go look. and when it plays while she is at the keyboard!!!!!! she gets this confused blank look thats hard not to laff at....
I modified the random ultrasonic beep code i posted in this thread a while back to do it.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2009, 11:28 am 
Offline

Joined: August 28th, 2009, 11:17 am
Posts: 599
Location: Brighton, UK
engunneer wrote:
i think someone posted how to make an ahk script run as a screensaver, including the preview and settings buttons.

Just need to make it so it doesn't exit on mouse movement, but instead requires a special key combo to unlock


I can't remember who orignaly posted this but here is my modified version. You need to compile it to an .exe then rename the extension .scr then right click on the file and click install.

It displays a simple GUI window (that can be removed if you want) and moves the mouse randomly around the screen. You need to press ctrl alt del to stop it. If the computer is set to lock after screen saver it will blank the screen when it runs (but the mouse still moves).

Code:
; Simple (Non-)Screensaver framework V3.1(can be used to create own Screensavers by compiling and renaming to .scr).  This script requires v1.0.44.12 or later
; This script consists of :
; many code-snippets from the AHK-Help File and of certain lines from this forum ;-)
; it was inspired by the input from this Forum, the Scrrensaver tutorial at http://www.wischik.com/scr/howtoscr.html and the MSDN help pages
; so it´s mostly not my code
; the updated version contains contribution from: Murple & majkinetor
;--------------------------------------------------------------------------------------------------------------------------------------
#NoTrayIcon
#SingleInstance force
CoordMode, Mouse, Screen
;--------------------------------------------------------------------------------------------------------------------------------------
;this is the main section, which will run on startup
;as the behaviour expected of the saver depends on the command-line arguments it is given
;first the command-line arguments are checked using the
;build in vars 0,1,2,3,... ,where 0 contains the number of command-line arguments given
;there are several rules for reacting to command-line arguments
;if the command line arguments are invalid, then the saver should terminate immediately without doing anything.
;if argument = /c, /c ####, or no arguments at all - in response to any of these the saver should pop up its configuration dialog.
;if argument = /s - this indicates that the saver should run itself as a full-screen saver.
;if argument = /p ####, or /l #### - here the saver should treat the #### as the decimal representation of an HWND, and  pop up a child window to run in preview mode inside that window.
;if argument = /a #### - this argument is only used in '95 and Plus! The saver should pop up a password-configuration dialog.
;the command-line options may appear as lower-case or upper-case, and that there might be either a forward slash or a hyphen prefixing the letter.
; this script does not support all the modes
; it will show no pw-change window under W9x
;--------------------------------------------------------------------------------------------------------------------------------------
if 0 = 0 ; checks if no command-line arguments have been passed
{
runmode = config ; the var runmode is used to decide what action the screensaver shall perform
confparam = false ; confparam will be false if no valid cmd-line arguments have been passed
}
else
{
   Loop, %0%  ; For each parameter:
   {
      param := %A_Index%  ; Fetch the contents of the variable whose name is contained in A_Index.
      if param contains s,S
      {
         runmode = show
         confparam = true
         break
      }
      if param contains c,C
      {
         runmode = config
         confparam = true
         nextparam := A_Index + 1
         ParentHwnd := %nextparam% ;Decimal representation of optional HWND
        SetFormat, integer, hex
        ParentHwnd += 0       ;Standard hex HWND
        SetFormat, integer, d
         break
      }
      if param contains p,P,l,L
      {
        runmode = preview
        confparam = true
      nextparam := A_Index + 1
        ParentHwnd := %nextparam% ;Decimal representation of HWND for SSDEMOPARENT1 control of Display Properties window.
       SetFormat, integer, hex
       ParentHwnd += 0       ;Standard hex HWND for SSDEMOPARENT1
       SetFormat, integer, d
        break
      }
      if param contains a,A
      {
         runmode = pwconfig
         confparam = true
         break
      }
      else
      {
         runmode = undefined
      }
   }
}
; load the configuration via the getconf subroutine
GoSub, getconf
; decide what mode to start
; right now only show, config and preview (thanks to murple) are supported, all other modes will exit the saver
if runmode = show
{
   GoSub, svrshow
   return
}
if runmode = config
{
   GoSub, svrconfig
   return
}
if runmode = preview
{
   GoSub, svrpreview
   return
}
if runmode = pwconfig
{
   GoSub, svrend
   return
}
if runmode = undefined
{
   GoSub, svrend
   return
}
GoSub, svrend
return
;--------------------------------------------------------------------------------------------------------------------------------------
 ; the getconfig subroutine should contain all the internal and external configuration
; it is called by the startup section prior to all other subroutines
;--------------------------------------------------------------------------------------------------------------------------------------
getconf:
MouseGetPos, MousePosX, MousePosY ; stores original coursor-position to put it back there before stopping the saver
;here the saver configuration is read from the registry and set to default values if no configuration data is present in the registry
; make shure to chose your own values for CompanyName and Product Name
RegRead, CustomColor, HKEY_CURRENT_USER, Software\AHKSaver\MyAHKSaver\, BGColor
if not CustomColor
{
CustomColor = 000000  ; Can be any RGB color (000000 is black)
}
RegRead, Mouseoffset, HKEY_CURRENT_USER, Software\AHKSaver\MyAHKSaver\, MOffset
if not Mouseoffset
{
Mouseoffset = 3  ; Can be any full number
}
return
;--------------------------------------------------------------------------------------------------------------------------------------
; the ButtonOK label is run when the OK Button from scrconfig is pressed
; it stores the configuration in the registry
;.It should be saved in the registry in the standard location: HKEY_CURRENT_USER\Software\MyCompany\MyProduct\.
;--------------------------------------------------------------------------------------------------------------------------------------
ButtonOK:
Gui, Submit
; make shure to chose your own values for CompanyName and Product Name
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\AHKSaver\MyAHKSaver\, BGColor, %config1%
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\AHKSaver\MyAHKSaver\, MOffset, %config2%
Gosub, svrend
return
;--------------------------------------------------------------------------------------------------------------------------------------
; WM_ENDAPP is the handler for the incoming Windows Messages
; it will call the svrend subroutine to end the screensaver if any of the Messages above will arrive
;--------------------------------------------------------------------------------------------------------------------------------------
WM_ENDAPP()
{
Gosub, svrend
return
}
;--------------------------------------------------------------------------------------------------------------------------------------
; CHECKENDAPP is the handler for the incoming Windows Message WM_MOUSEMOVE
; it will call the svrend subroutine to end the screensaver if the Mouse has left the parking position
;--------------------------------------------------------------------------------------------------------------------------------------
WM_CHECKEND()
{
MouseGetPos, MouseX, MouseY
; first make the global parking position var accessible in this funktion
global LowerLimitX
global LowerLimitY
global UpperLimitX
global UpperLimitY
; then check if mouse has left the parking position
if MouseX not between %LowerLimitX% and %UpperLimitX%
GoSub, svrend
if MouseY not between %LowerLimitY% and %UpperLimitY%
GoSub, svrend
return
}
;--------------------------------------------------------------------------------------------------------------------------------------
;This is the programm closing subroutine, all other subroutines or funtions will call this to exit the saver
; GuiClose and svrend will both execute the following
;--------------------------------------------------------------------------------------------------------------------------------------
GuiClose: ;  in case the gui was aborted
svrend:
;the next line should unblock Ctrl+Alt+Esc and Alt+Tab under Win9x, but it´s not tested and only neccesary with the corresponding DllCall-Line above
;DllCall("SystemParametersInfo", "Str", "SPI_SETSCREENSAVERRUNNING", "UInt", "0", "UInt*", previousstate, "UInt", "0")
Gui, Destroy
if (runmode = "config") ; reenable the underlying window, that was disabled by the svrconfig:-subrutine
{
   WinSet, Enable, , ahk_id %ParentHWND%
   WinActivate, ahk_id %ParentHWND%
}
if (runmode = "show") ; only reset mouseposition if in show-mode
{
   DllCall("SetCursorPos", int, MousePosX, int, MousePosY) ; moves the Cursor back to where it was before screensaver started
}
ExitApp

^x:: ExitApp
;--------------------------------------------------------------------------------------------------------------------------------------
; svrconfig shows the configuration dialog of the saver
;the ButtonOK subroutine stores the changes if OK is pressed
; this mode is NOT implemented, as following:
; With /c  as an argument, use the ForegroundWindow as its parent.
;With /c ####  the saver should treat #### as the decimal representation of an HWND, and use this as its parent.
;If there are no arguments then NULL should be used as the parent.
;Since this behaviour is a little different than other screensavers actually show, it is commented out rigth now, uncomment the marked lines if you like
; instead the underlying window is disabled and reenabled when the server ends.
;--------------------------------------------------------------------------------------------------------------------------------------
svrconfig:
; choose the right parent window
if (ParentHWND = "" OR !WinExist("ahk_id " . ParentHWND))
{
   ParentHWND := WinExist("A")   
}
if (confparam = "false")
{
   ParentHWND := 0
}
; creat config Gui
Gui, Add, Text,, Backgroundcolor in RGB-Hex (000000 is black) :
Gui, Add, Edit, vconfig1, %CustomColor%
Gui, Add, Text,, Minimum movement the Mouse has to make to quit the saver (in pixel) :
Gui, Add, Edit, vconfig2, %Mouseoffset%
Gui, Add, Button, default, OK  ; The label ButtonOK  will be run when the button is pressed.
Gui + Lastfound
WinSet, Disable, , ahk_id %ParentHWND%
;DllCall( "SetParent", "uint", WinExist(), "uint", ParentHwnd) ; UNCOMMENT IF YOU LIKE: make the preview-Gui a child of the HWND passed through the command-line
Gui, Show, , Simple Saver Configuration
return
;--------------------------------------------------------------------------------------------------------------------------------------
;svrpreview previews the screensaver inside the Display Properties window.
;therefore it should end with an endless Loop
;the saver terminates itself through the GuiClose:-subroutine when the owning window is destroyed by the system,
;the Preview-GUI -as a child-window- is destroyed, too. So the GuiClose:-subroutine is triggered
;
; attention, the preview in this example actually displays a picture not related to the actual screensaver
;--------------------------------------------------------------------------------------------------------------------------------------
svrpreview:
ControlGetPos, , , ssW, ssH, , ahk_id %ParentHwnd% ; get the Size of the window, that´s supposed to be the parent of the preview window
Gui, -Caption
Gui, Add, Picture, x0 y0 w%ssW% h%ssH% , %windir%\winnt.bmp ; %ssW% and %ssH% are the Size and Width of the preview-window, use them to scale the controls
Gui +LastFound ; prepare for the following DDL-Call
DllCall( "SetParent", "uint", WinExist(), "uint", ParentHwnd) ; make the preview-Gui a child of the HWND passed through the command-line
Gui, Show, w%ssW% h%ssH% x0 y0 ; show the preview-GUI relative to the owning control
Loop
{
   sleep 5000
}
return
;--------------------------------------------------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------------------------------------------------
;this is the actual screensaver
;the svrshow subroutine will display the fullscreen saver
;therefore it should end with an endless Loop
;the saver terminates itself by incoming Windows Messages, so
;there is no need to continuously check the mouse positon or any keystrokes
;--------------------------------------------------------------------------------------------------------------------------------------
svrshow:
; this block creates a fullscreen window without any borders in any color set in the var "CustomColor"
SysGet, Width, 78
SysGet, Height, 79
Gui, +Owner -Caption
Gui, Font, S60 CDefault, Verdana
Gui, Add, Text, x6 y-3 w1190 h420 , WARNING!`nWINDOWS IS CRASHING!
Gui, Show, x100 y100 h197 w1126
Loop
{
random,ranx,0,%width% ;Random x coordinates
random,rany,0,%height% ;Random y coordinates
random,rans,1,30 ;Random mouse speed
mousemove,ranx,rany,rans ;mouse move


sleep, 100
; this block checks the actual mouse position and creates defines the parking position of the mouse
MouseGetPos, MouseX, MouseY
LowerLimitY := (MouseY - Mouseoffset)
UpperLimitY := (MouseY + Mouseoffset)
LowerLimitX := (MouseX - Mouseoffset)
UpperLimitX := (MouseX + Mouseoffset)
; the following OnMessage commands make the Screensaver listen to several Window Messages
; to get information if the mouse was moved, a mouse-button pressed or a system key or non-system key on the keybord was pressed
; whenever the system sends one of the messages below , the script will start the WM_ENDAPP() funktion
; this will eventually exit the saver
OnMessage(0x201, "WM_ENDAPP") ; WM_LBUTTONDOWN : indicates that the left mouse button was pressed
OnMessage(0x204, "WM_ENDAPP") ; WM_RBUTTONDOWN : indicates that the right mouse button was pressed
OnMessage(0x207, "WM_ENDAPP") ; WM_MBUTTONDOWN : indicates that the middle mouse button was pressed
;OnMessage(0x200, "WM_CHECKEND") ; WM_MOUSEMOVE : indicates that the mouse was moved
OnMessage(0x100, "WM_ENDAPP") ; WM_KEYDOWN : indicates that a non-system key was pressed
OnMessage(0x104, "WM_ENDAPP") ; WM_SYSKEYDOWN : indicates that a system key was pressed
OnMessage(0x1C, "WM_ENDAPP") ; WM_ACTIVATEAPP : indicates that another application needs the focus
OnMessage(0x06, "WM_ENDAPP") ; WM_ACTIVATE : indicates that another application needs the focus
OnMessage(0x10, "WM_ENDAPP") ; WM_CLOSE : indicates that the system wants to close the program
;the next line should block Ctrl+Alt+Esc and Alt+Tab under Win9x, but it´s not tested and only neccesary for pw-protection under Win9x
;DllCall("SystemParametersInfo", "Str", "SPI_SETSCREENSAVERRUNNING", "UInt", "1", "UInt*", previousstate, "UInt", "0")
}
Loop
{
   sleep, 5000
}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2009, 11:31 am 
Offline

Joined: August 28th, 2009, 11:17 am
Posts: 599
Location: Brighton, UK
This gets rid of the start button.
The script only runs once and doesnt need to be running to keep the start button hidden. Place in startup for some laughs.


Code:
; hidestart.ahk
Control, Hide, , Button1, ahk_class Shell_TrayWnd


To show the start button again use:
Code:
Control, Show, , Button1, ahk_class Shell_TrayWnd


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2009, 10:26 pm 
Aw, we need way more social engineering! Not that this is a real attempt but can you imagine certain users? heh heh heh

Code:
Loop, 100000
{
MouseMove, 0, 0
msgbox , UNSAVING ALL WORK, FORMATTING HARD DISK ; initial panic
msgbox , SYSTEM WILL SHUT DOWN IN 42 SECONDS ; forty two is the answer
msgbox , DISTRIBUTING VIRUS TO FACEBOOK FRIENDS... ;freak em out
sleep, 3000
msgbox , VIRUSES DISTRIBUTED, PARSING READOUT TO ENCLAVE
Loop, 20
   {
   mousemove, 0, 100
   mousemove, 100, 100
   mousemove, 10, 100
   mousemove, 50, 30
   mousemove, 0, 100
   mousemove, 0, 101
   mousemove, 0, 110
   mousemove, 0, 120
}
msgbox , MIREING SYSTEM THREAD IN WOB FORMAT, ZATNIKATELS PRIMED ;fun things for the helpde
msgbox, 4112,, WINDOWS SYSTEM WARNING: BLASTER32 VIRUS DETECTED PLEASE CALL HELPDESK ;oh man, would they love this one
mousemove, 0, 100
mousemove, 100, 0
Return
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:40 am 
Offline

Joined: July 6th, 2009, 9:58 pm
Posts: 678
This gave me an idea...

Have a snoopy colleague? You could set a trap...

How about a program that makes your system never lock out or go idle, but if you have no activity for more than 10 seconds (or something) you have to hit a key, print screen or escape as the next key or it will restrict the user access so that you can only browse directories, not open files or execute programs... it starts recording the desktop using FRAPS and taking webcam shots so you can tell exactly what a desk side intruder was after and who they were.

Then just get up and leave your workstation unlocked. Instant busted. :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 2:57 am 
Offline

Joined: April 4th, 2008, 8:15 pm
Posts: 538
Location: Canada
Code:
#NoTrayIcon
SetBatchLines -1
Loop 94
  Hotkey % Chr(A_Index+32), Beep
return

Beep:
BlockInput On
Freq = 1
Loop
 {
  i += 1
  SoundBeep %Freq%, (2^31)-1
  if i < 500
   Freq := i
  Freq = 0
 }


Not tested


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 141 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: XX0 and 26 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