Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Strict
- ' Clipboard Text - Copy/Paste functions
- 'Module leadwerks.clipboard
- 'ModuleInfo "Version: 1.0.0"
- 'ModuleInfo "Author: Joshua Klint"
- 'ModuleInfo "www.leadwerks.com"
- Import brl.pixmap
- Import pub.win32
- Extern "Win32"
- Function OpenClipboard%(hwnd%)
- Function CloseClipboard%()
- Function EmptyClipboard%()
- Function IsClipboardFormatAvailable%(format%)
- Function GetClipboardData:Byte Ptr(Format:Int)
- Function SetClipboardData(format%, hMem:Byte Ptr)
- Function GlobalAlloc(Flags:Int, Bytes:Int)
- Function GlobalFree(Mem:Int)
- Function GlobalLock:Byte Ptr(Mem:Int)
- Function GlobalUnlock(Mem:Int)
- Function CreateBitmap:Byte Ptr(width:Int,height:Int,colorplanes:Int,bpp:Int,data:Byte Ptr)
- 'Function SetFocus%(hwnd%)
- End Extern
- Const CF_TEXT%=$1
- Const CF_BITMAP%=2
- Const GMEM_MOVEABLE%=$2
- Const GMEM_DDESHARE%=$2000
- ' -----------------------------------------------
- AppTitle$ = "GIMP.exe"
- Const screenWidth:Int = 164 * 2
- Const screenHeight:Int = 164 * 2
- Graphics(screenWidth, screenHeight,0,120)
- Incbin "mado.png"
- Global mado:TImage = LoadImage("Incbin::mado.png")
- Incbin "madoOff.png"
- Global madoOff:TImage = LoadImage("Incbin::madoOff.png")
- Incbin "madoDouble.png"
- Global madoDouble:TImage = LoadImage("Incbin::madoDouble.png")
- Global image:TImage
- Global active:Int = 1
- Global timer:Int = 0
- Global randomGimp:String
- Global jokerFile:TStream = ReadStream("gimps.txt")
- Global jokerArray:String[10000]
- Global fileExists:Int = 0
- Global doubleMode:Int = 0
- Global bridgeArray:String[5]
- bridgeArray[0] = "and"
- bridgeArray[1] = "but"
- bridgeArray[2] = "or"
- bridgeArray[3] = "btw"
- bridgeArray[4] = "also"
- Local tempLine:String
- Local i:Int
- Global numJokes:Int = 0
- If jokerFile
- fileExists = True
- For i = 0 To Len(jokerArray)
- tempLine = ReadLine(jokerFile)
- jokerArray[i] = tempLine
- If tempLine = Null
- numJokes = i
- Exit
- EndIf
- Next
- CloseFile(jokerFile)
- Else
- active = False
- fileExists = False
- EndIf
- 'Print (jokerArray[2] + " test")
- 'Print (numJokes + " is num jokes")
- Repeat '------------------------------------------------------------------------------------------
- If KeyHit(KEY_LCONTROL) Or KeyHit(KEY_RCONTROL) active = Not active
- If KeyHit(KEY_LALT) Or KeyHit(KEY_RALT) doubleMode = Not doubleMode
- If active And fileExists
- If doubleMode
- image = madoDouble
- Else
- image = mado
- EndIf
- Else
- image = madoOff
- EndIf
- 'SetFocus()
- DrawImage(image, 0,0)
- If Not fileExists
- DrawText("add gimps.txt in the",0 ,0)
- DrawText("same directory as GIMP.exe",0 ,16)
- DrawText("fucktard",264 ,264)
- EndIf
- If GetChar() End
- If AppTerminate()
- End
- EndIf
- If KeyHit(KEY_ESCAPE) Then End
- Local randomNumber:Int = Rand(0, numJokes -1)
- Local randomNumber2:Int = Rand(0, numJokes -1)
- If active
- 'If timer = 0
- If doubleMode
- SetClipboardText(jokerArray[randomNumber] + " " + bridgeArray[Rand(0,4)] + " " + jokerArray[randomNumber2])
- Else
- SetClipboardText(jokerArray[randomNumber] + " ")
- EndIf
- 'EndIf
- timer = timer +1
- If timer > 120 Then timer = 0
- 'Print (jokerArray[randomNumber])
- EndIf
- Flip
- Forever '-----------------------------------------------------------------------------------------
- Function SetClipboardText:Int(txt:String)
- 'Print "setClip"
- 'Print txt
- Local result:Int=False
- If txt$="" Return
- Local TextBuf:Byte Ptr = Txt.ToCString()
- Local Memblock:Int = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, txt.Length+1)
- Local DataBuf:Byte Ptr = GlobalLock(Memblock)
- MemCopy DataBuf, TextBuf, Txt.length
- If OpenClipboard(0)
- EmptyClipboard
- SetClipboardData CF_TEXT, DataBuf
- CloseClipboard
- result=True
- Else
- Print "failed to open clipboard."
- EndIf
- GlobalUnlock Memblock
- GlobalFree Memblock
- Return result
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement