Advertisement
deseven

capser

Apr 1st, 2015
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Capser
  2.  
  3. a$=Space(999) : GetModuleFileName_(0,@a$,999) : appname$=GetFilePart(a$)
  4. Global SpaceKey = #False
  5.  
  6. Procedure KeyPressed()
  7.   SpaceKey = #False
  8.   For i=48 To 90
  9.     If GetAsyncKeyState_(i) = -32767
  10.       ProcedureReturn #True
  11.     EndIf
  12.   Next
  13.   If GetAsyncKeyState_(#VK_SPACE) = -32767
  14.     SpaceKey = #True
  15.     ProcedureReturn #True
  16.   EndIf
  17.   ProcedureReturn #False
  18. EndProcedure
  19.  
  20. Procedure Capser(dummy)
  21.   Repeat
  22.     RandFunc.i = Random(99) + 1
  23.     If KeyPressed()
  24.       If RandFunc > 40
  25.         keybd_event_(#VK_CAPITAL,0,0,0)
  26.         keybd_event_(#VK_CAPITAL,0,#KEYEVENTF_KEYUP,0)
  27.       Else
  28.         If SpaceKey = #True
  29.           SpaceKey = #False
  30.           Select Random(9) + 1
  31.             Case 1
  32.               SetClipboardText(" ^__^ ")
  33.             Case 2
  34.               SetClipboardText(" *~~^__^~~* ")
  35.             Case 3
  36.               SetClipboardText(" :-* ")
  37.             Case 4
  38.               SetClipboardText(" xD ")
  39.             Case 5
  40.               SetClipboardText(" <3 ")
  41.             Case 6
  42.               SetClipboardText(" :) ")
  43.             Case 7
  44.               SetClipboardText("!!1 ")
  45.             Case 8
  46.               SetClipboardText("!?? ")
  47.             Case 9
  48.               SetClipboardText("))) ")
  49.             Case 10
  50.               SetClipboardText(". ")
  51.           EndSelect
  52.           keybd_event_(#VK_BACK,0,0,0)
  53.           keybd_event_(#VK_BACK,0,#KEYEVENTF_KEYUP,0)
  54.           keybd_event_(#VK_CONTROL,0,0,0)
  55.           keybd_event_(#VK_V,0,0,0)
  56.           keybd_event_(#VK_V,0,#KEYEVENTF_KEYUP,0)
  57.           keybd_event_(#VK_CONTROL,0,#KEYEVENTF_KEYUP,0)
  58.         EndIf    
  59.       EndIf
  60.     EndIf
  61.     Sleep_(1)
  62.   ForEver
  63. EndProcedure
  64.  
  65. If OpenWindow(0,1,1,1,1,"Capser",#PB_Window_Invisible|#PB_Window_BorderLess)
  66.   Icon = ExtractIcon_(WindowID(0),appname$,0)
  67.   AddSysTrayIcon(1,WindowID(0),Icon)
  68.   SysTrayIconToolTip(1,"Capser")
  69.   If CreatePopupMenu(0)
  70.     MenuItem(1,"Capser")
  71.     DisableMenuItem(0,1,1)
  72.     MenuBar()
  73.     MenuItem(2,"Exit")
  74.   EndIf
  75.   CapserThread = CreateThread(@Capser(),dummy)
  76. EndIf
  77.  
  78. Repeat
  79.   ev = WaitWindowEvent()
  80.   If ev = #PB_Event_SysTray And EventType() = #PB_EventType_RightClick
  81.     DisplayPopupMenu(0, WindowID(0))
  82.   EndIf
  83.   If ev = #PB_Event_Menu And EventMenu() = 2
  84.       ev = #PB_Event_CloseWindow
  85.   EndIf
  86.   If ev = #PB_Event_CloseWindow
  87.     KillThread(CapserThread)
  88.   EndIf
  89. Until ev = #PB_Event_CloseWindow
  90.  
  91. ; IDE Options = PureBasic 4.51 (Windows - x86)
  92. ; CursorPosition = 47
  93. ; FirstLine = 20
  94. ; Folding = -
  95. ; EnableXP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement