param ( [string]$Website, [string]$FilePath #[string]$Keywords ) chcp 65001 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 Write-Output "Webseite: $Website" Write-Output "Dateipfad: $FilePath" Write-Output "Keywords: $Keywords" $chatbot1 = "https://chatgpt.com/" $chatbot2 = "https://gemini.google.com/app" # Hauptprogramm Write-Output "-------------------------------------------------" Write-Output "Bitte waehlen Sie aus:" Write-Output "1. Keyword selbst eingeben" Write-Output "2. Keyword aus Datei: thema.txt Datei holen" # Benutzereingabe einlesen $auswahl = Read-Host "Bitte waehlen: (1 oder 2):" # Abhängig von der Auswahl des Benutzers das entsprechende Unterprogramm aufrufen switch ($auswahl) { "1" { # Fall "1": Keyword eingeben und in die Zwischenablage kopieren $textFile = "prompt-chatgpt.txt" $keywords = Read-Host "Keyword eingabe:" if (Test-Path $textFile) { $fileContent = Get-Content $textFile -Raw -Encoding UTF8 $fileContent = $fileContent -replace 'xxx', $keywords # Loescht den Inhalt der Zwischenablage Add-Type -AssemblyName System.Windows.Forms [Windows.Forms.Clipboard]::Clear() # Kopiert den modifizierten Text in die Zwischenablage [Windows.Forms.Clipboard]::SetText($fileContent) Write-Output "Keyword ist in Zwischenablage" Start-Process "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList $chatbot1 Start-Sleep -Seconds 2 # Wartezeit fuer das Laden der Seite } else { Write-Output "Datei nicht gefunden: $textFile" New-Item -Path . -Name "prompt-chatgpt.txt" -ItemType "File" } } "2" { # Schleife, die immer wieder ausgefuehrt wird, bis "exit" eingegeben wird while ($true) { # Benutzerabfrage fuer exit $eingabe = Read-Host "'exit' = Skript beenden, Enter = fortzufahren" if ($eingabe -eq "exit") { break } # Fall "3": Automatisches Auslesen eines Themas aus einer Datei $themenDatei = "thema.txt" if (Test-Path $themenDatei) { $ersteZeile = Get-Content -Path $themenDatei -TotalCount 1 -Encoding UTF8 Write-Output "-------------------------------------------------------------------" Write-Output "Prompt mit Thema: $ersteZeile " Write-Output " koennen in ChatGPT eingefuegt werden. (mit Strg-v)" $textFile = "prompt-chatgpt.txt" # Passe den Pfad zu deiner Textdatei an if (Test-Path $textFile) { $fileContent = Get-Content $textFile -Raw -Encoding UTF8 $fileContent = $fileContent -replace 'xxx', $ersteZeile # Loescht den Inhalt der Zwischenablage Add-Type -AssemblyName System.Windows.Forms [Windows.Forms.Clipboard]::Clear() # Kopiert den modifizierten Text in die Zwischenablage [Windows.Forms.Clipboard]::SetText($fileContent) Pause # Loescht die erste Zeile aus der Datei $restlicheZeilen = Get-Content $themenDatei | Select-Object -Skip 1 $restlicheZeilen | Set-Content $themenDatei Start-Process "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList $chatbot1 Start-Sleep -Seconds 2 # Wartezeit fuer das Laden der Seite } else { Write-Output "Datei wurde erzeugt: $textFile" New-Item -Path . -Name "prompt-chatgpt.txt" -ItemType "File" # Datei erstellen und Text hineinschreiben $text = "Das ist ein Text aus prompt-chatgpt.txt Hier sollte anstelle von (x x x) dein Thema: xxx stehen." $filePath = ".\prompt-chatgpt.txt" Set-Content -Path $filePath -Value $text } } else { Write-Output "Datei nicht gefunden: $themenDatei" # Datei erstellen und Text zehnmal hineinschreiben $text = "Keyword aus thema.txt" $filePath = ".\thema.txt" # oeffnen Sie eine neue Datei und schreiben Sie den Text zehnmal hinein 1..10 | ForEach-Object { Add-Content -Path $filePath -Value $text } } } } default { Write-Output "Ungueltige Auswahl. Programm wird beendet." } }