Untitled

-InputFile linkek.txt -delay 0
 avatar
unknown
html
a year ago
2.5 kB
14
Indexable
# inkognito script a kozossegnek
# chrome,edge,firefox szót csereld ha nem azod van.

param(
    [Parameter(Mandatory=$true)]
    [string]$InputFile,
    
    [Parameter(Mandatory=$false)]
    [string]$Browser = "chrome",  # chrome, edge, firefox
    
    [Parameter(Mandatory=$false)]
    [int]$DelaySeconds = 2  # Delay between opening links
)

# van input?
if (!(Test-Path $InputFile)) {
    Write-Error "Input file does not exist: $InputFile"
    exit 1
}

# felolvasas
$links = Get-Content $InputFile | Where-Object { $_.Trim() -ne "" }
$total = $links.Count

if ($total -eq 0) {
    Write-Host "Nincs link a fajlban" -ForegroundColor Yellow
    exit 0
}

Write-Host "Talalat $total link nyilik meg itt $Browser inkognito modban..." -ForegroundColor Green

# bongeszoparancsok
$browserCommands = @{
    "chrome" = @{
        "exe" = "chrome.exe"
        "args" = "--incognito"
    }
    "edge" = @{
        "exe" = "msedge.exe" 
        "args" = "--inprivate"
    }
    "firefox" = @{
        "exe" = "firefox.exe"
        "args" = "--private-window"
    }
}

if (-not $browserCommands.ContainsKey($Browser.ToLower())) {
    Write-Error "nem tamogatott bongeszo: $Browser. Tamogatott: chrome, edge, firefox"
    exit 1
}

$browserConfig = $browserCommands[$Browser.ToLower()]

# biztos ennyit nyissunk
if ($total -gt 10) {
    $response = Read-Host "Meg akarsz nyitni $total linket. Folyt?? (y/N)"
    if ($response -notmatch "^[Yy]") {
        Write-Host "Cancelled." -ForegroundColor Yellow
        exit 0
    }
}

$current = 0
foreach ($link in $links) {
    $link = $link.Trim()
    
    if ($link -eq "") { continue }
    
    $current++
    Write-Host "[$current/$total] Nyitas: $link" -ForegroundColor Cyan
    
    try {
        # Bongeszo inditasa privatban
        Start-Process -FilePath $browserConfig.exe -ArgumentList @($browserConfig.args, $link) -ErrorAction Stop
        
        Write-Host "Sikeresen megnyitva" -ForegroundColor Green
    }
    catch {
        Write-Host "Nem lehet nyitni: $($_.Exception.Message)" -ForegroundColor Red
    }
    
    # Varakozas
    if ($current -lt $total) {
        Write-Host "Várakozás $DelaySeconds másodpercet..." -ForegroundColor Gray
        Start-Sleep -Seconds $DelaySeconds
    }
}

Write-Host "`nOssz link feldolgozva!" -ForegroundColor Green
Write-Host "Ennyi megnyitva: $current links" -ForegroundColor Cyan
Editor is loading...
Leave a Comment