Slack Typer - AFK

Script Summary
This PowerShell script simulates random typing and mouse movement to mimic human-like behavior on platforms like Slack.
Key Features
1. Random Typing
Types random characters (A-Z, 1-9) with:
Variable typing speed: 100–300ms delay between characters.
Random spaces: Inserts spaces after typing 3–10 characters, simulating words.
2. Slack-Safe Behavior
- Automatically deletes 35–56 characters after typing 80–100 characters to prevent messages from growing too large.
3. Typing Breaks
Pauses typing for 2–5 seconds at random intervals, with a slight variation of ±0.5 seconds.
Logs the actual pause time:
Pausing for 3.2 seconds to simulate a typing break...
4. Mouse Movement
Moves the mouse randomly every 10–15 typing breaks:
Shifts the cursor by 1–20 pixels in random directions (X and Y).
Logs the movement:
Mouse moved randomly to a new position...
5. Realistic Randomization
Uses random thresholds for:
Typing pauses.
Word lengths.
Break intervals.
Mouse movements.
Usage
Designed for Slack or similar platforms to simulate activity.
Keeps the interface active with a mix of random typing and mouse movement.
# Load the necessary assembly for key and mouse simulation
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class InputSimulator {
[DllImport("user32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")]
public static extern void GetCursorPos(out POINT lpPoint);
public struct POINT {
public int X;
public int Y;
}
}
"@
# Display the initial message
Write-Host "Script beginning in 5 seconds, open Slack chat with yourself and click into the box..."
for ($i = 5; $i -ge 1; $i--) {
Write-Host "$i..."
Start-Sleep -Seconds 1
}
# List of keys to randomly choose from (a-z and 1-9)
$keyList = @(0x41..0x5A + 0x31..0x39) # Virtual key codes for A-Z (0x41-0x5A) and 1-9 (0x31-0x39)
$spaceKey = 0x20 # Virtual key code for Space
# Initialize counters and thresholds
$charCount = 0
$totalCharsTyped = 0
$deleteThreshold = Get-Random -Minimum 80 -Maximum 101
$wordLengthThreshold = Get-Random -Minimum 3 -Maximum 10
$moveAfterBreaksThreshold = Get-Random -Minimum 10 -Maximum 15
$breakCount = 0
# Define a POINT structure for mouse position
$point = New-Object "InputSimulator+POINT"
while ($true) {
# Decide whether to type a space or a character
if ($charCount -ge $wordLengthThreshold) {
# Insert a space
[InputSimulator]::keybd_event($spaceKey, 0, 0, 0) # Press Space key
Start-Sleep -Milliseconds (Get-Random -Minimum 50 -Maximum 150) # Delay for space
[InputSimulator]::keybd_event($spaceKey, 0, 2, 0) # Release Space key
# Reset word length threshold and character counter
$wordLengthThreshold = Get-Random -Minimum 3 -Maximum 10
$charCount = 0
} else {
# Type a random character
$randomKey = Get-Random -InputObject $keyList
[InputSimulator]::keybd_event($randomKey, 0, 0, 0) # Press key
Start-Sleep -Milliseconds (Get-Random -Minimum 100 -Maximum 300) # Random delay for key press
[InputSimulator]::keybd_event($randomKey, 0, 2, 0) # Release key
# Increment character counter
$charCount++
$totalCharsTyped++
}
# If the total characters exceed the delete threshold, remove a chunk
if ($totalCharsTyped -ge $deleteThreshold) {
Write-Host "Deleting a random number of characters to stay Slack-safe..."
$deleteCount = Get-Random -Minimum 35 -Maximum 56
for ($i = 1; $i -le $deleteCount; $i++) {
[InputSimulator]::keybd_event(0x08, 0, 0, 0) # Press Backspace key
Start-Sleep -Milliseconds (Get-Random -Minimum 50 -Maximum 150)
[InputSimulator]::keybd_event(0x08, 0, 2, 0) # Release Backspace key
}
# Reset delete threshold
$deleteThreshold = $totalCharsTyped + (Get-Random -Minimum 80 -Maximum 101)
}
# Occasionally pause for a natural typing break
if ((Get-Random -Minimum 1 -Maximum 10) -eq 5) {
$pauseTime = Get-Random -Minimum 2 -Maximum 5
$pauseVariation = Get-Random -Minimum -0.5 -Maximum 0.5
$actualPauseTime = [math]::Round($pauseTime + $pauseVariation, 1)
Write-Host "Pausing for $actualPauseTime seconds to simulate a typing break..."
Start-Sleep -Seconds $actualPauseTime
# Increment break count
$breakCount++
}
# Move the mouse after every 10–15 typing breaks
if ($breakCount -ge $moveAfterBreaksThreshold) {
# Get current mouse position
[InputSimulator]::GetCursorPos([ref]$point)
# Generate random pixel movement for X and Y directions
$randomX = Get-Random -Minimum 1 -Maximum 21
$randomY = Get-Random -Minimum 1 -Maximum 21
# Randomize direction for X and Y (-1 for negative, 1 for positive)
$directionX = Get-Random -Minimum -1 -Maximum 2
$directionY = Get-Random -Minimum -1 -Maximum 2
# Calculate new position
$newX = $point.X + ($randomX * $directionX)
$newY = $point.Y + ($randomY * $directionY)
# Move cursor to the new position
[InputSimulator]::SetCursorPos($newX, $newY) | Out-Null
Write-Host "Mouse moved randomly to a new position..."
# Reset break count and threshold
$breakCount = 0
$moveAfterBreaksThreshold = Get-Random -Minimum 10 -Maximum 15
}
}
Call it with Windows Batch script:
@echo off
powershell -ExecutionPolicy Bypass -File "C:\Users\roy.hayden\Desktop\Scripts\SlackTyper\keytest.ps1"
exit /b 0
Subscribe to my newsletter
Read articles from RH directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
